Here’s an updated version that calls button entities instead of relying on the zwave_js.ping
service. Creating a synthetic sensor in order to trigger a button presses seems weird, but it seems to work (even with multiple entities). If anyone has a better way to do this, I’m all ears.
template:
- sensor:
- name: "Dead ZWave Devices"
unique_id: dead_zwave_devices
state: >-
{% set exclude_filter = ['sensor.700_series_based_controller_node_status'] %}
{{
expand(integration_entities('Z-Wave JS') )
| rejectattr("entity_id", "in", exclude_filter)
| selectattr("entity_id", "search", "node_status")
| selectattr('state', 'in', 'dead, unavailable, unknown')
| map(attribute="object_id")
| map('regex_replace', find='(.*)_node_status', replace='button.\\1_ping', ignorecase=False)
| list
}}
alias: Ping Dead ZWave Nodes
description: ''
trigger:
- platform: state
entity_id:
- sensor.dead_zwave_devices
condition:
- condition: template
value_template: '{{ states.sensor.dead_zwave_devices.state != "[]" }}'
action:
- service: button.press
target:
entity_id: '{{ states.sensor.dead_zwave_devices.state }}'
mode: single
Here’s what happens after unplugging a device and waiting for it to be marked dead: