Author Topic: NEED HELP for two conditions  (Read 1040 times)

Offline stardobas

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
NEED HELP for two conditions
« 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???
« Last Edit: April 21, 2018, 10:51:48 am by stardobas »

Offline stardobas

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: NEED HELP for two conditions
« Reply #1 on: April 21, 2018, 11:12:09 am »
sorry for bad visualization, I rewrite it... some helps?