How to add a time to a motion activated automation

In the triggers: section, you put the entity_id of your sensor
conditions: indicate when the trigger is to be considered (note: you need the Sun integration installed when using sun functions)

You can find out more about the choose: function in the docs.

conditions: in the choose: function indicates the actions (sequence: section) are to be performed.

The condtion: (note lack of ‘s’) is evaluated and if true, the sequence: is performed. In this case the condition evaluates a template. (Learning templates is a steep learning curve.) This template says, "look at the trigger, specifically, look at the state to which the the trigger switched (to_state), then look at the state of that “attribute” (state). If that evaluates to ‘on’, then the condition is true.

Note that the double quotes must be at the beginning and end. The double braces means to evaluation the equation inside the double braces. The double equals means “is equal to” (as opposed to the single = which means “set the variable to”) and, <-sarcasm font> of course it is intuitive that </sarcasm font> trigger.to_state.state is a string so on must be quoted, but not double quote, because the double quote is used outside the template, so on must be 'on'

Alas, when you create a card in your overview page which shows the state of your motion sensor, what is shown is ‘detected’ or ‘cleared’ not ‘on’ or ‘off’. <-sarcasm font> It is also intuitive that one knows to </sarcasm font> go to *Settings–>Developer Tools–>Template (a tab) and create a template such as {{ states('binary_sensor.floodlight_sensor_garage_motion_detection') }} which will tell you what the YAML will see as opposed to what is presented to you in the overview page.

@comfysofa you are at the bottom of the aforementioned steep learning curve. I am “codey” and HA is not a friendly language to learn. Start here and plow your way through very rocky soil. Not on that page, but which should be for people like you, is a link to 20 things I wished I knew when I started with Home Assistant