Switch off some switches depending on power usage
Posted: Saturday 25 January 2020 11:22
Hello friends, first of all sorry but I'm not programer and I have no idea of what I'm doing wrong.
I'm having problems with my energy usage, if too many things are On the electric company switches off the entire home. So I want to switch off some switches depending on power usage.
I've tried with this code but nothing happens:
If someone can tell me what is wrong I would appreciate
Thanks
I'm having problems with my energy usage, if too many things are On the electric company switches off the entire home. So I want to switch off some switches depending on power usage.
I've tried with this code but nothing happens:
Code: Select all
return {
on = {
timer = { 'every minute' }
devices = {
'contador',
'calefaccion_Bernat',
'calefaccion_papis',
'calentador'
}
},
execute = function(domoticz, device)
local contador = domoticz.devices(92)
local calefaccion_Bernat = domoticz.devices(11)
local calefaccion_papis = domoticz.devices(137)
local calentador = domoticz.devices(6)
if (contador.actualWatt > 3250 and calefaccion_Bernat.state == 'On') then
calefaccion_Bernat.switchOff().forMin(10)
domoticz.notify ('Consumo alto, apago calefaccion','Consumo alto, apago calefaccion')
end
if (contador.actualWatt > 3350 and calefaccion_papis.state == 'On') then
calefaccion_papis.switchOff().forMin(9)
domoticz.notify ('Consumo alto, apago calefaccion','Consumo alto, apago calefaccion')
end
if (contador.actualWatt > 3450 and calentador.state == 'On') then
calentador.switchOff().forMin(11)
domoticz.notify ('Consumo alto, apago calentador','Consumo alto, apago calentador')
end
end
}
Thanks