How to Set Scene Limits by Time

Hi All, I’m new to luup programming and I’m having some difficulty figuring out how to set scene limits by time. Is this possible? Here’s what I’m trying to achieve:

During the day (8 AM to 6 PM), if the motion sensor is armed and tripped, I want it to trigger the security alarm siren. However, if the motion sensor is not armed and tripped during the day, I want it to do nothing. At night (7 PM to 8 AM), if the motion sensor is not armed and tripped, I want it to turn on the lights.

I’m not sure how to structure the code to handle these time-based conditions. Any help would be greatly appreciated! Also, how can I add comments to the code so I can keep track of what each part does?

Thanks in advance for your guidance!