Zwave_js.refresh_value vs ping

My log shows this:

Logger: homeassistant.components.zwave_js.services
Source: components/zwave_js/services.py:769
This service is deprecated in favor of the ping button entity. Service calls will still work for now but the service will be removed in a future release

However, I do use this because the Philio PAN04 zwave switch does actively report its status. This is an example part of my code:

      - service: zwave_js.refresh_value
        data:
          entity_id:
            - switch.light_toilet
            - switch.fan_living_speed_1
            - switch.fan_living_speed_2
      - delay: "00:00:01"
      - condition: state
        entity_id: switch.fan_living_speed_2
        state: 'off'

Does this mean I have to replace it with something like this?

      - service: zwave_js.ping
        data:
          entity_id:
            - switch.light_toilet
            - switch.fan_living_speed_1
            - switch.fan_living_speed_2
      - delay: "00:00:01"
      - condition: state
        entity_id: switch.fan_living_speed_2
        state: 'off'

Yes or you can use the button entities with the button.press service.

Seems not. Experimented with this. service: zwave_js.ping is still a member of service: zwave_js and that seems to get removed. I should use the ping button now. Code to call that is like:

service: button.press
target:
  entity_id: button.ventilator_toilet_ping
data: {}

not sure if I can call mutiple entities here in one call. Also notice that this is a refresh on device level instead of entity level. This means that a ping will refresh all enitites for the device, generating probably much more traffic than the old service call.

I do not understand why these breaking changes are made so often…

This change was made almost 2 years ago.

entity_id in target, at the root level of the service call, and inside service data always accepts a list of entities.

How do I modify my watcher that pings nodes that seems dead:

    alias: Act on failed Zwave Nodes
    description: ''
    trigger:
    - platform: state
      entity_id: sensor.failed_zwave
    action:
    - delay: '00:02:00'
    - condition: template
      value_template: >
        {{ 
          states.sensor.failed_zwave.state != "[]" and 
          states.sensor.failed_zwave.state != "unknown"
        }}
    - service: zwave_js.ping
      target:
        entity_id: '{{ states.sensor.failed_zwave.state }}'
    - service: logbook.log
      data:
        name: Dead node ping
        message: 'The following nodes have been pinged {{ states.sensor.failed_zwave.state }}'
    - delay: '00:01:00'
    mode: single

You’ll have to share what sensor.failed_zwave is outputting as the state.

This is the sensor:

template:
  sensor:
      - unique_id: Failed-Zwave-Sensor
        name: failed_zwave
        icon: mdi:texture
        state: >
            {{ states | selectattr("entity_id", "search", "node_status") |
              selectattr('state', 'in', 'dead, unavailable, unknown') |
              map(attribute='entity_id') | list 
            }}

it has a list of entity Id’s (but not the id’s of the ping button attached to the device)

You’ll run into issues with that old template and the state character limit, you should be using an attribute.

As for the changes to make this happen, use this template…

template:
  sensor:
      - unique_id: Failed-Zwave-Sensor
        name: failed_zwave
        icon: mdi:clock
        state:>
            {{ integration_entities('zwave_js') 
                | select('search', 'node_status')
                | select('is_state', ['dead', 'unknown', 'unavailable'])
                | list | count }}
        attributes:
          dead: >
            {{ integration_entities('zwave_js') 
                | select('search', 'node_status')
                | select('is_state', ['dead', 'unknown', 'unavailable'])
                | map('device_id')
                | map('device_entities')
                | sum(start=[])
                | select('search', '^button')
                | select('search','ping') | list }}

And then your automation will be…

    alias: Act on failed Zwave Nodes
    description: ''
    trigger:
    - platform: state
      entity_id: sensor.failed_zwave
    condition:
    - platform: template
      value_template: "{{ trigger.to_state.state | int > 0 }}"
    action:
    - service: button.press
      target:
        entity_id: '{{ trigger.to_state.attributes.dead }}'
    - service: logbook.log
      data:
        name: Dead node ping
        message: The following devices have been pinged {{ trigger.to_state.attributes.dead  | map('device_attr','name') | list | join(',') }}
    mode: single

Thanks a lot!

Here’s how I updated my z-wave ping :

- id: 'mains_power_plug_ping'
  alias: mains power ping power plug
  description: Ping Z-Wave power plug every minute
  trigger:
  - platform: time_pattern
    minutes: "/1"
  condition: []
  action:
  - service: button.press
    target:
      entity_id: button.heater_ping
    data: {}
  mode: single