I have a really simple requirement so I probably can’t see the woods for the trees…
When an input_boolean changes state I need to be notified if a sensor doesn’t also change state after, but within, a very small (almost zero) number of seconds.
I have this which I can’t believe is the best way to achieve it (and to be honest I haven’t tested it anyway so it might not even work!)
I believe this won’t work as the entity’s state won’t change.
You’ll probably need to track the entity’s last_change value in a template sensor for this to work.
I think this should work… but you need to change the conditions you are testing for the “wait_template” and the “condition”… The timestamp now() will always be bigger than your sensor last change so the condition “< 10” will always be met (and therefore trigger) as the number (timestamp last changed - timestamp now) will be negative (always)… For the same reason, the “condition” will never be met as the result is negative again and will never be bigger than 10…
So for me it should be:
Well… It just seemed a bit er, clunky. But clearly at least three people don’t seem to think it is that bad
That was a copy and paste error
And yes, you are all right about the time templates.
I completely misread the docs to say that trigger.now returned the time the automation was triggered. Which would be true if I was using a time to trigger it!!