Only one sensor activate the script
Posted: Tuesday 15 November 2016 7:19
I have a script with two motion sensors to turn on the lights. But only one motion sensor (MotionSensor) will actually triggers the script. The "MotionSensor voor" does nothing in this script.
Maybe someone can explain?
Maybe someone can explain?
Code: Select all
lux = tonumber(otherdevices_svalues['Lichtsensor voor'])
date = os.date("*t")
commandArray = {}
if ((date.hour >= 7 and date.hour <= 23) and
(devicechanged['MotionSensor'] == 'On' or
devicechanged['MotionSensor voor'] == 'On')) and
(otherdevices['Control-Lights'] == 'Off' and
lux <= 5) then
commandArray['Group:Schakel-alle-lampen'] = 'On'
elseif (lux >= 14 and
otherdevices['Control-Lights'] == 'On' and
date.hour >= 7 and date.hour <= 23) then
commandArray['Group:Schakel-alle-lampen'] = 'Off'
end
return commandArray