The secret to automatic ESPHome device updates!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hi! Here I am again, and this time with a  super useful tip to automatically update   your ESPHome devices as soon as a new  ESPHome update is available. From now on,   you won’t have to update your ESPHome devices  manually anymore. With the automation and the   script I’m going to show you in this video,  you’ll update your ESPHome devices in no time!  If you use ESPHome, you probably recognize that  you have to update all your ESPHome devices   whenever a new ESPHome update is released.  While it can be done relatively easily within   the ESPHome interface itself, wouldn’t it  be great if all your devices could update   automatically as soon as the ESPHome update is  installed? With the help of the automation and   the script that I’m going to show you in this  video tutorial, you can set it up yourself.   I’ve chosen to use a script and an automation for  this purpose, so you can also trigger the script   via a button on your dashboard if you prefer not  to update the devices completely automatically.  We start with the script that allows  you to update all your ESPHome devices.  Open Home Assistant. Go to Settings and click   Automations and Scenes. Click the Scripts tab.  Click Add script. Select Create New Script.  Enter a name for your script, for instance:  ESPHome: Update all ESPHome Devices.  The first thing that we want to do is  loop through all the ESPHome devices.  For this, click on Add Building Block. Select Repeat.  Select “For Each” in the Repeat Type dropdown box. Now we can create a list with all the items that   we want to process. In our case, we are going to  enter some template code here that retrieves all   the ESPHome devices that need to be updated. Add the following code in the list field:  This code returns all the esphome devices  with the status update set to ‘on’.  Next, we are going to add the action that  updates the esphome device in the loop.  Click Add Action. Scroll down and click Other Actions.  Click Call Service. Select Update dot   install in the service dropdown field. We will need to add some yaml now,   so click on the three dots in the right  upper corner of the call service section.  Click Edit in YAML. Add the following code:  What happens here, is that the esphome device  that is selected in the loop will be updated.  Now we’d like to wait until this device is updated  before we go to the next device in the list.  Click Add Building Block. Select the option Wait   for a template in the dropdown box. Add the following code in the wait template field:  Because of this code, the loop will pause  until the selected ESPHome device is   updated. After that, the next ESPHome  device in the list will be processed.  Click Save Script. While creating this tutorial,   I noticed that the code in YAML is in a different  order than how we just entered it. This shouldn’t   be a problem, but if you want to change it, go  to the three dots in the upper right corner of   the screen and click ‘Edit in YAML.’ Then,  move the bottom part of the code up as I’m   doing here and click ‘Save Script’ again. Great! You have now created your script.   You can start this script by creating a  button on your dashboard or by creating   an automation that automatically starts  the script when ESPHome itself is updated.  I need your help! You will be doing me a huge favor   if you subscribe to my channel if you haven’t  already. And, you help me a lot if you also   give this video a thumbs up and leave a comment.  This way, YouTube will present this video to new   people and that will make the channel grow! In  the description of the video, you will also find   information about how you can sponsor me so that  I can continue to make these tutorials for you.  Thank you! If you want to automatically execute the script we   just created, we need to create another automation  that checks if there are ESPHome devices that need   an update. By the way, this can all be done in  a single automation without needing a script,   but as I mentioned earlier in this tutorial, I  chose to create a combination of a script and   an automation so that you can also initiate the  update via a button on your dashboard. If you want   to know how to start an automation via a button on  your dashboard, take a look at this video where I   explain it step by step! Go to Home Assistant.  Go to Automations & Scenes. Click Create Automation.  Select Create New Automation. Click Add Trigger.  Click Other triggers. Scroll down and click Template.  Enter the following code in  the Value template field:  This code returns the number of esphome  devices that need an update. We want to   trigger the script that we’ve just created  when the returned value is higher than zero.  Click on “Add Action” in the “Then do” section. Scroll down and click “Other actions”.  Scroll down and select “Script”. Select the script that we’ve just   created. In our case it’s called  ESPHome: Update all ESPHome devices.  Click Save. Give your automation   a meaningful name and click save again. Your automation is now ready. From now on, all   your ESPHome devices will be updated automatically  whenever you update ESPHome. It might happen that   an ESPHome device cannot be updated because it  uses code that is not compatible with the new   version of ESPHome. In that case, the updating  process will stop at that device. You will need   to wait until the developer of the code for that  ESPHome device makes the code compatible with the   latest version of ESPHome. Alternatively, you can  modify the code yourself if you know how to do it.  If you find it too much work to type the code from  the screen, you can download the blueprint I have   created for this purpose for a small fee. It saves  you a lot of effort and frustration, and you help   me keep this channel alive. You’ll find the link  to the blueprint that automatically updates the   ESPHome devices in the description of this video. Thanks for watching, and I hope this tutorial   has made your Smart Home life a bit easier.  Do me a favor, give this video a thumbs up,   and subscribe to my channel. It would be great  if you leave a comment down below as well. This   ensures that YouTube will show my videos to more  people. If my videos save you time and you want   to ensure that this channel continues to exist,  consider sponsoring me, just like these fantastic   people do. Thanks to all of you, I can keep  creating tutorials for the community. Thank you.  See you soon in my next video! Bye Bye!
Info
Channel: Smart Home Junkie
Views: 10,574
Rating: undefined out of 5
Keywords: homeassistant, ESPHome, EffortlessUpdates, HomeAutomation, SmartHome, DIY, IoT, FirmwareUpdates, UpdateGuide, ESP8266, ESP32, Automation, OpenSource, InternetOfThings, IoTProjects, DIYProjects, TechGuide, SmartDevices, update esphome automatically, esphome update, update esphome devices, update esphome firmware, update esphome device firmware, auto update esphome devices, automatic update esphome, esphome tutorial, esphome projects, home assistant, home assistant tutorial, smart home, esphome 2024
Id: XqctgLyj2cs
Channel Id: undefined
Length: 7min 20sec (440 seconds)
Published: Sun Feb 18 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.