@tillo,
If you read carefully the topic I sent in my last post you will see that there is a bug in dzVent/domoticz.
The device Electrical(instant+counter) should normally get both power in Watts and the Energy in kWh from a sensor of some kind.
You don't have a sensor that gives you any updates so you were planning to do the update yourself.
Using dzVents would be the easiest way to do this, however the bug mentioned in the topic states that it is not working.
In the device Electrical(instant+counter) you have two options (not when creating the device but when pushing Edit in the utility screen!!), one option expects both power and energy updates from sensor and the second option needs only updating of power value.
For the second option the device/domoticz then calculates the energy reading by itself (pretty handy device).
If you know that you have 3000W of power to your pool heater you need only to update one value and that is the power value to the device.
There is a workaround:
By writing the power value to the device via json api the device do calculate correct energy values.
This is how I did:
Code: Select all
return {
on = {
timer = {
'every minute'
}
},
execute = function(domoticz, device)
if (domoticz.devices('anslut3').state=='On') then
domoticz.openURL({
url = 'http://192.168.40.96:8080/json.htm?type=command¶m=udevice&idx=327&nvalue=0&svalue=3000;0',
method = 'GET'})
else
domoticz.openURL({
url = 'http://192.168.40.96:8080/json.htm?type=command¶m=udevice&idx=327&nvalue=0&svalue=0;0',
method = 'GET'})
end
end
}
I used a switch called "anslut3" as your pool-heater switch for test and when it is on dzVents issues a command to domoticz via json api (thats the openURL function) to update the device with id 327 ( thats the Electrical(instant+counter)), at the end of the URL (svalue) the power and energy values goes.
This script is tested and works!
/R