Having trouble write automation.
I have a timer “somebody home” which goes to idle if no one moved around house for an hour. Than it does some switching
I want it to revere it when someone arrives.
I understand i need automation which will do something when there is movemenet with condition that this timer is idle (or zero).
Trying with timer, states, events but I get automation error. Unfortunately, error description is just “line 25” nothing more so I have trouble debugging.
This doesnt work, it turns on light whenever timer is restarted:
- id: '15691078666'
alias: TIMER / Motion when home
trigger:
- platform: state
entity_id: timer.neko_je_kuci
from: 'idle'
to: 'active'
condition: []
action:
- data:
entity_id: light.hall_a
service: light.turn_on
That timer is triggered by every motion sensor so when it runs out 60 minutes it goes idle and i trigger most lights off and covers down.
It stays idle until some PIR triggers it.
I understand i need to have condition something like WHEN specific motion sensor is triggered WHILE timer is idle…
It’s still not really clear what the problem is, or if there’s even a problem and you just want another automation. Let me see if I can clarify…
You say it doesn’t work, but then say it turns on the light. Do you not want the light to go on? Or do you only want the light to go on when the timer is first started after being idle? If the latter, how are you restarting the timer? It should only go from idle to active if it is started while idle. If it’s restarted while active, it will not go from active to idle and back to active. Maybe the problem is in the way you’re restarting the timer???
That is an issue, even in newest version you need to cancel timer and start again, so frontend will update and truly restart.
That bug is present from 0.88 and still going…
But yes, need to start in only when going from idle to active, gone to zero and start again.
Not on restarts, until it has not reached zero/idle yet.
The “bug” has nothing to do with the backend. It is purely in the frontend when displaying a restarted timer. The timer is functioning properly. I.e., you do not need to cancel a timer first to properly restart it. You’re making it harder on yourself by doing that. Just start/restart the timer using only the timer.start service. Then your automation will work as you want.
Ok, will give it a try, will ignore what fronted is telling me, even better remove it from Lovelace so it doesnt scare me… bad thing happen when it runs out, media, covers, lights… ald go off
If you want to know if it’s active or idle, you could create a template binary sensor that is on when the timer is active and off otherwise. Then you’d have an indication (which you could show in the frontend) of the state of the timer without seeing an unreliable estimate of its remaining time.