timeofday[‘Nighttime’] and time.hour < 7
Posted: Tuesday 11 February 2020 9:50
Hi all,
Can someone help me with the logic of this Lua code...
I want the light to come on from night time — but not come on after 7am - as it is already light. (Night time ends at 7:36am)
My logic is wrong though as 23 is higher then 7 so my if statement will fail. I didn’t want to put a set hour in my if statement like this:
Any help would be great.
Many thanks.
Can someone help me with the logic of this Lua code...
Code: Select all
If timeofday[‘Nighttime’] then
If time.hour < 7 then
commandArray[‘light’] = “On”
end
end
My logic is wrong though as 23 is higher then 7 so my if statement will fail. I didn’t want to put a set hour in my if statement like this:
Code: Select all
If time.hour > 18 and time.hour < 7
Many thanks.