The problem is that when the Aeotec Home Energy Meter (HEM) doesn't has power,
Domoticz still keeps holding the last values (for example 230V / 16.2 Watt / 0.2 A).
Ands that's unfortunately a fault in Domoticz I think because when there is no power all the Devices have to say/set to 0.
So, we are working with a script but this script fires only every minute. So, when the power is gone (or back again) it takes a full minute before Domoticz can do/say something. (And sometimes are 60 seconds a very loong time in a human life).
So, Is it possible to run the script below every 10 seconds?
The HEM Z-Wave Device data refreshes every 5 seconds.
So, the most beautiful solution is a Trigger when the HEM data doesn't refresh after >10 seconds. (Or is Life back again).
Thanks for all the support!
John
Code: Select all
return {
on = {
timer = { 'every minute' }},
execute = function( dz )
local voltage = dz.devices('Voltage')
local power= dz.variables('Power')
local function setvar(var, to)
if var.value ~= to and dz.startTime.secondsAgo > 60 then var.set(to) end
end
if voltage.lastUpdate.secondsAgo > 60 then
setvar(power,'Off')
else
setvar(power,'On')
end
end
}