Select problem
Posted: Thursday 10 December 2020 22:01
Hello
I am struggling with the following problem. I have an ELRO switch with 4 positions On and Off. With this switch I want to switch on 4 different scenes. I have already tried it in different ways but they don't work or they influence each other. I am probably using the wrong structure. Who can help me on my way.
Peter
-----
I am struggling with the following problem. I have an ELRO switch with 4 positions On and Off. With this switch I want to switch on 4 different scenes. I have already tried it in different ways but they don't work or they influence each other. I am probably using the wrong structure. Who can help me on my way.
Peter
-----
Code: Select all
return {
on = {
devices = {
'Switch1_1',
'Switch1_2',
'Switch1_3',
'Switch1_4'
}
},
logging =
{
level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when script is OK
marker = 'Slkmr_switch',
},
execute = function(dz, device, triggerInfo)
local Automaat = dz.devices('Automaat')
local Slapen = dz.devices('Slapen')
if(Automaat.state=='On') then
if ( device . name == 'Switch1_1' and device .name. state=='On') then
dz.scenes('sc_bedverlichting_100').switchOn()
end
if ( device . name == 'Switch1_2' and device .name. state=='On') then
dz.scenes('sc_bedverlichting_50').switchOn()
end
if ( device . name == 'Switch1_3' and device .name. state=='On') then
dz.scenes('sc_bedverlichting_10').switchOn()
end
if ( device . name == 'Switch1_4' and device .name. state=='On') then
dz.scenes('sc_bedverlichting_tv').switchOn()
end
if ( device . name == 'Switch1_1' and device .name. state=='Off') then
dz.scenes('sc_bedverlichting_uit').switchOn()
end
end
end
}