1
0
Fork 0
ha-config/config/packages/meta.yaml

21 lines
834 B
YAML
Raw Normal View History

2023-05-05 15:25:23 +10:00
automation:
# https://community.home-assistant.io/t/auto-update-esphome-devices-via-automation/536573/15
- id: 0f9b330f-a026-49bc-9d1e-57d52f5ac625
alias: Auto-update ESP devices
trigger:
- platform: time_pattern
hours: "3"
minutes: "*"
condition:
- "{{ states.update | selectattr('entity_id', 'match', 'update\.node\d+_firmware')
| selectattr('state', 'eq', 'on') | list | count > 0 }}"
- "{{ states.update | selectattr('entity_id', 'match', 'update\.node\d+_firmware')
| selectattr('attributes.in_progress') | list | count == 0 }}"
action:
- service: update.install
target:
entity_id: "{{ (states.update | selectattr('entity_id', 'match', 'update\.node\d+_firmware')
| selectattr('state', 'eq', 'on') | first).entity_id }}"
mode: single