This might seem rather trivial, and it does only occur occasionally, however it is annoying. I have a motion sensor automation that among other conditions I want the light to not turn on if it has previously been on in the last 15mins.
I don’t seem to be able to create the automation conditions correctly for that.
This:
Will check if the light has been off, but sometimes it has gone unavailable during that time, so it hasn’t been ‘off’ for a total of 15 mins.
This:
condition: not
conditions:
- condition: state
entity_id: light.main_bedroom_light
state: "on"
for:
hours: 0
minutes: 15
seconds: 0
Checks that the light hasn’t been constantly switched on for a full 15 mins. The condition I am looking for would I suppose apply the time to the ‘not’ rather than the ‘on’.
I hope I have explained this properly, thanks for any ideas.
You can use a template sensor to capture the time an event happens (light on, light off) and then use that time in automation conditions or other templates.
Here is an example that captures the time at which a door opened / closed and then uses that timestamp in a calculation to make the door work like a motion sensor (e.g. it stays on for x minutes after the door moves)
You want to do something similar. Perhaps capturing two times - one for the light going off to on and one for the light going off to on, then you can use these in an automation condition.
This would definitely be a good solution, thank you, I can create this and exclude it from the recorder etc.
I was kinda wondering if there was a way to do it within the syntax of the automation conditions, without creating an extra helper/sensor.