I want to modify an automation that is triggered when an esphome node disconnects from the network. I want to create a template on the trigger/entity_id, so that I don’t have to list all of my nodes. Thanks in advance for your help
- id: "NodeLostNetworkConnection"
alias: "Node Lost Network Connection"
trigger:
- platform: state
entity_id:
- binary_sensor.node_1_network_status
- binary_sensor.node_2_network_status
- binary_sensor.node_3_network_status
- binary_sensor.node_4_network_status
...
- binary_sensor.node_33_network_status
to: 'off'
action:
- service: persistent_notification.create
data_template:
message: '{% set my_node = trigger.to_state.name|lower|replace(''_'', '' '') %} {{ my_node }} lost internet connection'
title: "Node Disconnected"