I have created a virtual Selector switch with 4 options:
0-Off
10-Slovakia
20-Lumen
30-Jemne
I want to control the Selector switch (playing internet radio) with a physical button (change between Radio stations). How should the code looks like?
I spend several hours on it, trying to read the manual, but nothing works.
The code looks like this:
Code: Select all
return {
on = {
devices = {
29, -- idx HW Switch
79, -- idx of Selector switch
}
},
execute = function(dz, item )
if item.state == "Click" then
if domoticz.device(79).switchSelector(10) then -- checking if Selector switch is 10=Slovensko ?
dz.devices(79).switchSelector(20) -- set the selector switch to 20=Lumen
elseif item.state == "Double Click" then
dz.devices(79).toggleSwitch() -- Radio
elseif item.state == "Long Click" then
dz.devices(79).switchOff() -- Radia
end
-- dz.log('Device ' .. device.name .. ' was changed', dz.LOG_INFO)
end
}