mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 10:30:14 -04:00
66 lines
2.9 KiB
YAML
66 lines
2.9 KiB
YAML
template:
|
|
- sensor:
|
|
- name: "ZWave: All Devices"
|
|
unique_id: template_sensor_alive_zwave
|
|
icon: mdi:z-wave
|
|
state: >-
|
|
{{ expand(integration_entities('Z-Wave JS') )| selectattr("entity_id", "search", "node_status") |
|
|
selectattr('state', 'in', 'alive') |
|
|
map(attribute='entity_id')| list | count | int(default=0)}}
|
|
attributes:
|
|
devices: >-
|
|
{{ expand(integration_entities('Z-Wave JS') )| selectattr("entity_id", "search", "node_status") |
|
|
selectattr('state', 'in', 'alive') | map(attribute='entity_id')| list }}
|
|
|
|
- name: "Dead ZWave Devices"
|
|
unique_id: template_sensor_failed_zwave
|
|
icon: mdi:z-wave
|
|
state: >-
|
|
{{ expand(integration_entities('Z-Wave JS') )| selectattr("entity_id", "search", "node_status") |
|
|
selectattr('state', 'in', 'dead') | map(attribute='entity_id')| list | count | int(default=0)}}
|
|
attributes:
|
|
devices: >-
|
|
{{ expand(integration_entities('Z-Wave JS') )| selectattr("entity_id", "search", "node_status") |
|
|
selectattr('state', 'in', 'dead') | map(attribute='entity_id')| list }}
|
|
|
|
- name: ZWave Pending Updates
|
|
unique_id: 6bf2876a-378a-4394-8a97-5b0603b17f2e
|
|
state: "{{ states.update | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | select ('in',integration_entities('Z-Wave JS')) | list | count }}"
|
|
icon: mdi:z-wave
|
|
attributes:
|
|
devices: "{{ states.update | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | select ('in',integration_entities('Z-Wave JS')) | list }}"
|
|
|
|
automation:
|
|
- id: automation_alert_failed_zwave_nodes
|
|
alias: Ping Dead Zwave Nodes
|
|
description: "Iterates through a list of dead ZWave Nodes and calls a service to press the Ping button"
|
|
mode: single
|
|
max_exceeded: silent
|
|
trigger:
|
|
- platform: state
|
|
entity_id: sensor.dead_zwave_devices
|
|
condition:
|
|
- condition: template
|
|
value_template: '{{ states("sensor.dead_zwave_devices")|int(default=0) >0 }}'
|
|
action:
|
|
- repeat:
|
|
while: '{{ states("sensor.dead_zwave_devices")|int(default=0) > 0 }}'
|
|
sequence:
|
|
- action: button.press
|
|
target:
|
|
entity_id: >-
|
|
{% set list =
|
|
expand(integration_entities('Z-Wave JS') )| selectattr('entity_id', 'search', 'node_status') |
|
|
selectattr('state', 'in', ['dead', 'unavailable', 'unknown']) |
|
|
map(attribute='entity_id')| list %}
|
|
|
|
{% set ns = namespace(buttons=[]) %}
|
|
{% for d in list %}
|
|
{% set ns.buttons = ns.buttons +
|
|
['button.' ~ (states[d].object_id.split('_node')[0]) ~ '_ping'] %}
|
|
|
|
{% endfor %}
|
|
{{ns.buttons}}
|
|
- delay:
|
|
seconds: 1
|