Thanks for your reply - very helpful but I am still having problem with the switch section. Every minute appears in log but when I switch On nothing happens. Do I have to check that it is either On or Off?
execute = function(domoticz, device, triggerInfo)
if triggerInfo.type == domoticz.EVENT_TYPE_TIMER then
-- do timer event stuff
domoticz.log(' timer ')
elseif triggerInfo.type == domoticz.EVENT_TYPE_DEVICE then
-- do device event stuff
domoticz.log(' switch ')
end
end
}
that's quite wired....
is Switch1 wrote correctly and reflect the correct UPPER and lower case? (Swith1 is no switch1 )
try also to add this line after the extecute = (and before the if statement)
domoticz.log('Trigger ==> '..triggerInfo.type)
just to understand who's doing what
ciao
M
The most dangerous phrase in any language is:
"We always done this way"
return {
-- triggers
on = {
-- device triggers
devices = {
-- scripts is executed if the device that was updated matches with one of these triggers
42, -- Philips Hue Wall Switch
},
},
-- custom logging level for this script
logging = {
level = domoticz.LOG_DEBUG,
marker = "Hue wall switch initiated"
},
-- do something with the event
execute = function(domoticz, device, info)
if (device.active) then -- state == 'On'
device.switchOff().afterMin(1) -- if it is a switch, turn off after 1 minute
}