The secret to automatic ESPHome device updates!

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 119

  • @SmartHomeJunkie
    @SmartHomeJunkie  8 месяцев назад +4

    ⭐ You can download the code that I created for this video at: ko-fi.com/s/b6a066fea3 ⭐

    • @bitrip
      @bitrip 8 месяцев назад +1

      I see no code or download button for the code on this link, only a buy now button

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад +2

      @@bitrip That is correct.

    • @bitrip
      @bitrip 8 месяцев назад +1

      @@SmartHomeJunkie So I need to buy the code to test it out?

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад +1

      @@bitrip Yup, but don't worry, you get lifetime updates. And you can type the code for free from the screen if you don't want to support my work and prefer that.

    • @michiel2797
      @michiel2797 8 месяцев назад

      I copied the script but get a message malformed warning.

  • @DeliberateGeek
    @DeliberateGeek 8 месяцев назад +8

    I started playing around with Home Assistant just a couple of weeks ago and came across your channel shortly thereafter. I love the no nonsense and example driven approach you use to demonstrate your knowledge. I'm a software developer by trade, so a bit of coding doesn't intimidate me. However, the concept count with Home Assistant is high, so seeing some solid examples helps me understand how a number of concepts fit together. Keep up the great work!

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад +1

      Thank you so much for your compliments! 🙏🏻

  • @blm7929
    @blm7929 8 месяцев назад +5

    "Wouldn't it be great if all your devices could update automatically as soon as the ESPHome update is installed ?"
    For me the question is more "Wouldn't it be great if ESPHome didn't push updates every two days or even several in a single day?" 😂
    Joking aside, great idea and well done, a workaround at this level is always good to take!

  • @martinvermeer
    @martinvermeer 8 месяцев назад +2

    This is something that is very useful for me. I have lots of ESPHome devices and updating them is a real pain in the a**. From a fellow dutchie, thanks!

  • @matejfoltyn
    @matejfoltyn 8 месяцев назад +5

    Well, after the much feared 2023.12 update, I went back to the manual approach.
    I do genuinely want to stay as up-to-date as humanly possible, but it needs to be done reasonably and after reading the change notes.
    For some reason, the old saying of "if it aint broke, don't fix it" resonated with me for the past couple months.
    The introduced change of non-alphanumerical characters broke everything in my house as we use different characters than the english alphabet.
    I will implement the script and test it - but I will be going in with the manual approach. I cannot afford another episode of a "mad wife" xD

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      Yeah, that makes sense. Then just don't create the automation and just use the script.

    • @matejfoltyn
      @matejfoltyn 8 месяцев назад

      @@SmartHomeJunkie will certainly do.
      Do you think you could also help us with the template trigger for when all the devices match the installed version of ESPhome?
      That way, we could send a notification of a successful update of all devices.

    • @gorgorgonzales3090
      @gorgorgonzales3090 8 месяцев назад +1

      same for me, was a huuge pain in the butt... still fining automations and scripts that don't work properly because of this once in a while...

    • @StijnSillen
      @StijnSillen 5 месяцев назад

      ​@@matejfoltyn you can use the template of the automation to see if the number of ESPHome devices that need an update is = 0

  • @christian1603
    @christian1603 8 месяцев назад +2

    Thanks a lot for this one ! And just on time for the update of this morning 👌
    I just added an notification at the end of the script, so I know all the updates are done.

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      Thank you for your kind words! I'm thrilled to hear that the video was timely for your update.

  • @NigelGent
    @NigelGent 8 месяцев назад +2

    Great video. I used the matching blog post to set this up but I did have a couple of syntax issues. I had to change all the quotes in the templates and add couple of spaces in front of the entity_id after target: maybe this was just a cut and paste issue for me but worth a look for anyone with syntax errors.

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      Thanks for notifying. I forgot to remove the code from the blog post 😅

  • @saracenas69
    @saracenas69 8 месяцев назад +1

    Many thanks, really enjoy your tutorials! Keep going, you are helping people who want to create something by following your guidances!

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      I'm so glad that you enjoy my videos. Thank you for this comment. 🙏🏻

  • @renedevrind1733
    @renedevrind1733 8 месяцев назад +1

    First i got an error, then i purchased the blueprint and all went smooth. Recommended!

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      That's great to hear! The code that I show in the video should work though 🤔

  • @davesadler624
    @davesadler624 8 месяцев назад

    Thank you. Your channel continues to provide succinct explanations to real-world problems in the Home Assistant sphere.
    I would love to see you tackle debugging failures if possible. For example, when I run this automation, or click the Update All; HA reaches out to grab the updated code, but all installs fail sequentially - usually with some note about indentation. I have no idea if that's normal, broken, or simply something i've managed to mess up :)

  • @wscottfunk
    @wscottfunk 8 месяцев назад +1

    Nice idea Ed! I bought you a Ko-fi to help support the channel. I'll download and give the blueprint a spin later. I currently use a conditional card to show all available updates in HA and I also receive a mobile notification as well. Thanks and have a good day!

  • @gnospanker
    @gnospanker 8 месяцев назад +1

    Got it working! At least I'll see the next time there's an ESPHome update. Thanks Ed!

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      Great! Let me know how it works for you!

    • @gnospanker
      @gnospanker 8 месяцев назад

      @@SmartHomeJunkie will do! I also added a condition to the automation to only run between 1:00 and 4:00 AM. Hopefully that will prevent any unexpected offline devices during the hours my family is awake. 😊

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      @@gnospanker You should do it the other way around. The trigger should be the time on a daily basis and the condition should be the template that I show you in the video.But I think that won't work either because of the trigger variable that you are missing.

    • @gnospanker
      @gnospanker 8 месяцев назад

      @@SmartHomeJunkie ahh, good point thanks!

  • @markkozik7963
    @markkozik7963 8 месяцев назад

    This is huge! What a time saver! Thank you!

  • @stefan-lupo-pelzl
    @stefan-lupo-pelzl 8 месяцев назад +1

    Great tutorial!
    Somehow I was waiting for it 😂

  • @dirk43094
    @dirk43094 8 месяцев назад +1

    Thanks Ed, really like your videos!

  • @HollyFredD
    @HollyFredD 8 месяцев назад +1

    Very useful ! Thanks (again) for your very clear explanation and the quality of the video.
    I personaly tweaked a little this automation adding a notification on Telegram with an actionable button "upgrade"

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      Awesome! And thanks for your kind words!

  • @donaldhoudek2889
    @donaldhoudek2889 8 месяцев назад

    Thanks Ed, another great tip!

  • @ha_tinkerer1191
    @ha_tinkerer1191 8 месяцев назад

    Hi. Great video. Would this work for WLED flashed devices? Thanks and cheers!

  • @sevagjb
    @sevagjb 8 месяцев назад +1

    wonderful code Ed
    Thanks👌

  • @SheLeftMeUnsupervised
    @SheLeftMeUnsupervised Месяц назад +1

    First off Thank you for this tutorial! Second is there a way to exclude entities that you don't want to update in this somehow? I have 3 pc remotes that will turn on/off pc's with updates. I would rather do that manually. This is awesome though. Can't use the automation bit because of the pc remotes but having a button on the dashboard makes this good for me. No more one at a time mess!

    • @SmartHomeJunkie
      @SmartHomeJunkie  Месяц назад

      I think you might be able to filter them out using the friendly names of the remotes.

  • @joshcliffejones
    @joshcliffejones 8 месяцев назад

    Awesome idea Ed! I’m shocked that HA doesn’t have this feature built in by default like with the add-ons! Would it be easy enough to add exceptions to the script/automation, so that it only auto updated certain devices within ESPhome rather than all? Many devices I’m happy to have auto update, but some I like to perform manually in case there is an issue.

  • @joshuawoomusicstreamvault5158
    @joshuawoomusicstreamvault5158 7 месяцев назад

    Great video! As this was the first time creating a script, I had to add "script: !include scripts.yaml" to my configuration.yaml before the the script would appear in the HA GUI.

  • @jonascale
    @jonascale 8 месяцев назад

    Love your videos thanks for sharing.

  • @captain_loeffel
    @captain_loeffel 8 месяцев назад +1

    The only difference to have the "for each" - command at the end is the fact that the code will be executed once for sure. When it is on the top it won't be executed if there are no ESP32Home devices. So the system will put out an error if there are no devices when you don't change the code.
    Within the last updates I had too many devices or integration making problems or failing and I needed to wait for an update. My Xiaomi Airfilter is totally gone after one of these updates and now I can't use him via HA anymore. So an auto update is out of the question as there is no way to downgrade again. Still good video, thanks for sharing.
    And now I will try to find a way that only weight measurements with body statistics are taken into HA if I use my Xiaomi Body Composition Scale 2.

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      I get it. Unfortunately, most of the time you discover a problem after updating 😖

  •  8 месяцев назад

    Nice automation! Is there any reason that you're not using the same line of code for the sequence in the script as you are in the automation trigger (except the "count > 0" part of course)? The one in the trigger is much shorter and returns the same.

  • @the_smart_home_maker
    @the_smart_home_maker 8 месяцев назад

    Nice one 👍🏻 thank you

  • @manfredzimmer1199
    @manfredzimmer1199 8 месяцев назад +1

    Top Video 👍 good Job

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      Thanks Manfred! 🙏🏻🙏🏻🙏🏻

  • @DaveStLou
    @DaveStLou 8 месяцев назад +1

    This is great!

  • @marcelsmeets4162
    @marcelsmeets4162 8 месяцев назад +1

    Hi Ed,
    great vid and very well solved .You are doing a great job.
    However in my case this causes a problem: Everytiime I uopodate the Esp software and application on the ESP8266 It restarts but thwn several pins are activated (in my case connected to a Relay board)
    Or is there anything I can do about that??

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад +1

      That's unfortunate. No idea really what causes this. Probably the ESPHome code activates these pins on startup, but it's just a guess.

    • @dartfrogdk
      @dartfrogdk 8 месяцев назад

      You used the wrong pins for you esp device, some pin get pulled high on boot and that is what you experience, see random nerd on the internet just search for it, he got all info you need

  • @MrDutchstyler
    @MrDutchstyler 8 месяцев назад +1

    ❤ this is a gamechanger 💪💪

  • @cedricdelecole3964
    @cedricdelecole3964 7 месяцев назад

    Super thanks !!

  • @uSlackr
    @uSlackr 4 дня назад

    Your initial comment “you have to update all your devices with every release…” isn’t true. Unless the component you use was changed or there is a security issue, there is no need. Especially with the 2-3 dot releases.

  • @RemydeRuysscher
    @RemydeRuysscher 8 месяцев назад +1

    What about update all button in ESP home? Can you automate this button as well?

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      That is the fairly easy way that I mentioned in the beginning of the video. It cannot be automated as far as I know.

  • @bennyrosenwasser2567
    @bennyrosenwasser2567 5 месяцев назад

    Hey Ed, thank you so much for your continued contribution, it helps me enormously to pimp my HA installation.
    What I have noticed recently is that after an update of the ESPHome integration, the first device updates automatically but then stops, the rest of the devices are no longer updated automatically.
    Do you know what this could be?
    PS: after manually starting the script, the updates will continue one after the other.

    • @SmartHomeJunkie
      @SmartHomeJunkie  4 месяца назад

      No idea really. It "should" still work. I will look into it to see if I can change anything.

    • @mickaelchambosse9091
      @mickaelchambosse9091 4 месяца назад

      Hello, same for me here. If you found a solution.

    • @SmartHomeJunkie
      @SmartHomeJunkie  4 месяца назад

      @@mickaelchambosse9091 Yes, the solution is to add a delay of 10 seconds before the repeat. I implemented it in the blueprint now.

    • @mickaelchambosse9091
      @mickaelchambosse9091 4 месяца назад

      @@SmartHomeJunkie nice thanks!

  • @renedevrind1733
    @renedevrind1733 3 месяца назад

    @SmartHomeJunkie Ik wil v1.0 met v1.3 blueprint vervangen. Echter, deze tutorial komt niet meer overeen met de huidige versie van HomeAssistant. Ed, wellicht kun je een how to update video uitbrengen?

    • @SmartHomeJunkie
      @SmartHomeJunkie  3 месяца назад

      This tutorial does work with the current version of Home Assistant. Not sure what you mean.

  • @adilsonsouzasantos8094
    @adilsonsouzasantos8094 6 месяцев назад +1

    Valeu!

    • @SmartHomeJunkie
      @SmartHomeJunkie  6 месяцев назад

      Thank you so much for your support! 🙏🏻

  • @benjamindesign
    @benjamindesign 8 месяцев назад

    Be careful with the dot character in regex (in select('match', '^update.')) as it's used to represent 'any character'. Use '\.' to escape it as a dot-character. Should work in this case, but could case some weird behaviour in other situations :) - Awesome automation nonetheless!

  • @hhorstink
    @hhorstink 8 месяцев назад +1

    Awesome!

  • @lensherm
    @lensherm 8 месяцев назад

    Hi Ed, another great idea. Thank you! Would this automation not cause an infinite loop, IF an update on at least one of the ESPHome devices fails and the update counter remains above 1? For example, I've had update failures on devices when there isn't sufficient storage remaining for the newly-uploaded firmware.

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад +1

      The script stops if a device cannot be updated.

    • @lensherm
      @lensherm 8 месяцев назад

      @@SmartHomeJunkie, so in that case you'll have devices after the faulty one not updated, correct?

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад +1

      @@lensherm That is correct. I mention this in the video btw.

  • @ThangNguyenMike
    @ThangNguyenMike 8 месяцев назад

    I have some devices with Esphome, how to automatically skip any notification to update their firmware whenever I update Esphome?

  • @oscargraveland
    @oscargraveland 8 месяцев назад +1

    What will happen if one of the ESPHome devices is offline?
    Will the loop hang because that device never returns an "off" in the wait stage?

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      The script will stop at that point I guess.

  • @sandromuller2288
    @sandromuller2288 Месяц назад

    Hello, unfortunately I can't use the automation. I downloaded your ZIP file and unpacked it. Then I used the "File Editor" to load the YAML file to "homeassistant/blueprints/automation/homeassistant". The blueprint is also displayed correctly under "automatipons - blueprints".
    After this I could only create an automation without any further details. But when I start it now nothing happens.

    • @SmartHomeJunkie
      @SmartHomeJunkie  Месяц назад

      Please wait until a new update of ESPHOME is released. It will work at that moment.

  • @BlindGuyNAR
    @BlindGuyNAR 8 месяцев назад +1

    Ed, i don’t get the part about using a script instead of just an automation for the reason, “so i can call it using a button from a dashboard”. You can easily trigger an automation via a button press via a button helper. What did i miss?

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      Yes, you can do that as well, but rubbing a script is the "proper" way to do this. An automation typically triggers on an event and a script is something you call within an automation or from a button.

    • @BlindGuyNAR
      @BlindGuyNAR 8 месяцев назад +1

      @@SmartHomeJunkiemaybe … i’d consider a button press an event, but that’s semantics i guess.

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      @@BlindGuyNAR Yes, it's also a matter of preference. If like to do it like this. But you can use just an automation as well. As a matter of fact, the blueprint is just an automation.

  • @BryanNystrom
    @BryanNystrom 8 месяцев назад

    Thanks for the great vide Ed. I've implemented the script and it works fine. However, for some reason I can not get the automation to trigger. If I extract the trigger template and test it in the "Template" editor, it works file and returns a "true", but the same template never seems to cause the automation to kick off. I don't have any issues getting other automation to trigger, but this is the first one I've done that's triggered off of a template? Any ideas?

    • @BryanNystrom
      @BryanNystrom 8 месяцев назад

      alias: ESPHome Updater
      description: ""
      trigger:
      - platform: template
      value_template: >-
      {{ integration_entities('esphome') | select('match', '^update.') |
      select('is_state','on') | list | count > 0 }}
      condition: []
      action:
      - service: script.esphome_update_all_devices
      metadata: {}
      data: {}
      mode: single

  • @davecl35
    @davecl35 7 месяцев назад

    hi Ed... just bought this blueprint and installed it where you said but it doesn't show up in blueprints or scripts or automations.
    In my blueprint folder I have automations folder and script folder, i suspect your smarthomejunkie folder should go in one of these and not in the blueprint folder itself?

    • @SmartHomeJunkie
      @SmartHomeJunkie  7 месяцев назад +1

      Indeed, it should go within the automation folder. This is written in the instructions in the blueprint.
      Edit: I saw that the instruction was not correct in Ko-Fi. Fixed that. Thanks.

    • @davecl35
      @davecl35 7 месяцев назад +1

      No worries, got it sorted, thank you 👍

    • @SmartHomeJunkie
      @SmartHomeJunkie  7 месяцев назад

      @@davecl35 Thanks for your understanding! 🙏🏻

  • @jensenjensen824
    @jensenjensen824 7 месяцев назад +1

    cool

  • @martingerken7094
    @martingerken7094 8 месяцев назад +1

    Is there a way to backup ESPhome devices? (i.e. to keep the old binaries somewhere to revert when upgrade fails)

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      I honestly don't know. Maybe someone else knows?

    • @endthefighting
      @endthefighting 8 месяцев назад +1

      I haven't done this myself, but perhaps running an older version of esphome in a venv on your desktop, and compiling/uploading from there might work.
      I currently compile/upload all updates from my pc, as compile times on the pi 4 are depressingly slow.

    • @matejfoltyn
      @matejfoltyn 8 месяцев назад +2

      When the 2023.12 fiasco dropped, it wasn't because the devices were somehow bricked - it just introduced some new functionality.
      If you want to "downgrade" to an older version, there is a way.
      1. You need to restore the addon backup - make sure you reboot HA after that (not restart, reboot! learned that the hard way).
      2. hit install on all devices again
      3. let the compiler do its thing and push the "old" version to the devices again.
      Hope that helps.

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад

      @@matejfoltyn Thanks for this!

  • @CountZilch
    @CountZilch 7 месяцев назад

    I'd be careful. I have Athom power plugs to monitor power usage on my fridge and NAS/router. Often after an update it leaves the switch in an off state 🙄 Not good to automate in the case. Using a trigger button may be a good idea.

  • @blm7929
    @blm7929 8 месяцев назад

    "This can all be done in a single automation without needing a script, but as I mentioned earlier [...] initiate the update via a button on your dashboard"
    In fact, this too can be done with a single automation! When you start an automation via a button, it will execute the action part, the manual start override the trigger! (And even the conditions part if I remember correctly)

    • @SmartHomeJunkie
      @SmartHomeJunkie  8 месяцев назад +1

      Yes, I know, but it's not the proper way of utilizing automations that way. Automations are typically things that trigger on an event "under water".

  • @jerryaycock
    @jerryaycock 3 месяца назад

    Lost script while updating - can't get it back- tried several times. {{ states.update | selectattr('state', 'eq', 'on') |
    map(attribute='entity_id') | select('in,integration_entities('esphome')) |
    list }} this is the script -- can't see what I am missing ----- alias: ESPHome:update all
    sequence:
    - repeat:
    for_each: >-
    {{ states.update | selectattr('state', 'eq', 'on') |
    map(attribute='entity_id') |
    select('in,integration_entities('esphome')) | list }}
    sequence:
    - service: update.install
    data: {}
    target:
    entity_id: "{{ repeat.item }}"
    - wait_template: "{{ is_state(repeat.item, 'off') }}"
    continue_on_timeout: true
    mode: single
    Any pointers Please

    • @SmartHomeJunkie
      @SmartHomeJunkie  3 месяца назад

      I adjusted the script in the downloads code so that it works.

  • @Demockery
    @Demockery 28 дней назад

    `integration_entities('esphome') | select('match', '^update.')` isn't returning any results. Am I being silly?

    • @SmartHomeJunkie
      @SmartHomeJunkie  28 дней назад

      If there are no devices to update it doesn't show anything indeed.

    • @Demockery
      @Demockery 27 дней назад

      @@SmartHomeJunkie but there were 7 devices - looking at the raw `integration_entities('esphome')` list there entities don't even exist. Let alone exist in a state of on/off.

    • @SmartHomeJunkie
      @SmartHomeJunkie  26 дней назад

      @@Demockery No idea. I updated to the latest ESPHome yesterday and, after that, the automation kicked in fine.

  • @775969772
    @775969772 4 месяца назад +1

    I have no issue supporting you, but hiding the code behind a paywall isn’t the right approach. It would be much better to release it openly, as others do, to support the open source community.

    • @SmartHomeJunkie
      @SmartHomeJunkie  4 месяца назад +1

      You can type the code for free from the screen 🤷🏼‍♂️
      Also see www.smarthomejunkie.net/shop/#whydoiaskformoney

    • @wscottfunk
      @wscottfunk 4 месяца назад +2

      His time and effort is worth compensating. He is supporting the open source community by posting the tutorial with instructions on how to add it manually. The beauty is that you have a choice to follow the tutorial and manually create the automation or compensate the creator and download a blueprint, saving YOU the time and effort.

    • @SmartHomeJunkie
      @SmartHomeJunkie  4 месяца назад +1

      @@wscottfunk Thank you for your support 🙏🏻

    • @wscottfunk
      @wscottfunk 4 месяца назад +1

      ​​@@SmartHomeJunkieEd, I've learned so much from you and truly appreciate it! I just bought the blueprint again for a second time just to show my appreciation.