Any suggestions how to stop the automation switching off the switch if switch has been turned on manually? My previous incarnation had the sun elevation condition at the start of the automation however this resulted in the switch staying on in the morning if the elevation threshold passed. Any thoughts appreciated.
I should also mention the ‘or’ condition is there as planning to add additional sensors to the automation.
That depends on how the switch might otherwise be turned on (other than manually)
If it is done thru another automation then you could have that other automation also turn on an input_boolean to denote it was turned on by an automation instead of by hand.
then in the above automation use that input boolean being on as a condition to let the automation turn off the light.
but you will also need another automation to turn off the input boolean if the light is turned off manually or thu an automation to set it up for the next time.
Thanks @finity, turns out I was overthinking my use case. For anyone who is interested see below for my final solution. This accounts for the following:
Automation triggers when motion detected by PiR sensor.
If automation triggers and if sun elevation below 6.0 then action option 1 is selected and the switch is turned on for 10 minutes.
If the automation triggers and the sun elevation is not below 6.0 then the default action option is selected and the switch turns off after 10 minutes.
This covers the following use cases:
Light switches on/off when motion detected and it’s dark.