percentage in if statement possible?

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

percentage in if statement possible?

Post by sailmich »

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.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: percentage in if statement possible?

Post by emme »

domoticz.devices
The most dangerous phrase in any language is:
"We always done this way"
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: percentage in if statement possible?

Post by sailmich »

:oops: sometimes I believe I'm blind. Thanks a lot for the kick emme!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest