Home Assistant Community

Manual state polling

Tags: #<Tag:0x00007f374deba650>

I made the unfortunate choice to outfit my house in GE z-wave switches before I fully understood the “instant update” feature (or lack thereof) of these devices.

I’ve since learned that polling is not a good substitute for updates, because even at slow rates, the risk of communication failures leading to the device being marked “dead” is too high - as in, inevitable within a few days, if not a few hours.

If I do not do polling, the devices will stay operable more or less indefinitely.

What I’d really like is a way to fire off a poll of the states manually, so it only happens when I need it. There doesn’t appear to be any way to do this. How hard would it be to add?



I wanted to post a reply here in case any other people like me eventually made it to this post. I have a sensor over Z-Wave that I do not want to read continuously, only when I apply voltage using a relay. The device also lacks the “instant update” or what is referred to as the HAIL method. Still, I knew that the device supported the BASIC command set, including sending a GET command to the sensor.

The solution: Refresh Entity. I created a script that called the zwave.refresh_entity service on the specific sensor entity I wanted a value from. This did exactly what I wanted, sent a Get command to the sensor, which very shortly after pushed a value to the Controller/HASS.

Here’s the OZW log of the event playing out.

2019-04-15 12:23:27.019 Info, mgr,     Refreshing node 2: COMMAND_CLASS_SENSOR_MULTILEVEL index = 2 instance = 1 (to confirm a reported change)
2019-04-15 12:23:27.019 Detail, Node002, Queuing (Send) SensorMultilevelCmd_Get (Node=2): 0x01, 0x09, 0x00, 0x13, 0x02, 0x02, 0x31, 0x04, 0x25, 0x15, 0xe0
2019-04-15 12:23:27.020 Detail,
2019-04-15 12:23:27.020 Info, Node002, Sending (Send) message (Callback ID=0x15, Expected Reply=0x04) - SensorMultilevelCmd_Get (Node=2): 0x01, 0x09, 0x00, 0x13, 0x02, 0x02, 0x31, 0x04, 0x25, 0x15, 0xe0
2019-04-15 12:23:27.027 Detail, Node002,   Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
2019-04-15 12:23:27.027 Detail, Node002,   ZW_SEND_DATA delivered to Z-Wave stack
2019-04-15 12:23:27.043 Detail, Node002,   Received: 0x01, 0x05, 0x00, 0x13, 0x15, 0x00, 0xfc
2019-04-15 12:23:27.043 Detail, Node002,   ZW_SEND_DATA Request with callback ID 0x15 received (expected 0x15)
2019-04-15 12:23:27.043 Info, Node002, Request RTT 22 Average Request RTT 22
2019-04-15 12:23:27.043 Detail,   Expected callbackId was received
2019-04-15 12:23:27.053 Detail, Node002,   Received: 0x01, 0x0c, 0x00, 0x04, 0x00, 0x02, 0x06, 0x31, 0x05, 0x02, 0x0a, 0x0b, 0x12, 0xd6
2019-04-15 12:23:27.053 Detail,
2019-04-15 12:23:27.053 Info, Node002, Response RTT 33 Average Response RTT 33
2019-04-15 12:23:27.054 Info, Node002, Received SensorMultiLevel report from node 2, instance 1, General: value=2834
2019-04-15 12:23:27.054 Detail, Node002, Refreshed Value: old value=2834, new value=2834, type=decimal
2019-04-15 12:23:27.054 Detail, Node002, Changes to this value are not verified
2019-04-15 12:23:27.054 Detail, Node002,   Expected reply and command class was received
2019-04-15 12:23:27.054 Detail, Node002,   Message transaction complete
2019-04-15 12:23:27.054 Detail,
2019-04-15 12:23:27.054 Detail, Node002, Removing current message
2019-04-15 12:23:27.054 Detail, Node002, Notification: ValueChanged

Here is my script as an example:

[email protected]:~/.homeassistant $ cat scripts.yaml
  alias: Read Propane Sensor
  - data:
      entity_id: switch.fortrezz_mimolite_switch
    service: switch.turn_on
  - delay: 00:00:02
  - data:
      entity_id: sensor.fortrezz_mimolite_general
    service: zwave.refresh_entity

So, to recap, just call the refresh_entity service on the sensor you want to read. For some reason in HA, you cannot select the entity (only the node) using the dropdown box when using the refresh_entitty service selector. So you’ll have to copy/paste or type in the entity ID. I think this is a bug.