Code: Select all
return {
active = true,
on = {
timer = {
'at 07:00',
'at 19:20',
'at 11:30',
},
},
execute = function(domoticz, myDevice, triggerInfo)
local myDevice1 = domoticz.devices('Espressomachine')
local myDevice2 = domoticz.devices('iDetect - Ronald')
local myDevice3 = domoticz.devices('iDetect - Regina')
if (triggerInfo.trigger == 'at 07:00') and (myDevice2.state == 'On') or (triggerInfo.trigger == 'at 19:20') and (myDevice2.state == 'On') or (myDevice3.state == 'On') then
myDevice1.switchOn().checkFirst()
elseif (triggerInfo.trigger == 'at 11:30') then
myDevice1.switchOff().checkFirst()
end
end
}
And at 19:20 when i at home or my wife (Regina)is at home.
And turn of the Espresso machine at 11:30 in the morning
But many often it turns on the machine on at 7:00 and an half hour later it turns of the machine.
Or in the evening when domoticz turns on the lights in the house, it turns on the espresso machine, but in that script there is no action for the espresso machine.
Is there a error in my script?