the 'on' part controls at what circumstances the script runs, so in this case you can say it should react on the switch, but you can also say only on the switch between 10 and 15 hour and on mon, tue, fri what ever..
Code: Select all
return {
active = true,
on = 'Xiaomi Wireless switch' -- which switch?
},
execute = function (domotics,switch)
local light = 'Xiaomi RGB Gateway' -- which light?
if (switch.state == 'Click') then
light.toggleSwitch() -- toggle on/off every time
elseif (switch.state == 'Double Click') then
-- do something else
elseif (switch.state == 'Long Click') then
-- and again someting else
end
end -- end execute part
} -- end