I want to switch a relay when more power is generated than 900 watts and it switches off again when 200 watts are supplied back.
It works with positive numbers, but not with negative ones (Smart meter)
Code: Select all
return {
on = {
timer = {'every minute'}
},
execute = function(domoticz,state)
local Relais = domoticz.devices (2157) -- Relais
local SlimmeMeter = domoticz.devices (22) -- Slimme meter
if (Relais.state == 'Off' and SlimmeMeter.actualWatt < -900 ) then
Relais.switchOn()
end
if (Relais.state == 'On' and SlimmeMeter.actualWatt > -200 ) then
Relais.switchOff()
end
end
}