Monitoring the state of the qt-openzwave daemon and detecting dead nodes

The new qt-openzwave integration lacks sensors to monitor the status of the daemon, obtain the version of the running daemon, and dead nodes can’t be detected. This can be fixed via some mqtt sensors.

sensor:
  - platform: mqtt
    name: "Zwave Status"
    state_topic: "OpenZWave/1/status/"
    value_template: "{{value_json.Status}}"
    json_attributes_topic: "OpenZWave/1/status/"

  - platform: mqtt
    name: "Zwave Node Event"
    state_topic: "OpenZWave/1/event/notification/"
    value_template: "{{value_json.Event}}"
    json_attributes_topic: "OpenZWave/1/event/notification/"

The Zwave Status sensor values are described here.

Some example automations for the sensor… One notifies upon daemon crash, the other restarts homeassistant when qt-openzwave daemon fully restarts.

automation:
  - alias: 'Zwave Offline Notifier'
    trigger:
      - platform: state
        entity_id: sensor.zwave_status
        to: 'Offline'
    action:
      service: notify.text
      data_template:
        message: "Zwave Daemon is down!"
        data:
          tag: 'zwavedown'

  - alias: 'Zwave Reboot'
    trigger:
      - platform: state
        entity_id: sensor.zwave_status
        from: 'driverReady'
        to: 'driverAllNodesQueried'
    action:
      - service: notify.mobile_app_moto_g_5_plus
        data_template:
          message: "Zwave Daemon is up!  Homeassistant will restart!"
          data:
            tag: 'zwaveup'
      - delay : 00:05:00
      - service: homeassistant.restart

The Zwave Node Event sensor is going to generate lots of DB entries depending on the number of battery operated devices and how often they awake. It may be advisable to exclude it from history.

Here is an automation to notify upon the discovery of a dead node. (MQTT state and attributes cannot update within a sensor simultaneously so the automation only uses attribute data to avoid that race condition.)

automation:
  - alias: Zwave Dead Node Notifier
    trigger:
      - platform: template
        value_template: "{{is_state_attr('sensor.zwave_node_event', 'Event', 'Notification_Code_NodeDead')}}"
    action:
      - service: notify.email
        data_template:
          title: "Node {{states.sensor.zwave_node_event.attributes.Node}} is dead!"
          message: "Please Check or Fix!"
2 Likes

I wouldn’t expect HA to need a restart when ozwdaemon comes back online. That sounds like a bug of sorts - Maybe worth logging a issue?

You’re posting incorrect yaml. Please make sure the format is correct when posting a guide.

Others will come here for this and have issues copy/pasting.

There is an issue open for it, but I am not sure if anyone else can duplicate.