50 lines
1.7 KiB
YAML
50 lines
1.7 KiB
YAML
# - id: '1774407470375'
|
|||
|
|
# alias: ESPHome Fleet Update
|
||
|
|
# description: ''
|
||
|
|
# triggers:
|
||
|
|
# - at: 03:00:00
|
||
|
|
# trigger: time
|
||
|
|
# - event_type: esphome_fleet_update_trigger
|
||
|
|
# trigger: event
|
||
|
|
# conditions:
|
||
|
|
# - condition: template
|
||
|
|
# value_template: "{{ expand(integration_entities('esphome'))\n | selectattr('entity_id',\
|
||
|
|
# \ 'contains', 'update')\n | selectattr('state', 'eq', 'on')\n | list | count\
|
||
|
|
# \ > 0 }}\n"
|
||
|
|
# actions:
|
||
|
|
# - variables:
|
||
|
|
# pending_devices: "{{ expand(integration_entities('esphome'))\n | selectattr('entity_id',\
|
||
|
|
# \ 'contains', 'update')\n | selectattr('state', 'eq', 'on')\n | map(attribute='entity_id')\
|
||
|
|
# \ | list }}\n"
|
||
|
|
# pending_names: "{{ expand(integration_entities('esphome'))\n | selectattr('entity_id',\
|
||
|
|
# \ 'contains', 'update')\n | selectattr('state', 'eq', 'on')\n | map(attribute='name')\
|
||
|
|
# \ | join(', ') }}\n"
|
||
|
|
# - action: notify.persistent_notification
|
||
|
|
# data:
|
||
|
|
# title: ESPHome Fleet Update Starting
|
||
|
|
# message: 'Updating {{ pending_devices | count }} device(s): {{ pending_names
|
||
|
|
# }}
|
||
|
|
|
||
|
|
# '
|
||
|
|
# - repeat:
|
||
|
|
# for_each: '{{ pending_devices }}'
|
||
|
|
# sequence:
|
||
|
|
# - action: update.install
|
||
|
|
# target:
|
||
|
|
# entity_id: '{{ repeat.item }}'
|
||
|
|
# continue_on_error: true
|
||
|
|
# - wait_template: '{{ not is_state(repeat.item, ''on'') }}
|
||
|
|
|
||
|
|
# '
|
||
|
|
# timeout: 00:05:00
|
||
|
|
# continue_on_timeout: true
|
||
|
|
# - delay:
|
||
|
|
# minutes: 2
|
||
|
|
# - action: notify.persistent_notification
|
||
|
|
# data:
|
||
|
|
# title: ESPHome Fleet Update Complete
|
||
|
|
# message: 'Finished updating {{ pending_devices | count }} device(s): {{ pending_names
|
||
|
|
# }}
|
||
|
|
|
||
|
|
# '
|