Many thanks @AllHailJ - sorry for the delay in replying.
I have re-done the Automation and the Visual Editor now contains no errors, but I am not sure that I fully understand what I have written - or if it is correct. Have I got it right?
I have highlighted the section that confuses me below with # marks - but the # marks are not there in my automations.yaml file (obviously )
What I want is for the lights to come on for 5 mins every time the PIR is activated, then go off.
No problems with delaying in your response. The forum is not a help desk.
You have identified each trigger. Triggers are executed with OR so this or that. The ID lets the program know which trigger set the automation in motion.
In the actions you pick choose and the condition is the trigger and then you have an action.
Trigger if
TriggerID one or
TriggerID two
Action
Choose
if TriggerID One
Then Do Actions I want with Trigger ID one
Else
if TriggerID Two
Then Do Actions I want with Trigger ID Two
Else
Do a default action
So in your automation you say:
If may PIR goes to on ( to_on ) Run Actions
Choose Action is_on
Turn on the light
End automation
When PIR goes to off (to_off) for 5 minutes Run Actions
Choose Action is_off
Turn off the light
End automation
Also the mode single means only run once and do not queue up multiple runs.
Again - many thanks; I had got it in to my head that the lights needed to come on for 5 minutes after a PIR activation, but AIUI what you have shown is that the lights come on until the PIR has NOT been activated in the previous 5 minutes. A subtle difference, but I now understand.