anoblet
(Andrew)
February 22, 2023, 9:41pm
1
How would I write an automation to automatically update? This is what I have so far though I’m unable to find a way to use a wildcard when specifying an entity id:
update_automatic:
automation:
action:
- data:
backup: true
service: update.install
target:
entity_id: update.*
alias: "Update - Automatic"
id: update_automatic
trigger:
- at: "00:00:00"
platform: time
Templating
update_automatic:
automation:
action:
- data:
backup: true
service: update.install
target:
entity_id: >
{{ states.update | selectattr('state','eq', 'on')
| map(attribute='entity_id') | list }}
alias: "Update - Automatic"
id: update_automatic
trigger:
- at: "00:00:00"
platform: time
anoblet
(Andrew)
February 22, 2023, 10:54pm
3
Is there anyway to detect if an entity supports backup? I receive an error for ESPHome devices.
Backup is not supported for Firmware
Looking at the expanded state object, it seems to include each supported feature’s title, so you should be able to use:
{{ states.update | selectattr('state','eq', 'on')
| selectattr('attributes.supported_features', 'search', 'BACKUP')
| map(attribute='entity_id') | list }}
Just FYI, make sure your backup methodology is as reliable as possible before auto-updating without checking breaking changes.
1 Like