I had a script running for years without any problem.
Then there was this lan problem and the shelly device didn't react.
I tried to solve it by adapting the script and that made things even worse.
Here's the situation.
I have some old Ikea plugs wich are switched with rfxtfx (433 mHz)
When 'piano aan' is switched I want to switch selly21 device on as well.
When 'piano uit' is switched I want to switch selly21 device off as well.
Here's to script:
Code: Select all
-- switch-another
local pushOn2 = 'Piano aan'
local pushOff2 = 'Piano uit'
local Shelly21 = 'Groene lampjes'
return
{
on =
{
devices =
{
pushOn2,
pushOff2,
Shelly21,
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- change from LOG_DEBUG to domoticz.LOG_ERROR when all OK
marker = 'piano lampjes',
},
execute = function(domoticz, item)
-- domoticz.devices(pushOff2).dump()
domoticz.log('0 pushOn2 : ' ..pushOn2 , domoticz.LOG_DEBUG)
--domoticz.log('1 waarde van item is : ' ..item, domoticz.LOG_DEBUG)
domoticz.log('2 Groene lampjes : ' ..domoticz.devices('Groene lampjes').state, domoticz.LOG_INFO)
domoticz.log('2a Piano aan state : '..domoticz.devices('Piano aan').state,domoticz.LOG_DEBUG)
domoticz.log('2b Piano uit state : '..domoticz.devices('Piano uit').state,domoticz.LOG_DEBUG)
if item.name == 'pushOn2' and item.active then
domoticz.devices(Shelly21).switchOn()
domoticz.log('3 Groene lampjes pushOn2 : ' ..domoticz.devices('Groene lampjes').state, domoticz.LOG_INFO)
end
if item.name == 'pushOff2' and item.active then -- and item.active
domoticz.devices(Shelly21).switchOff()
domoticz.log('4 Groene lampjes pushOff2 : ' ..domoticz.devices('Groene lampjes').state, domoticz.LOG_INFO)
end
end
}
Of course help is appreciated.