Issue reading states of Z-Wave switches

Just as an additional update to my polling issue; When I go to the ‘ZWave’ tab in the WebGUI and slect the node and press ‘refresh’ the switch is correctly polled and the proper state shows up on the main page, is there any way to automate this process? I would assume that the Z-Wave polling schedule would take care of this, would it not?

All three have companion switches connected. I noticed tonight that more than one switch seems to be unreliable like this. two of the switches were on, and the state wasn’t reflected in HASS. I suppose I’ll have to set up polling to capture the state of the switches.

Like @christheradioguy, I notice if I perform a “refresh” operation, the current state is updated.

Curiously, operating the companion switch doesn’t seem to update the state in HASS, at least not reliably from the limited testing I did. I suppose I will just have to arrange to poll these things to get a reliable reflection of their state… haven’t been successful with that yet.

I wonder if my problem with polling and refreshing the value is that I have “switches” and not “lights”?

From Z-Wave - Home Assistant

refresh_value (Optional): Enable refreshing of the node value. Only the light component uses this. Defaults to False.

For what it’s worth I managed to come up with a hacky solution to update the state of the switches. I added an entry to my crontab to run a CURL command to use the API to call the refresh_node command. Here’s the CURL command if anyone’s interested:

curl -X POST -H “Content-Type: application/json” -d ‘{“node_id”: “3”}’ https://localhost:8123/api/services/zwave/refresh_node -k

rise and repeat for each node. Seems to work for dimmers (lights) as well as switches.

1 Like

@christheradioguy, I did something similar to what you suggested, but inside of HASS. I created a script that does:

rescan_zwave:
  alias: Refresh zwave
  sequence:
    - alias: refresh zwave 6
      service: zwave.refresh_node
      data:
        node_id: 6
    - alias: refresh zwave 7
      service: zwave.refresh_node
      data:
        node_id: 7
    - alias: refresh zwave 8
      service: zwave.refresh_node
      data:
        node_id: 8

and then wrote an automation to call it every 5 minutes:

- alias: zwave refresher
  trigger:
    - platform: time
      minutes: "/5"
      seconds: 00
  action:
    - service: script.rescan_zwave

This seems crude, yet unsatisfying. There appears to be some sort of refresh capability inside of HASS, but I’ve not been able to make it work. I didn’t investigate if there was a way to do all of the zwave devices as I don’t want to bang on my zwave door lock since it’s battery powered. I’ve had no problem getting state change messages from it since day 1.

1 Like

Ack. These sorts of tricks are horrible! And will cause scalability issues as you grow your zwave networks.

I realize this, but not sure what other options I have… It’s kinda important to know the states of my switches and HomeAssistant doesn’t seem to read the state of the switch when set to poll via the ZWave options.

Ovbiously going forward I can ensure I buy 100% compatible ZWave switches, but not sure what I can do with my existing 3 switches.

Open to better solutions…

Same boat here, all my other ZWave devices (lock, thermostats) all update their state automatically. Just these damn switches and dimmers which are a pain.

Did you set polling_interval for these 3 switches? By default polling_interval is 0 so they won’t poll.

I don’t seem to be able to get polling to work. I tried setting this up on the zwave configuration tab, which results in stuff getting put in the config/zwave_device_config.yaml file like:

lock.schlage_be469nxcen_touchscreen_deadbolt_locked_2_0:
  ignored: false
  polling_intensity: 0
zwave.lr_inner_lights:
  ignored: false
  polling_intensity: 1
switch.lr_inner_lights_switch:
  ignored: false
  polling_intensity: 1
zwave.lr_center_lights:
  ignored: false
  polling_intensity: 1
zwave.lr_outer_lights:
  ignored: false
  polling_intensity: 1
switch.lr_center_lights_switch:
  ignored: false
  polling_intensity: 1
switch.lr_outer_lights_switch:
  ignored: false
  polling_intensity: 1

And I set

 polling_interval: 30000

in configuration.yaml, but didn’t see evidence of polling in OWZ_Log.txt. Then I did the script and automation to poke at it, and I see all the activity. I would like to think that the polling would be lighter weight than the “refresh_node” operation which seems to do multiple pokes the devices, at least based on what I see in the (ever growing!) OWZ_Log.txt file.

I tried adding a customize: section to the zwave: configuration as I saw suggested elsewhere here and putting the polling_intensity stuff in there, but that wasn’t accepted.

Here is what I have, works perfectly and I can see the polling data in OZW_log.txt every 30 seconds only for the nodes requested. Not sure if this matters or not, but I am running 0.49

zwave:
  usb_path: /dev/ttyACM0
  config_path: /srv/homeassistant/src/open-zwave-control-panel/config
  network_key: "*******************************"
  new_entity_ids: true
  polling_interval: 30000
  device_config:
    switch.porch_light_switch:
      polling_intensity: 1
    switch.garage_light_switch:
      polling_intensity: 1
1 Like

Thanks for the suggestion, I did not have polling_intensitity set in the configuration.yamal file, rather I was setting in via the ZWave control panel in the GUI I’ll give this a try and see if it makes a difference.

@christheradioguy The Leviton switches should support instant status (even the non ZWP ones) without polling. I have some ancient ones that have support for it (Leviton calls it “hail”). Maybe one of the configuration values in the switch got inadvertently set to a different mode?

where would you check for these values, on HA zwave control panel or OZW?

It gets passed from ozw to HA so both control panels should be able to detect it. There is a parameter section in HA that allows you to configure the parameters.

This is all assuming that OZW has a fully detailed XML file for your device. If there is no detailed XML file, neither will know what parameter does what.

I’ll have a look through the switch’s manual for anything called ‘hail’ but it doesn’t ring a bell.

OZW is passing status on a manual switch event. It’s not getting handled by HA.

DEBUG:libopenzwave:notif_callback : new notification
DEBUG:libopenzwave:notif_callback : Notification type : 26, nodeId : 2
DEBUG:libopenzwave:notif_callback : call callback context
DEBUG:openzwave:zwcallback args=[{‘notificationType’: ‘Notification’, ‘notificationCode’: 1, ‘homeId’: 25503801, ‘nodeId’: 2}]
DEBUG:openzwave:Z-Wave Notification : {‘notificationType’: ‘Notification’, ‘notificationCode’: 1, ‘homeId’: 25503801, ‘nodeId’: 2}
DEBUG:libopenzwave:notif_callback : end
DEBUG:libopenzwave:notif_callback : new notification
DEBUG:libopenzwave:notif_callback : Notification type : 22, nodeId : 2
DEBUG:libopenzwave:notif_callback : call callback context
DEBUG:openzwave:zwcallback args=[{‘notificationType’: ‘NodeQueriesComplete’, ‘homeId’: 25503801, ‘nodeId’: 2}]
DEBUG:openzwave:Z-Wave Notification NodeQueriesComplete : {‘notificationType’: ‘NodeQueriesComplete’, ‘homeId’: 25503801, ‘nodeId’: 2}
DEBUG:openzwave:Z-Wave Notification Node : home_id: [0x01852839] id: [2] name: [] model: [Unknown: type=1c02, id=0334]
DEBUG:libopenzwave:notif_callback : end

I made some slight progress. I added the following XML file to OZW config.

Now I am getting info from HA Core on an event but still no state change.

DEBUG:libopenzwave:notif_callback : new notification
DEBUG:libopenzwave:notif_callback : Notification type : 26, nodeId : 2
DEBUG:libopenzwave:notif_callback : call callback context
DEBUG:openzwave:zwcallback args=[{‘notificationType’: ‘Notification’, ‘notificationCode’: 1, ‘nodeId’: 2, ‘homeId’: 25503801}]
DEBUG:openzwave:Z-Wave Notification : {‘notificationType’: ‘Notification’, ‘notificationCode’: 1, ‘nodeId’: 2, ‘homeId’: 25503801}
DEBUG:libopenzwave:notif_callback : end
DEBUG:libopenzwave:notif_callback : new notification
DEBUG:libopenzwave:notif_callback : Notification type : 22, nodeId : 2
DEBUG:libopenzwave:notif_callback : call callback context
DEBUG:openzwave:zwcallback args=[{‘notificationType’: ‘NodeQueriesComplete’, ‘nodeId’: 2, ‘homeId’: 25503801}]
DEBUG:openzwave:Z-Wave Notification NodeQueriesComplete : {‘notificationType’: ‘NodeQueriesComplete’, ‘nodeId’: 2, ‘homeId’: 25503801}
DEBUG:openzwave:Z-Wave Notification Node : home_id: [0x01852839] id: [2] name: [] model: [Unknown: type=1c02, id=0334]
DEBUG:libopenzwave:notif_callback : end
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=zwave.leviton_unknown_type1c02_id0334, new_state=<state zwave.leviton_unknown_type1c02_id0334=Ready; lastResponseRTT=24, averageRequestRTT=17, receivedCnt=9, manufacturer_name=Leviton, averageResponseRTT=24, friendly_name=Leviton Unknown: type=1c02, id=0334, product_name=Unknown: type=1c02, id=0334, new_entity_id=zwave.leviton_unknown_type1c02_id0334, node_id=2, is_ready=True, is_failed=False, receivedDups=0, retries=0, neighbors={1, 3}, query_stage=Complete, lastRequestRTT=17, receivedTS=2017-09-07 13:12:16:205 , node_name=Leviton Unknown: type=1c02, id=0334, sentTS=2017-09-07 13:12:16:180 , sentCnt=13, sentFailed=0, max_baud_rate=40000, is_info_received=True, is_awake=True, is_zwave_plus=False, old_entity_id=zwave.leviton_unknown_type1c02_id0334_2, receivedUnsolicited=0, capabilities={‘listening’, ‘routing’, ‘beaming’} @ 2017-09-07T13:06:51.641287-04:00>, old_state=<state zwave.leviton_unknown_type1c02_id0334=Ready; lastResponseRTT=25, averageRequestRTT=18, receivedCnt=8, manufacturer_name=Leviton, averageResponseRTT=25, friendly_name=Leviton Unknown: type=1c02, id=0334, product_name=Unknown: type=1c02, id=0334, new_entity_id=zwave.leviton_unknown_type1c02_id0334, node_id=2, is_ready=True, is_failed=False, receivedDups=0, retries=0, neighbors={1, 3}, query_stage=Complete, lastRequestRTT=18, receivedTS=2017-09-07 13:08:08:744 , node_name=Leviton Unknown: type=1c02, id=0334, sentTS=2017-09-07 13:08:08:719 , sentCnt=12, sentFailed=0, max_baud_rate=40000, is_info_received=True, is_awake=True, is_zwave_plus=False, old_entity_id=zwave.leviton_unknown_type1c02_id0334_2, receivedUnsolicited=0, capabilities={‘listening’, ‘routing’, ‘beaming’} @ 2017-09-07T13:06:51.641287-04:00>>
DEBUG:homeassistant.components.websocket_api:WS 1713408080: Sending {‘type’: ‘event’, ‘id’: 2, ‘event’: {‘time_fired’: datetime.datetime(2017, 9, 7, 17, 12, 26, 291645, tzinfo=), ‘event_type’: ‘state_changed’, ‘origin’: ‘LOCAL’, ‘data’: {‘entity_id’: ‘zwave.leviton_unknown_type1c02_id0334’, ‘old_state’: <state zwave.leviton_unknown_type1c02_id0334=Ready; lastResponseRTT=25, averageRequestRTT=18, receivedCnt=8, manufacturer_name=Leviton, averageResponseRTT=25, friendly_name=Leviton Unknown: type=1c02, id=0334, product_name=Unknown: type=1c02, id=0334, new_entity_id=zwave.leviton_unknown_type1c02_id0334, node_id=2, is_ready=True, is_failed=False, receivedDups=0, retries=0, neighbors={1, 3}, query_stage=Complete, lastRequestRTT=18, receivedTS=2017-09-07 13:08:08:744 , node_name=Leviton Unknown: type=1c02, id=0334, sentTS=2017-09-07 13:08:08:719 , sentCnt=12, sentFailed=0, max_baud_rate=40000, is_info_received=True, is_awake=True, is_zwave_plus=False, old_entity_id=zwave.leviton_unknown_type1c02_id0334_2, receivedUnsolicited=0, capabilities={‘listening’, ‘routing’, ‘beaming’} @ 2017-09-07T13:06:51.641287-04:00>, ‘new_state’: <state zwave.leviton_unknown_type1c02_id0334=Ready; lastResponseRTT=24, averageRequestRTT=17, receivedCnt=9, manufacturer_name=Leviton, averageResponseRTT=24, friendly_name=Leviton Unknown: type=1c02, id=0334, product_name=Unknown: type=1c02, id=0334, new_entity_id=zwave.leviton_unknown_type1c02_id0334, node_id=2, is_ready=True, is_failed=False, receivedDups=0, retries=0, neighbors={1, 3}, query_stage=Complete, lastRequestRTT=17, receivedTS=2017-09-07 13:12:16:205 , node_name=Leviton Unknown: type=1c02, id=0334, sentTS=2017-09-07 13:12:16:180 , sentCnt=13, sentFailed=0, max_baud_rate=40000, is_info_received=True, is_awake=True, is_zwave_plus=False, old_entity_id=zwave.leviton_unknown_type1c02_id0334_2, receivedUnsolicited=0, capabilities={‘listening’, ‘routing’, ‘beaming’} @ 2017-09-07T13:06:51.641287-04:00>}}}

I finally gave up trying to get polling to work by setting things in the zwave: settings - I solved things using the solution @lmamakos provided. Feels really, really hacky. But it works. :man_shrugging:

Anything obvious I’m not doing right here?

zwave:
  usb_path: /dev/ttyACM0
  network_key: !secret ZWAVE_KEY
  polling_interval: 60000
  # polling to fix the 3/4-way lights not refreshing
  # correctly when operated from their remotes
  device_config:
    light.tv_room_light:
      polling_intensity: 1
      refresh_value: true
    light.stairway_light:
      polling_intensity: 1
      refresh_value: true