Use Timers to build Reliable Automations in Home Assistant

  Рет қаралды 85,467

SlackerLabs

SlackerLabs

Күн бұрын

Пікірлер: 143
@Grovion
@Grovion 2 жыл бұрын
This is not functionally replacing the for function. The for function triggers, when something holds a specific state for some time (i.e. 20 minutes). This on the other hand triggers 20 minutes after the thing changed to the new state even if it does not hold the new state for 20 minutes. If that is fine for your use case - great. But it's not equivalent. Also It's not that easy to fix. You could check for the new state after the timer finished again but that would not tell you if the thing holder the state for the whole 20 minutes but instead it now tells you if the device was in the state 20 minutes ago and now. You don't know what's been between those two points in time. Again: if that's sufficient for your use case that's great but it's not the same as the for attribute does.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
That’s a good point. Depending on your automation you would need to include a trigger to stop the timer as well.
@digitaldias
@digitaldias Жыл бұрын
@@SlackerLabs As long as the timer restarts on movement, it will be functionally no different to a "for"
@archiemarper
@archiemarper Жыл бұрын
Just to ensure I understand this as I think I incorrectly applied this to my situation. So when my motion sensor clears "for" 3 mins, the action I have associated with the switch turning off, will shut off at the 3 min interval. However, this needs to hold that "no motion" state for 3 mins before the switch turn off action is executed. Is that correct ?
@blakeseufert7340
@blakeseufert7340 Жыл бұрын
What about if other sensors or switches also control the light?
@LDavis-ll5yr
@LDavis-ll5yr Жыл бұрын
@@SlackerLabs On the timer page it seems to indicate that if you start a timer that is already running, the timer is started over. Might be useful for time-out automations.
@Rich33527
@Rich33527 2 жыл бұрын
Started using timers in place of wait conditions for a couple months now. Its made my lighting automations much more reliable. Good Vid.
@garethwatson874
@garethwatson874 Жыл бұрын
A very good tutorial. There are many people on KZbin offering advice on HA but not many of them explaining things as clearly as this.
@jamessaunders6439
@jamessaunders6439 2 ай бұрын
I watched this three times to get it so sink in, but it has now completely changed how I do things. Just awesome, thank you
@TheMoonSeesMe
@TheMoonSeesMe 2 жыл бұрын
Oh man I've had many problems with reliability that can be fixed with timers. The main one, is a you said, with turning things off after a certain about of time - my main one being the heated towel rail turning off after being on for 3 hours. Huge thanks for putting this out!
@Aurleis
@Aurleis 2 жыл бұрын
Thank you sooo much! One of my switches is at the farthest point from my server closet and is always losing communication, and that light never turns off. I really appreciate the solid work you do on your videos and think that you should have far more subscribers.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Thanks! I'm trying to get back in the routine of making more regular videos.
@DanGentry
@DanGentry Жыл бұрын
Not sure how I missed this video until this weekend. I have integrated timers into my room lighting automations with great success.
@nickrusso86
@nickrusso86 2 жыл бұрын
Thank you for this suggestion. I think it will help my home automations tremendously. One small suggestion is that during certain parts of the video, you click and scroll so fast, that it's difficult to tell what options you are selecting. I'm having to pause and rewind multiple times to try to determine what you are doing. A slight pause between pointing and clicking would be appreciated.
@RjMacProductions
@RjMacProductions Ай бұрын
Great video! I put the timer(s) to my dashboard(s) as well, so I could see exactly how much time was left on each timer. I also added a third Trigger ID and "timer.canceled" action and that will cancel the timer if I turn off the device manually (the lights in one case) before the end of the timer, since the timer is still counting down, even if the device gets turned off. Thanks for your help!
@roymorrison1075
@roymorrison1075 2 жыл бұрын
Great video. Only thing I would add to that is, I add the timer to the dash board, so you can see the timer counting down, so at a glance you can see how long it has to go. I have used this for my watering system, so 8 zones. The other bonus of adding it to the dash board, its easy to open it up, change your time value, for your example if you wanted to go to 25min, rather than trying to find it in helpers, if its next to your swith in the dash board, so just a quick open and change the value.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
I almost included the lovelace part. In fact had it scripted out, and ended up leaving it off. Since Home Assistant is making the for attribute in the trigger actually better in the next release (by changing when automations are reloaded) I think it might be good to do a video on some better use cases for timers.
@PaulSmith-zs5je
@PaulSmith-zs5je 7 ай бұрын
Great video. I used this concept to add 2 timers for a garage water pump. I only want the pump to run for 2 minutes when water detected and a second timer that runs for 30mins which doesn't allow the pump to start if it has finished in the past 30 minutes. Loving what I can do with Home Assistant.
@richardharnwell3331
@richardharnwell3331 2 жыл бұрын
As a massive Karate Kid fan, the wax_on and wax_off trigger id names made me very happy.
@uSlackr
@uSlackr Жыл бұрын
I just implemented an automation for my office lights that I used "For" in. Changing it now!
@mincka3947
@mincka3947 2 жыл бұрын
Thank you for this new video. My previous automation to turn off the lights was based on an ugly time pattern trigger to check if multiple sensors were all off for at least one minute. The usage of the timer is so much cleaner in this case. I just start the timer again each time one of the sensors is activated to keep the light on. Really easy to change the duration and see the current time before the timer end.
@NSHarrison
@NSHarrison 2 жыл бұрын
I also like to use the timer helper as a variable for the timer.start piece. It means you don't have to edit the automations if you decided you want to change the timer duration at any point. For example this snippet of code can be used to achieve this. service: timer.start data: duration: | 00:{{ states('input_number.wardrobe_timer_duration') | int }}:00 target: entity_id: timer.wardrobe_occupancy Besides creating an input_number helper you can also add the input_number to the UI for easy editing. Cheers
@This-nerd-house
@This-nerd-house 2 жыл бұрын
This is a great idea! I’ve used a timer helper for drip irrigation but that’s all I’ve ever used it for. You make a great point about it retaining after restarts, I’m known to randomly restart my server so this would be a great addition!
@Dorff_Meister
@Dorff_Meister 2 жыл бұрын
For my stair lights, I use Time of Flight sensors on ESPHome devices to trigger them to turn on. They use a timer that then assists with turning off the stair lights. Handy stuff.
@d_sellers1
@d_sellers1 Жыл бұрын
For years, I've used Node-RED as my automation platform. I started using it before there was an automation UI in HA and just never ventured into it because my automations in NR worked just fine. Recently, I wanted to move some of the automations from NR to HA in order to incorporate some extra details into my dashboard. Right off the bat, I struggled to get some sort of script-like capability from the automation. Four things could happen which each would need to be handled differently: light turns on, light turns off, motion detected (with IF light is on or off), and timer expired. The trigger_id was the key to getting everything to mesh properly (along with Choose which I was already trying to utilized.) Thanks for the video that set me on the right path.
@TechTonor
@TechTonor 6 ай бұрын
Can I ask if you made any other progress with this? I'm in the same situation now, and I've found the trigger_id and "choos" logic, which I didn't normally use, as that was handled in Node-RED. Do you have any other tips, I'd find useful in the migration (talking about Node-RED > HA Automations).
@d_sellers1
@d_sellers1 6 ай бұрын
​@@TechTonor I've actually moved a lot of my automations from NR to HA over the past few months. For example, the auto kitchen lights automation consists 8 triggers (light on, light off, motion detected, motion cleared, timer finished, automation (helper) enabled, automation (helper) disabled, and timer almost finished.) In the actions, there is a single Choose which has options set for each trigger_id. Each trigger lets me do something specific. So, if the light is turned on, then the timer entity is started. If motion is detected, the light is turned on (which subsequently triggers the light turned on trigger thus starting the timer.) If the light is turned off, the timer is canceled. And, so on. Basically, using Choose allows you to control the flow of the automation similar to the wires in NR. But it also really allows you to "group" the automation together. One automation contains everything that should deal with those lights. I have another for the bathroom, my second bedroom, and the hallway closet. Ironically, I was just thinking about adding this automation method/practice/style to my Github when I saw your message notification. I'll try to get it added today but no promises. You can find me on GH with the same username but without the underscore. I'm also in the HA Discord usually in #frontend.
@TechTonor
@TechTonor 6 ай бұрын
@@d_sellers1 I'll give it a look. I already spotted Choose, which are great! It makes so much more sense. I don't get that I've not noticed that, until the time of my first comment. Thank you for the answer, btw. Have you found other golden things in the automation setup process, while you migrated your things from NR?
@dudefromkeene
@dudefromkeene Жыл бұрын
Thanks for this, I used the timer helper along with a count helper to override a thermostat auto shut off when the windows are open by turning it on 3 times within 5 min, in which event the the automation is turned off and your are free to use the thermostat as usual.
@TheHoffVlogs
@TheHoffVlogs 2 жыл бұрын
Great walk through! I don't know if it was necessary or not but I also added triggers and logic for if I turn the device off early the timer would be canceled.
@BeardedTinker
@BeardedTinker 2 жыл бұрын
I'm always saying that timers are wrongly ignored in HA. Great video!!!
@EdgardMello
@EdgardMello Жыл бұрын
Congratulations on making such a great video! It was very informative and helpful. Thank you for sharing your knowledge with us.👏
@schrodingersmechanic7622
@schrodingersmechanic7622 Жыл бұрын
For my light automations I tie them in with door sensors. If motion is detected and the relevant door is closed the room is obviously occupied. For motion only activation I set the delay to 2.5 times the reset time of the sensor. These two techniques work extremely well for me.
@danielorodriguez1689
@danielorodriguez1689 2 жыл бұрын
This idea crossed my mind several times, but all those times I discarded it b edc ause it suffers from the main problem home assistant has: everything is 5 miles away of each other thing, there is no easy way to have an overview and rather than having the automation information in your automation system you have to keep it in your head. Some degree of decoupling is good, but this is ridiculous and inconvenient
@Sparky_D
@Sparky_D 2 жыл бұрын
Can you please explain your nonsensical comment?
@Tekwyzard
@Tekwyzard 2 жыл бұрын
@@Sparky_D It's not nonsensical at all. Because of that very issue I often have multiple tabs open to different facets of HA, like Developer, states; the automation being edited, the script being edited, the template I'm stressing at, etc. Just last night in fact, I had five HA tabs open to one instance of HA just to try and convince a mediaplayer automation to play nicely, so yeah, it was lots of clicking around as it was, and would have been absolute hell without all those five tabs going at once.
@Sparky_D
@Sparky_D 2 жыл бұрын
@@Tekwyzard My comment was in relation to the topic that Danielo had raised, just the fact that it is barely readable.
@MrSupersidewinder
@MrSupersidewinder 2 жыл бұрын
Very helpful, Thanks... I had some off events fail after simply editing an automation the other day... This will help, especially for critical items...😁
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Yeah, until recently I was only really tinkering late at night when there isn't many automations running. Now I find myself constantly modifying automations and it was getting a bit annoying when things didnt turn off. haha.
@kakaoen4
@kakaoen4 Жыл бұрын
This helped me solve a huge thing in my home, i have a water leak sensor in the shower and i wanted it to start a timer when it gets wet and not reset the timer each time water was detected and i could not for the life of me figure out how to put up an automation that would work aswell as being reliable.
@dnoha1
@dnoha1 2 жыл бұрын
I like timer to be run in IoT device localy. Tasmota have "PulseTime" timer which will turn light off after some time by it self. My task is only to turn it on via HA, hardware switch or any other way. If another turn on impulse comes to this IoT device, then tasmota starts countdown again from start. So, for light timer usecase there is no wories if HA, wifi, or something else goes wrong, device will turn off, after designed time. I believe that ESPHome can achieve similar. Not sure about Zigbee devices. They probably thus not have inbuild countdown?
@mkkm945
@mkkm945 Жыл бұрын
Brilliant. I automated my wife's closet door (door open = light on, closed = light off) but she leaves it open too often, so I just added a 5 minute timer as protection against forgetfulness. Sweet!
@joudatfd
@joudatfd 2 жыл бұрын
Hi, great video. I'm using nodered for automations and the problem is the same with trigger nodes. I have automation for water pump to run for 10 minutes. i managed to restart nodered several times, while it was pumping, resulting in empty 5m3 water retention tank. I just migrated some of my flows to timers and it works nicely. It would be great, if there was node for timers, so i don't need to listen to events and then filter out timer entity_id
@StjepanPuljko
@StjepanPuljko 2 жыл бұрын
I have 2 triggers in my automation, one which triggers when motion is detected, which waits for sensor to be off for x minutes. Other one checks if there isn't motion for x minutes, and then turn lighst off. That way light will be turned off after x minutes even if server restarts. Not as precise as with timers but enough for me, an easier to setup.
@jsjiang6120
@jsjiang6120 10 ай бұрын
There's a flaw in timer. In "Timer" document of HA, it clearly points out that "However, automations using the timer.finished event will not trigger if the timer expires when Home Assistant is not running." I guess that's because HA use time stamp, and when the time stamp occurs when HA is rebooting, the event is not triggered.
@SlackerLabs
@SlackerLabs 10 ай бұрын
Yea. That feature doesn’t appear to be working.
@clairerovic
@clairerovic 2 жыл бұрын
I find that often with timers I like to have a UI component so it can be dynamically change the delay/timer. As we all know life requirements are always in a state of flux. It does appear that you cannot easily change the timer duration and it show up in the Helper UI - Yes you can change the duration when starting the timer, though this gets lost in a restart. All Fun - Enjoy
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Yeah. I need to do some more testing to see how hard to push a timer. It would be nice to be able to create them on the fly like you can with scenes or have multiple instances. Having to define each one for each use case before hand seems like its not going to scale well if you want your lights to all have different times outs. Or like me, have different time periods based on whether its day or night.
@discodogge
@discodogge 2 жыл бұрын
You can use a input_number to define how long the timer should be. And by setting that first before starting the timer you would get a dynamic timer :) and u can customize it from the UI
@LDavis-ll5yr
@LDavis-ll5yr Жыл бұрын
On HA's timer page, it has the following note: Timers will be restored to their correct state and time on Home Assistant startup and restarts when configured with the restore option. However, automations using the timer.finished event will not trigger if the timer expires when Home Assistant is not running. The second sentence caught my attention. Does this suggest that if your timer "would have finished" at the time HA is being restarted (i.e. not running) that any associated actions will never be called?
@SlackerLabs
@SlackerLabs Жыл бұрын
Yes. Previously it was stated that it would work even if it finished during a reset. But then a big was found. Looks like they decided to just make a note and not “fix” it
@guylast9516
@guylast9516 11 ай бұрын
Thanks for the Video. Someone mentioned in the comments the timer.finished does not work as trigger for action and the same was my experience. I had to use Entity > state > from Active to Idle as my trigger. Also for Action I had to use Device > switch device off and well it worked. The setup of timer and starting timer etc all being the same. I am on 2024.1.0
@SlackerLabs
@SlackerLabs 11 ай бұрын
Were you using the platform event with the timer.finsihed? It works fine in my current automations. Your method will work to. But just be aware if you cancel the timer the state will also go from active to idle so your automation will trigger. Shouldn't be an issue unless it's a timer you expect there to be a reason to cancel at some point and you only what your automation to trigger when the timer actually reaches zero. The state just tells you if the timer is running or not. It doesn't indicate why the timer is no longer active. If that context is important you will have to use the event messages.
@guylast9516
@guylast9516 11 ай бұрын
@@SlackerLabs Basically I followed you in the video and it did not work. I noticed the timer started on turning the the 'switch on' but after count went to idle nothing happened. Guess I can no longer find the right Event trigger. The video is old so things might have changed. I only recently got into HA. Oh interesting, I see what you mean about the active to idle. So here is a question. which option would you choose in the trigger section if you are setting it up today? I am in the process of figuring out the humidity levels in the bathroom and getting my exhaust fan to turn on when it goes up but struggling with weird humidity readings. In the meant time its turned on manually and left on after showers for a while to ensure mold doesn't grow and sometimes on for hours. This is what I did for now. No presence > Light turn off + start 20 timer. Light turned on > timer cancel Timer idle/finished + Fan still on > Turn off fan
@SlackerLabs
@SlackerLabs 11 ай бұрын
@guylast9516 I don't think anything has changed. All of my timer based automations using timers are still working. Most of mine follow a similar pattern as you have. Typically motion sensor trigger light to come on and an action to start a timer. Then a trigger for the event platform with the name of the timer entity. Like the automations at www.home-assistant.io/integrations/timer/#control-a-timer-from-the-frontend
@guylast9516
@guylast9516 11 ай бұрын
@@SlackerLabs Ok I deleted my comment as it was getting long. So with my testing I found that the issue is the Timer finish trigger in the ADD TRIGGER section. It does not trigger. I had to change it to Entity> state then pick the timer and call service to action So basically this works: platform: state entity_id: - timer.test_timer from: active to: idle id: State timer choose: - conditions: - condition: trigger id: - State timer sequence: - service: switch.turn_on data: {} target: entity_id: switch.living_2_light_right enabled: true This does not: platform: event event_type: Test timer finished id: Test Finished event_data: entity_id: timer.test_timer choose: - conditions: - condition: trigger id: - Test Finished sequence: - service: switch.turn_on data: {} target: entity_id: switch.living_2_light_right enabled: true
@SlackerLabs
@SlackerLabs 11 ай бұрын
@guylast9516 updating this comment since I misread something. But here is a link to mine that works. github.com/thejeffreystone/homeassistant-config/blob/0b4fc89e94c2fbac71156e8bb6a90809a5e877ab/config/automations.yaml#L590
@LDavis-ll5yr
@LDavis-ll5yr Жыл бұрын
Maybe HA could add a "persistent" tick box to the FOR option and it will allow the FOR timer to persist across a restart, making all this relative automation complexity moot. However this is a great review of how a timer might be used.
@xbmcnut
@xbmcnut 2 жыл бұрын
Brilliant video, thank you. Needed to add a trigger to to detect my entity was off and the timer was still active with an action that cancels the timer just in case it got turned off before the timer finished. Other than that, your idea allowed me to clean up a lot of code.
@RNMSC
@RNMSC Жыл бұрын
So, my first 'timer' automation was to automate a wax warmer in the living room. For turning it off after it's been on a while. I am going to have to look into timers for at least one more automation. I do 3d printing for my own purposes. and while a 3d printer that is not printing, is not drawing a significant amount of power, it is drawing some, and every Watt hour costs money, so looking to reduce that. I've already got automations that trigger events when a print job completes, as well as when the bed is (or should be) cool enough to release the print that just completed. At the moment a third tree of that automation turns off power to the printer once it's been idle for some period after that. One of the things that I was missing was the event id: option. I know you had a video regarding it earlier, but at the time much more of your videos were Yaml based, and I wasn't ready for that. So having an explanation of using that for Choose events works. I'm going to have use the a timer from when the bed is cool enough to release for 20 min to power down, and figure out how to stop and clear (reset?) the timer if I kick off another print job in that time.
@RNMSC
@RNMSC Жыл бұрын
Part of me would like to be able to have a pool of timers available (perhaps dynamically created, yet persistent across reloads) that an automation could use in place of the 'for ...' or 'Delay' functions, that a programmer can assign an event id, and a timer duration in the automation, so one wouldn't have to have nearly as many helpers to keep track of. In the next few weeks, I expect to have 2 more printers on line, maybe 3?, and I can see having even more. I'd kind of like the ability to create automations for each of them that do as described above, and being able to template and only change the trigger entity names to reflect each printer, and what plug they are attached to, would be nice. Oh well. (I suppose I could dump, duplicate, and modify the yaml... :-) )
@chrisrnz
@chrisrnz 2 жыл бұрын
I love HA but I think this UI implementation highlights one of the reasons users (new and old) struggle with this sort of thing. Yeah you can give the timer a name and a duration but nowhere in that dialog box is there a single piece of information that explains what those are, let alone what "Restore" means. Yes there is documentation for many things but many users don't ever refer to the docs. Not a good thing but still a fact. The HA UX and UI team needs to do more to show time-of-use help and pointers. In this case a mouseover tooltip would be simple to implement and save a lot of confusion.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
I like that. I wonder if anyone put that in the WTH list.
@chrisrnz
@chrisrnz 2 жыл бұрын
@@SlackerLabs What is the WTH list?
@SlackerLabs
@SlackerLabs 2 жыл бұрын
October is the month of What The Heck so over on the HA forum lots of people are tossing out WTH suggestions for fixes and improvements. And the community votes on it. And then the dev team tries to knock them out. Some will be in the 2022.11 release.
@christophersathen9341
@christophersathen9341 2 жыл бұрын
Nice. Is there a way to edit Helpers in Yaml? Would love to be able to do a "random" time interval like // minutes: {{ range(15, 90) | random }}. And also agree with Daniel R that it makes it quite complicated to make an automation when you have to jump between layout pages and keep track of separate settings that are actually joined in a single automation. Maybee something to wish for in future user interface upgrades.
@daveforrester61
@daveforrester61 Жыл бұрын
While not a random setting for a helper, I have some automations that send me actionable notifications asking what value I want a particular helper value set to. Handy for changing things on a regular basis. You could probably create an automation that sets the timer helper value to a random time whenever it is triggered.
@nnnextra
@nnnextra Жыл бұрын
@@daveforrester61 How do you do this exactly with your automations?
@orrd
@orrd Жыл бұрын
So, I'm not the only one who was distracted by thinking of that Karate Kid scene every time he says "wax on" or "wax off", right?
@dmiller9786
@dmiller9786 Жыл бұрын
Slightly cleaner for the "on" logic is to check if the timer is idle. If not cancel it. Not sure what timer.start produces if the timer is already running. A manual off could also cancel the timer.
@SlackerLabs
@SlackerLabs Жыл бұрын
If the timer is started and it’s running it restarts the countdown.
@74357175
@74357175 2 жыл бұрын
Whoa, I didn't realize automation state was not persistent! Is it possible to set an alarm (rather than a count down timer)? Something with the semantics of "anacron", to make sure power outages don't skip over alarms by accident
@SlackerLabs
@SlackerLabs 2 жыл бұрын
You could use time as a trigger, but I am not sure on an alarm option, but you could set a an interval. Like trigger an automation if it hasn't triggered in the last 24 hours. And then it could be your backup trigger.
@KimmoJaskari
@KimmoJaskari 2 ай бұрын
HA does make things painful sometimes. Setting a normal delay after an action should be tracked between restarts. That way all you'd need to do is trigger on something, put a 5 minute delay, and then shut whatever it is off even if HA had been down between start and stop. Near as I can figure, if I want to set a timer to stop something I'll need two automation. One to turn unit X on at, say, 7 am, and then a version of this one that triggers on it turning on and starts counting down to shut it back off. Oh, and HA seems to still be in rapid change mode, a number of these things aren't named the same just a year ago. Service isn't a name in there anymore (though the functionality is the same).
@TheDiverJim
@TheDiverJim 2 жыл бұрын
I think this will really improve and allow more complexity with my shower light automation.
@SBinVancouver
@SBinVancouver 2 жыл бұрын
My application for timers is to be able to differentiate between an external motion detection (ostensibly a package delivery) triggered by a camera, and our being detected when fetching that package after a door sensor is trigger. So the logic is: "there's motion sensed on the front camera. But was the door opened in the last minute? If not, notify so we know a package has been delivered" Not earthshatteringly complicated.
@Einstine1984
@Einstine1984 2 жыл бұрын
Listening for the `timer.finished` event is *not* the only way to know when the timer is finished. The timer has a state. The state changes from `active` to `idle`. I'd argue that if you want to type less, you'd rather use the state change as your trigger.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
As long as you wanted your automation to fire every time a timer was stopped or canceled as well as actually reached the end of the set time then yes that would work. But if you want to trigger when the timer actually finishes the countdown then you will need to listen for the event. But the state change from active to idle could be because of more reasons than the timer reached zero.
@wouterdr
@wouterdr 2 жыл бұрын
Thank you for the really good tip! This also makes debugging these a lot easier as I can see the state and countdown of the timer. Takes the hastle out of waiting a few minutes and by then forgetting when I should be paying attention. Do you also have the problem that changes to the timer are not saved when changing them through the UI? Keep these kind of tips and insights coming please!
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Yea. Changing the timer in the UI only changes that one time I think.
@JGNiDK
@JGNiDK 2 жыл бұрын
All the way from Denmark: THANKS!!
@udaymshankar
@udaymshankar Жыл бұрын
Hi.. What is the advantage of using the Timer Helper instead of the Timer Action inside the automation? As in - In the automation Actions, add an action to start the device and then another action to wait for 5 mins and then another action to stop the device?
@dronenb
@dronenb 2 жыл бұрын
Good info, as always.
@SnowyPe
@SnowyPe Жыл бұрын
Ive changed all my motion activated lights to using timers to switch off after x minutes.. Its made a huge difference to my patience. Now the lights stay on in the specific room while motion is being detected. The lights only switch off after x minutes one I have left the room.
@archiemarper
@archiemarper Жыл бұрын
Good tutorial and this really demonstrate the power of Helpers and fixes the problem you point out with using the "for" option in the automation. I always wondered why one of my lights would stay on after the conditional end time and this explains that. So using this "Helper" timer will allow the light switch to toggle off at the end of the timer, vs remain on because the conditional end happens first. Hope I explained that correct. One question I do have. In your example was there an action to turn on the "studio air freshner" ? I have an automation which is based on motion being detected from "off to on" and the action is to switch on the light. I've already been using trigger Id's, with choose. So do I have 3 choose options ? 1) Switch turn on; 1) timer turn on and 1) for switch turn off ? Thank you again for your Layman's terms explaination!
@Trial_Master
@Trial_Master 6 ай бұрын
I have a script that I trigger from a dashboard and I would like to replace the 30min delay with a timer. I have replicated the script as an automation but am stuck at how to trigger on. Any assistance appreciated.
@jbooch
@jbooch Жыл бұрын
Hello, I need some guidance. I created a Timer Helper to trigger my garage lights to turn off when they were triggered via someone arriving home after hours. The Automation turns the lights on and starts the time, but, the timer end never triggers. It looks like the timer.finished never gets fired by the timer. Could this be caused by the way I set it up?
@igiannakas
@igiannakas 2 жыл бұрын
Funnily enough that has been fixed in the latest beta of HA. In the next release reloading automations will only reset the ones they have been modified. The value of this still remains though with regards to reboots etc.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Second time a video of mine has been made somewhat pointless with the next update. haha
@SebastianAde
@SebastianAde 2 жыл бұрын
Thank you! As always very helpful 🙂
@markheatherington8367
@markheatherington8367 Жыл бұрын
Thanks for the information! I'm just about to get HA up and running on a NUC and this is timely information. I like the timer idea, but I'm very attention deficit and always take longer to do something than I estimate. Wonder if there is a way to configure HA so that at the end of the timer it will perhaps send a popup via phone and ask for you to confirm turnoff?
@SlackerLabs
@SlackerLabs Жыл бұрын
Yeah, you could totally do that using the actionable notifications. I haven't set that up so I can give you all the things you need, but I know that is possible.
@ElCidPhysics90
@ElCidPhysics90 10 ай бұрын
Are timers single instance objects behaving like a singleton in programming? Or can you have multiple instances of a timer running at the same time?
@SlackerLabs
@SlackerLabs 10 ай бұрын
They are single instances. If you start it again it will just start over.
@ElCidPhysics90
@ElCidPhysics90 10 ай бұрын
@@SlackerLabs thank you so much.
@EmilePolka
@EmilePolka 2 жыл бұрын
For functions tends to be useless for me, all the waiting is done on actions for me as that thing had delay and wait till states actions,and also that if-then actions is so good its as if im using node red here.
@MatthewN8OHU
@MatthewN8OHU 2 жыл бұрын
Regarding the timer expiring during restart; according to Smart Home Junkie, who did a similar video on using timers, this is actually bugged and does NOT work. He has not figured out what exactly is going wrong, though.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Yea. It appears the event never fires. Doesn’t appear to be a known issue though. At least no open issues. So we need to see about getting one submitted.
@tld8102
@tld8102 Жыл бұрын
is there a sunrise and sunset time condition in home assistant?
@SlackerLabs
@SlackerLabs Жыл бұрын
Yes there is. There is actually a couple of ways to use the sun position as conditions. I usually use the state platform with entity sun.sun and check if the value is either above_horizon or below_horizon. But there is sun platform that can be used that allows you to choose before or after either sunrise or sunset.
@jasonstation
@jasonstation Жыл бұрын
Is it possible to launch an Alexa routine through Home Assistant? I've tried allsorts. If not - why not lol.
@SlackerLabs
@SlackerLabs Жыл бұрын
Yea there is. You need the Alex Amelia player integration from HACS then you can issue commands as if you spoke them as well as kick off routines.
@yeyomuri
@yeyomuri 7 ай бұрын
If you have probles with timer.finished, just uncheck restore on timer configuration
@poolace
@poolace 10 ай бұрын
what wax warmer do you use and how do you have it connected (smart plug, etc)?
@SlackerLabs
@SlackerLabs 10 ай бұрын
I have used quite a few. But they are all connected to a smart plug. Thirdreality Smart plugs, innr Plugs, or minoston zwave. Usually what I had on hand.
@vpsrj
@vpsrj 2 жыл бұрын
That’s an another great usage of timers but it’s a shame that HA team doesn’t incorporate it inside the automation creating a new persistent timer using the for time of triggers.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Well with the new release most of the issue goes away. Automations won’t all reload if you change just one. Only the automation you change will reload.
@genepitney155
@genepitney155 8 ай бұрын
So cryptic....maybe going back the Hubitat Elevation may be my next move.
@Sierra-Whisky
@Sierra-Whisky 2 жыл бұрын
It would have been great if there was a Restore checkbox available for the For function. A timer is a nice workaround but it doesn't solve the real problem. Another workaround is to use a template as a trigger. I use this template as a trigger to turn off a specific light after 30 minutes, no matter what: is_state('switch.light', 'on') and (states.switch.light.last_changed < now() - timedelta( minutes = 30 ))
@Scouras691
@Scouras691 Жыл бұрын
Great Video. Is there a simple way to create a switch with a timer for my gutter ice melt outlet?
@SlackerLabs
@SlackerLabs 11 ай бұрын
That one might be tricky unless you have a way of knowing when the device plugged into the outlet was on. You would need a way for Home Assistant know when it was on so and a way for it to turn it off. Which prolly means a power metering plug or something like that.
@CrankyCoder
@CrankyCoder 2 жыл бұрын
How much of this stuff do you back propagate back into your git repo? or are you leaning more towards just the UI?
@SlackerLabs
@SlackerLabs 2 жыл бұрын
All if should go back to my git repo. But I've been bad about updating it lately. I bounce between the UI and writing the YAML myself. For the stuff I am not use to doing like using events I tend to use the UI because I have to write less. But most of my automations live in the automation.yaml file now. This is to make it easier for me to edit on the go if I need to.
@jamesking890
@jamesking890 2 жыл бұрын
wax on / wax off !! lol. - great info thanks
@lukasduitmann
@lukasduitmann 5 ай бұрын
Hi, I'm trying to express my wish, maybe you have a tip for me. I would like to create a sleep timer so that when I say to my HomePod "Hey Siri, Good Night!" it starts a "Good Night" scene in Apple's Home App. All the lights should be turned off, but the TV in the bedroom and a few dimmed lights in the bedroom should remain on. Then the sleep timer should be triggered, starting a 60-minute timer. After the 60 minutes have elapsed, all devices, including those in the bedroom, should be turned off. The purpose is simple: I like to fall asleep with the TV on, but I don't want it to run all night. I hope my wish is understandable. Do you have any idea how I can implement this?
@SlackerLabs
@SlackerLabs 5 ай бұрын
I'm not sure on that one. I dont think the Apple home can do the delayed action in an automation. If you have home assistant, you could try to expose an input boolean from home assistant that the Apple home can turn off when you say good night. And then in Home Assistant have an automation that triggers on the input boolean change and starts an automation that delays the turn off of your device. I suspect you will have to get creative.
@playroy79
@playroy79 6 ай бұрын
do a update since home assistant allows making helpers while creating an automation
@jumbleblue
@jumbleblue 2 жыл бұрын
Very helpful! Not for motion sensor though
@fredamn76
@fredamn76 2 жыл бұрын
Is the restore option new? I used timers before to manage my motion sensor controlled lights . But timers didn't survive reboots. I will now modify my motion controlled light automations. Thanks Jeff.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
Not sure on that. I didn't even bother with timers until recently. But I want to say it was. Timers are one of the newer things in the UI though.
@Tekwyzard
@Tekwyzard 2 жыл бұрын
Yeah, the restore option is a very recent addition, I couldn't tell you which version it appeared in though, as I've only just plucked up the courage to update my instance from what it was running in July.
@hcchristensen5920
@hcchristensen5920 27 күн бұрын
hmmmm - how do I getto see the command center you're using? Doens't resemble my google home app at all ...
@SeattleSandro
@SeattleSandro Жыл бұрын
This is a good intro into using timer helpers. While I would only use this for my more important automations, setting this up on a few lights was really good practice. It would be great to get a more in-depth tutorial on the Choose action. There are a lot of good use cases for Choose, but not many people know about it or what it does. I was super confused by it when I first tried to use it. I think Choose is great for programming buttons on a light switch (I programmed my Philips Hue switches with it).
@barygol
@barygol Жыл бұрын
Is this still needed?
@SlackerLabs
@SlackerLabs 11 ай бұрын
Depends on the use case. I would still use it for critical automations. But the whole "for" attribute stopping when automations reload isn't an issue unless you are editing the automation waiting on the for.
@kodeypatterson8973
@kodeypatterson8973 2 жыл бұрын
Cool video!
@xelemorf
@xelemorf Жыл бұрын
It's more effective to do these with time pattern as trigger and with conditions instead.
@robertperkins4909
@robertperkins4909 2 жыл бұрын
It would be helpful for newbies trying to learn and make useful things if developers like yourself build an automation from the bottom up and not modify an existing one you have that we can't see all the parameters or how you got there. Overall I like your content but this is frustrating - and unfortunately common. What would be a great help would be a link under Show More to download the developer's automation/template/etc. with comments for explanation. Cheers and thanks for your efforts.
@SlackerLabs
@SlackerLabs 2 жыл бұрын
I did upload the automation to my Video Repo (github.com/thejeffreystone/SlackerLabVideoExamples/tree/main/2022-10-AutomatingTimers) if you want to see the annotated YAML version. Just didn't have it ready for the video release.
@dustyward6508
@dustyward6508 Жыл бұрын
Why use motion sensors as a prime example to use timers, then show how you use it for a air freshener?
@SlackerLabs
@SlackerLabs Жыл бұрын
Because the video wasn't about motion sensors.
@paulbacon5056
@paulbacon5056 Жыл бұрын
Great tutorial with shades of the Karate Kid 🤣
@chrissmith82771
@chrissmith82771 4 ай бұрын
You should probably have it watch for the timer canceled event also because users 😂
@notureaveragemiss
@notureaveragemiss Жыл бұрын
It kinda seems like you are combining two automations together to me. Maybe I'm missing something
@URackADisciprine
@URackADisciprine Жыл бұрын
Setting this up is ridiculously tedious and sad...this type of thing is one of the many reasons people dislike HA. The fact that the "For" option cannot handle this says it all. Even Google finally figured out how to handle delays and far better than HA no less. I know it took Google 10 years to finally implement delays but at least when they did, it worked without feeling like you are trying to program your way out of the rabbit hole. The "For" option in HA really should have been all the user needs to fill in to make delayed actions persistent and reliable.
@dankay9202
@dankay9202 9 ай бұрын
Of course, its so simple
@iambucketdotcom_official
@iambucketdotcom_official 2 жыл бұрын
I must be doing wrong, because I cannot get this to function properly where the FOR always works, just with caveats In my case Trigger1: Ring Doorbell detects Motion - TriggerID = FrontDoor_Motion_On Option1: When triggered by FrontDoor_Motion_On O1Action 1: Start Timer - timer.front_door_motion_timer O1Action 2: light.turnon - Front Door - White THAT PART WORKS What doesn’t work is: Trigger2: ID FrontDoor_Motion_Off Event: timer.finished Event data: entity id: timer.front_door_motion_timer Option 2: When triggered by FrontDoor_Motion_Off Action: light.turnon - Front Door - Blue The timer works, it counts down in Lovelace, but timer.finished does not trigger the turn light blue action
@iambucketdotcom_official
@iambucketdotcom_official 2 жыл бұрын
I made an exact replica of your automation, using a wax warmer on a zigbee switch.... Timer and turn on triggers, but after timer finishes nothing happens You say TIMER.FINISH in your video, but type TIMER.FINISHED I am using TIMER.FINISHED.... is this the issue? I have poured through HA docs as well and cannot get this to function.... Going back to using FOR
@cor7797
@cor7797 Жыл бұрын
bad, complex tutorial
@SlackerLabs
@SlackerLabs Жыл бұрын
Thanks for the feedback! It will help me avoid making bad, complex tutorials in the future.
Mastering Home Assistant Templates: A Beginner's Guide
23:56
SlackerLabs
Рет қаралды 56 М.
How To Use Timers To Build Reliable Automations in Home Assistant
11:26
Smart Home Junkie
Рет қаралды 46 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 25 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 53 МЛН
CAUTION: Google's Gemini 2 is ACTUALLY useful
11:52
Alex Ziskind
Рет қаралды 17 М.
STOP Your Home Automation Right Now with Conditions!
8:21
Smart Home Solver
Рет қаралды 177 М.
8 Simple Smart Home Automations Anyone Can Do!
11:56
Everything Smart Home
Рет қаралды 192 М.
Home Assistant 101: Input Booleans and Timers
18:55
ResinChem Tech
Рет қаралды 16 М.
Master Home Assistant Templates: State Based Entities
38:39
SlackerLabs
Рет қаралды 34 М.
5 Home Assistant Automations For Better Smart Lights!
15:58
Everything Smart Home
Рет қаралды 150 М.
12 Of The Best Smart Home Automation Ideas!
20:14
Everything Smart Home
Рет қаралды 353 М.