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