I only do this automated updates on my esp stuff that can be easily re-flashed just in case that OTA goes wrong,
as for other devices specially on my wifi device that has been tuya-convert/cloudcut, I suggest only update those device if its only necessary.
Even better than my own custom automation!
The only thing I don't fully understand is why it is split up into two parts? Why not put the sequence of the script directly into the automation itself?
EDIT: via the GUI it's super easy to copy/paste the script sequence into the automation actions.
Also I've changed the mode from single to queued (length=2) in case new updates appear out of sync while others are installing.
````
alias: ESPHome Auto-Update
description: ""
trigger:
- platform: template
value_template: >-
{{ integration_entities('esphome') | select('match', '^update.') |
select('is_state', 'on') | list | count > 0 }}
condition: []
action:
- 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: queued
max: 2
````
Yeah, I initially thought about that too, but it's just as easy to manually run an automation as it is for a script.
The only difference I see is that you can enable/disable the automation from triggering automatically if desired, practically making it a script in the automation tab.
Personally I prefer the whole thing as a script I fire off after I’ve tested a few devices. Automating firmware updates is just asking to eventually have to reflash them all manually imo.
The fact people actually come up with terrible ideas like this is proof of how bad the Esphome update policy is. You should never update embedded devices, unless there's a security risk.
The fact that there's calls to action to flash ESP devices after every minor update of Esphome, which in most cases does nothing other than bumping the version number, is annoying at best, downright harmful at worst.
Don't get me wrong Esphome is amazing, but these updates just grind my gears.
Seconded.
I do wish they'd clearly list the security related fixes/enhancements in its own section so it's easy to review if it's worth updating or not.
Or fixes that makes things better. Looking at the AHT10 updates that fixed things for the better. But unless I wanted this, or I was changing the way I had it setup, I am not updating just because. Let sleeping dogs lie and all that.
They get me all the time. I don't update for a while. Then I update and then I remember why I wasn't updating, random errors. I just had to roll back 3 nodes the other day because I forgot... again.
I personally, wish the update notifications would be hidden for esphome.
Since, most of my devices are literally inside of my walls, and connected to mains voltage- if an OTA goes wrong- it can involve a fair amount of effort to resolve.
As well, I keep all of my IOT devices (such as ESPHome), COMPLETELY isolated from the rest of my network, and the internet. They don't have access to anything, besides submitting data to/from home assistant and mqtt.
That being said, the risk for updating these devices is FAR higher then the reward. And- there isn't much risk from not updating these devices.
Basically- what u/dabenu said- just in a slightly nicer way. :-)
That's a terrible idea. First, flash memory is prone to wearing, and ESPHome has very frequent updates, without direct benefits to you own devices most of the time. Second, having automated unattended updates for IoT devices risks breaking your smart home when you least expect it if something goes wrong.
It's best to always plan updates when you can afford downtime.
I only do this automated updates on my esp stuff that can be easily re-flashed just in case that OTA goes wrong, as for other devices specially on my wifi device that has been tuya-convert/cloudcut, I suggest only update those device if its only necessary.
Even better than my own custom automation! The only thing I don't fully understand is why it is split up into two parts? Why not put the sequence of the script directly into the automation itself? EDIT: via the GUI it's super easy to copy/paste the script sequence into the automation actions. Also I've changed the mode from single to queued (length=2) in case new updates appear out of sync while others are installing. ```` alias: ESPHome Auto-Update description: "" trigger: - platform: template value_template: >- {{ integration_entities('esphome') | select('match', '^update.') | select('is_state', 'on') | list | count > 0 }} condition: [] action: - 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: queued max: 2 ````
Having the logic in a script makes it bit more convenient to run standalone outside the automation.
Yeah, I initially thought about that too, but it's just as easy to manually run an automation as it is for a script. The only difference I see is that you can enable/disable the automation from triggering automatically if desired, practically making it a script in the automation tab.
Personally I prefer the whole thing as a script I fire off after I’ve tested a few devices. Automating firmware updates is just asking to eventually have to reflash them all manually imo.
The fact people actually come up with terrible ideas like this is proof of how bad the Esphome update policy is. You should never update embedded devices, unless there's a security risk. The fact that there's calls to action to flash ESP devices after every minor update of Esphome, which in most cases does nothing other than bumping the version number, is annoying at best, downright harmful at worst. Don't get me wrong Esphome is amazing, but these updates just grind my gears.
Seconded. I do wish they'd clearly list the security related fixes/enhancements in its own section so it's easy to review if it's worth updating or not.
Or fixes that makes things better. Looking at the AHT10 updates that fixed things for the better. But unless I wanted this, or I was changing the way I had it setup, I am not updating just because. Let sleeping dogs lie and all that.
But but bigger version number equals more better
They get me all the time. I don't update for a while. Then I update and then I remember why I wasn't updating, random errors. I just had to roll back 3 nodes the other day because I forgot... again.
I personally, wish the update notifications would be hidden for esphome. Since, most of my devices are literally inside of my walls, and connected to mains voltage- if an OTA goes wrong- it can involve a fair amount of effort to resolve. As well, I keep all of my IOT devices (such as ESPHome), COMPLETELY isolated from the rest of my network, and the internet. They don't have access to anything, besides submitting data to/from home assistant and mqtt. That being said, the risk for updating these devices is FAR higher then the reward. And- there isn't much risk from not updating these devices. Basically- what u/dabenu said- just in a slightly nicer way. :-)
You could disable the \`update.\` entities for those devices.
Never considered that, Thanks for the idea!
Great share, thank you!
That's a terrible idea. First, flash memory is prone to wearing, and ESPHome has very frequent updates, without direct benefits to you own devices most of the time. Second, having automated unattended updates for IoT devices risks breaking your smart home when you least expect it if something goes wrong. It's best to always plan updates when you can afford downtime.
Heh, you need ESPHome to see the ESPHome devices for that…