percentage in if statement possible?
Posted: Thursday 04 October 2018 15:35
Latest Beta
RPI2
ZStick
I have a script in Lua it's running during daytime. I would like to change it to dzVents but can't get it running. If my blind is bigger than 10 and the light outside is lower than 500 Lux then the blind should open. If the blind is smaller than 10 nothing should happen. Blind is a in wall switch for blinds from Fibaro.
if tonumber(otherdevices_svalues['Kitchen_left']) >= 10 then is running in Lua.
I tried if domoticz.device('Kitchen_left').level >= 10 then not running in dzVents.
An error occured when calling event handler dztest
dzVents: Error (2.4.7): ...pi/domoticz/scripts/dzVents/generated_scripts/dztest.lua:9: attempt to call field 'device' (a nil value)
if tonumber(devKitchen_left.rawData) > 10 then
An error occured when calling event handler dztest
...pi/domoticz/scripts/dzVents/generated_scripts/dztest.lua:9: attempt to index global 'devKitchen_left' (a nil value)
if tonumber(otherdevices_svalues('Kitchen_left')) >= 10 then
An error occured when calling event handler dztest
dzVents: Error (2.4.7): ...pi/domoticz/scripts/dzVents/generated_scripts/dztest.lua:9: attempt to call global 'otherdevices_svalues' (a nil value)
How do I have to change the working code from Lua into dzVents or isn't is possible? I tried also a lot of other code wich I have found in threads without succeed. I might made mistakes with syntax.
RPI2
ZStick
I have a script in Lua it's running during daytime. I would like to change it to dzVents but can't get it running. If my blind is bigger than 10 and the light outside is lower than 500 Lux then the blind should open. If the blind is smaller than 10 nothing should happen. Blind is a in wall switch for blinds from Fibaro.
if tonumber(otherdevices_svalues['Kitchen_left']) >= 10 then is running in Lua.
I tried if domoticz.device('Kitchen_left').level >= 10 then not running in dzVents.
An error occured when calling event handler dztest
dzVents: Error (2.4.7): ...pi/domoticz/scripts/dzVents/generated_scripts/dztest.lua:9: attempt to call field 'device' (a nil value)
if tonumber(devKitchen_left.rawData) > 10 then
An error occured when calling event handler dztest
...pi/domoticz/scripts/dzVents/generated_scripts/dztest.lua:9: attempt to index global 'devKitchen_left' (a nil value)
if tonumber(otherdevices_svalues('Kitchen_left')) >= 10 then
An error occured when calling event handler dztest
dzVents: Error (2.4.7): ...pi/domoticz/scripts/dzVents/generated_scripts/dztest.lua:9: attempt to call global 'otherdevices_svalues' (a nil value)
How do I have to change the working code from Lua into dzVents or isn't is possible? I tried also a lot of other code wich I have found in threads without succeed. I might made mistakes with syntax.