On the master device ... go to the Advanced tab ... look for the name of the implementation file (called impl_file).Sounds like @futzle has some ideas about how to generalize this as a virtual device.
Thanks, but there is no file specified for impl_file on the AeonHEM, just a device file
I tried to do the following, but cant work out where I went wrong (or right for that matter)
You can create you own device and setting the value on a watching method
I do something like this with my 2 clamp version:
I create a virtual device type urn:schemas-micasaverde-com:device:PowerMeter:1 with device file D_PowerMeter1.xml
and in my startup script:
HEM_GEN is my first clamp ,HEM_PV my second clamp and HEM_CALC is my virtual device
luup.variable_watch("calcPowerKwh","urn:micasaverde-com:serviceId:EnergyMetering1","KWH",HEM_GEN)
luup.variable_watch("calcPowerWatts","urn:micasaverde-com:serviceId:EnergyMetering1","Watts",HEM_GEN)
function calcPowerKwh()
--kwh
local kwhGen = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", HEM_GEN)
local kwhPv = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", HEM_PV)
local s=kwhGen-kwhPv
luup.variable_set("urn:micasaverde-com:serviceId:EnergyMetering1","KWH",s,HEM_CALC)
end
function calcPowerWatts()
--Watts
local wattsGen = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", HEM_GEN)
local wattsPv = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", HEM_PV)
local s=wattsGen-wattsPv
luup.variable_set("urn:micasaverde-com:serviceId:EnergyMetering1","Watts",s,HEM_CALC)
end
So Perhaps I'll specify what I actually did, you may know where I went wrong
- I went to Apps>Develop Apps>Create device
- I entered
urn:schemas-micasaverde-com:device:PowerMeter:1 in the "device type: field
- I entered
D_PowerMeter1.xml in the "upnp device filename" field (this is the same device filename used by the AEON HEM
With every other field blank, (and drop down menues set to no room, no parent), I clicked Create Device
This resulted in a popup saying "device created 17", and when I go to the devices tab, I see it listed there with no name, and if I click on the spanner, under the control tab it says "watts" KWH"..... so far it appears to be going right... but next is where I think I've gone wrong
I now go back to Apps>Develop Apps, then go to Edit Startup Lua
I type in the following code (bearing in mind my clamps are named "Home_Clamp1", "SolarWEST_Clamp2", and "SolarEast_Clamp3"
function calcPowerKwh()
--kwh
local kwhGen = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", House_Clamp1)
local kwhPvw = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", SolarWEST_Clamp2)
local kwhPve = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", SolarEAST_Clamp3)
local s=kwhGen-kwhPvw-kwhPve
luup.variable_set("urn:micasaverde-com:serviceId:EnergyMetering1","KWH",s,HEM_CALC)
end
function calcPowerWatts()
--Watts
local wattsGen = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", House_Clamp1)
local wattsPvw = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", SolarWEST_Clamp2)
local wattsPve = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", SolarEAST_Clamp3)
local s=wattsGen-wattsPvw-wattsPve
luup.variable_set("urn:micasaverde-com:serviceId:EnergyMetering1","Watts",s,HEM_CALC)
end- I Click "GO", and a popup says "startup lua updated"
- I click Save
- I click Continue
- I return to devices
Upon inspecting my "handiwork" the virtual device still does nothing..... clearly the code is in the wrong place, or I need to make other changes - but...... what?
