Switch off afer 1 minute fails, where is problem in this script
Posted: Monday 28 October 2019 0:10
Hi,
I have this switch which I want to go to state OFF 1 minute after it is switched ON
I have been searching this forum and wasn't able to find the answer.
Help in correcting the script is appreciated.
I have this switch which I want to go to state OFF 1 minute after it is switched ON
I have been searching this forum and wasn't able to find the answer.
Help in correcting the script is appreciated.
Code: Select all
return {
on = {
devices = {
'My_switch'
}
},
execute = function(domoticz, TriggeredItem)
domoticz.log('Device ' .. TriggeredItem .. ' was changed', domoticz.LOG_INFO)
if (TriggeredItem) then -- state == 'On'
TriggeredItem.switchOff().afterMin(1) -- if it is a switch
domoticz.notify('Light info', 'The light ' .. TriggeredItem.name .. ' will be switched off soon')
end
end
}