Automatically ping/poll unresponsive nodes on zwavejs2mqtt

Using zwavejs2mqtt, I have been experiencing a higher than usual occurrence of the “unknown” status on various Z-Wave nodes. 99% of the time, this problem is immediately fixed by running the ping command. But with 50+ devices, it becomes a daily chore. I have tried healing the network, re-interviewing frequent offenders, but nothing seems to work.

Ideally, I’d be able to automatically ping or poll any nodes that have become “unknown” or otherwise unresponsive until they become “alive” again.

I’ve attempted to create a Home Assistant automation with this functionality, but my knowledge of scripting is subpar and I can’t seem to get it working. In case anyone can spot an error in my ways, here is the automation:

* id: 'xxxxxxxxxxx'
alias: Red October
description: Pings any dead or unknown nodes on Z Wave Network until a response is heard
trigger:
  * platform: event
event_type: state_changed
condition:
  * condition: and
conditions:
    * condition: template
value_template: '{{ trigger.event.data.new_state.domain == "sensor, switch, lock, light" }}'
    * condition: template
value_template: '{{ trigger.event.data.new_state.state == "dead, unavailable, unknown, none" }}'
action:
  * repeat:
until:
- condition: template
value_template: '{{ trigger.event.data.new_state.state == "alive" }}'
sequence:
- service: zwave_js.ping
target:
entity_id: '{{ trigger.entity_id }}'
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
mode: parallel
max: 5

what kind of zwave stick are you using for your coordinator?

@harryfrishberg I’m guessing you have a 700 series stick. If you aren’t, ignore this message. But if you are, you need to update the firmware on your stick as you’ve ran into an issue which affects all 700 series USB sticks. Details and link to the new firmware can be found in this thread:

1 Like

I’m not on the 700 yet. Using the 5+ Aeotec Stick. But I wonder if it is a firmware update issue?

I’m not actually sure how to update firmware on the stick. I’m in a Mac world (other than the Raspberry Pi 4 that is running home assistant). Anyone able to help me upgrade my stick?

1 Like

If you still need it:

alias: 'Z-Wave JS: Automatically Ping Z-Wave Devices if Dead'
description: ''
trigger:
  - platform: state
    entity_id:
      - sensor.kitchen_sink_light_node_status
      - sensor.nursery_bench_light_node_status
      # INCLUDE ALL OF YOUR _node_status ENTITIES. You could get fancy and
      # make this a template, but I don't want to overcomplicate it.
    for:
      hours: 0
      minutes: 30
      seconds: 0
    to:
      - dead
      - unavailable
      - unknown
condition: []
action:
  - service: button.press
    data: {}
    target:
      entity_id: >-
        {{ trigger.entity_id | replace("node_status", "ping") | replace("sensor.", "button.") }}
      # Make sure all of your ping entities have the same root Device name
      # e.g. sensor.kitchen_sink_light_node_status and button.kitchen_sink_light_ping
mode: parallel
2 Likes

I know this has been a while, but i tried implementing this automation and it’s throwing this error:

Error: Template rendered invalid entity IDs

all my z wave sensors are named"sensor.node_XX_node_status" and all my ping buttons are named “button.node_36_ping” so it seems the template should work but it’s not happy about something. Have you ran into this?