Vera - Smarter Home Control Forum

Advanced => Programming => Scene Scripting => Topic started by: stardobas on April 21, 2018, 09:12:11 am

Title: NEED HELP for two conditions
Post by: stardobas on April 21, 2018, 09:12:11 am
I need light auto turning on when sensor decet movement and tunrning off after 1 minutes (normal scene)...
BUT if lux in the room are high or IF light are just ON don't run scene... (otherwise Vera will turn of the light that I've just turn on manually....)
For LUX it works...but not work when i add the switch status...

my script:

local LightSensorID = 40
local MaxBrightness = 50
local LightSwitchID = 33

local LightSwitch =  luup.variable_get("urn:micasaverde-com:serviceId:SwitchPower1","Status",LightSwitchID)

local Brightness = luup.variable_get("urn:micasaverde-com:serviceId:LightSensor1","CurrentLevel",LightSensorID)

if (tonumber(Brightness)> MaxBrightness) and (tonumber(LightSwitch)== 1) then
 return false
 else
 return true
 end


Why this don't work???
Title: Re: NEED HELP for two conditions
Post by: stardobas on April 21, 2018, 11:12:09 am
sorry for bad visualization, I rewrite it... some helps?