Simple Script does not function: Am I too stupid?
Posted: Saturday 07 September 2019 22:43
I'm a beginner in dzvents, but I try to learn.
I wrote the following very simple script, that does not function. The second "If" will be ignored, but I don't know why. There are no error messages in log. Any advice is wellcome.
I wrote the following very simple script, that does not function. The second "If" will be ignored, but I don't know why. There are no error messages in log. Any advice is wellcome.
Code: Select all
return {
on = {
devices = {
'TestMaster'
}
},
execute = function(domoticz, TestMaster)
domoticz.log('Programmablauf gestartet')
local TestSlave = domoticz.devices('TestSlave')
domoticz.log('Variable gesetzt. TestMaster-Status:')
domoticz.log(TestMaster.state)
if (TestMaster.state == 'On') then
TestSlave.switchOn()
domoticz.log('Abfrage erfolgt')
else
domoticz.log('else gelesen TestMaster Status:')
domoticz.log(TestMaster.state)
if (TestMaster.state == 'OFF') then
TestSlave.switchOff()
domoticz.log(' 2. Abfrage erfolgt')
end
end
domoticz.log('Durchlauf beendet')
end
}