Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ############################################################
- #
- # ESPHome - unavailable devices notification
- #
- # Purpose:
- # - finding unavailable espHome devices
- # - sending text into a Telegram group with the names of the unavailable devices
- #
- # ############################################################
- esphome_detect_unavailable_devices_main:
- alias: Detect unavailable ESPHome devices
- icon: mdi:controller-classic-outline
- description: This script detects unavailable ESPHome devices
- fields:
- msg_title:
- description: "The title of the notification"
- advanced: true
- required: true
- example: "State change"
- default: "default msg title"
- # selector: text
- msg_text:
- description: "The message content"
- advanced: true
- required: true
- example: "The light is on!"
- default: "default msg text"
- msg_receiver:
- description: "The receiver of the message"
- advanced: true
- required: false
- example: "admin"
- default: "admin"
- mode: queued
- sequence:
- - service: input_text.set_value
- target:
- entity_id: input_text.esphome_unavailable_devices_text
- data:
- value: >-
- {%- set all_status_entities_list = states.binary_sensor | selectattr('state', 'in', ['unavailable', 'unknown', 'off']) | selectattr("entity_id", "match", "binary_sensor.l[0,2,9].*_status") | map(attribute="entity_id") | list -%}
- {%- set all_status_entities_string=all_status_entities_list | join('\n- ') | regex_replace(find='_status', replace='', ignorecase=False)-%}
- - {{ all_status_entities_string }}
- - service: script.tg_txt
- data_template:
- msg_title: "*{{ msg_title }}*"
- msg_text: "DEBUG: {{ msg_text }} {{ states('input_text.esphome_unavailable_devices_text') }} ###"
- msg_receiver: "{{ msg_receiver }}"
- # ############################################################
- # END OF FILE
- # ############################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement