Sorry about that. Looking at the code I discovered the timer.restarted
event is only fired if the timer was paused. Now that I look again, the docs say the same thing:
Starting a timer triggers a started event unless the timer is paused, in that case, it triggers a restarted event.
That’s unfortunate, because starting a timer that is running does restart it.
Anyway, maybe you can change the first automation to first pause the timer (which does nothing if it isn’t running.)
- service: timer.pause
data:
entity_id: timer.lightning_timer
- service: timer.start
data:
entity_id: timer.lightning_timer
duration: '00:30:00'
So if the timer isn’t running, the first step does nothing, and the second step should cause a timer.started
event. But if the timer is running, the first step will pause it, causing the second step to restart it as before, but now it will fire a timer.restarted
event.