Hi,
I’m new to hassbian and zwave. I have hassbian setup on raspberry pi with an AOTEC z-stick gen5. I have been fairly successful at incorporating pws weather, dte energy bridge, 3 cameras, and the speedtest component into HA.
However, trying to add a binary sensor has been frustrating.
I have a monoprice door/window sensor connected to the zwave stick.
I have it associated in group 1,
I show two entities in dev-state -
binary_sensor.frontdoor_sensor_2 off friendly_name: frontdoor_sensor
device_class: opening
I can watch the OZW log update in real time as I open and close the magnet sensor.
However, the states of the icon(s) I have displayed never change.
The only way I can change the state of the icons for sensors is to manually change the entity state in dev-state.
I have this in my configuration file,
binary_sensor:
I think your problem may be your association, if I understand how ZW works I think it will use the association independantly of HA and so not report it to HA, if it isn’t associated it will report to HA and you can use it in automations etc., however my understanding may be faulty
Can you explain what you mean by association? I come from the IT/RF world, association can mean to me the association of the door sensors to the zstick, which I believe is necessary for proper operation, or some association to have - which is not something I am familiar with.
I think if this were anything other than group 1 it would not report to HA but directly control another device in that group. So you should be OK as far as the group is concerned.
Your entity_id’s look OK, do the sensors change in the state table when activated?
The above has an extra ‘y’ in it :), dunno if that’s all of your problem but it won’t help.
If they don’t change in the dev state table then I would probably remove the node and re-add it as something has gone wrong - these aren’t battery devices are they?
Yes, there was an extra ‘y’, can’t even blame that on autocorrect :).
This is a battery powered magnetic reed switch zwave sensor, A Hank HKZW-DS01 equivalent. The only time it wakes up is when the magnet moves or the ‘burglar’ switch is activated. It will send data to the zstick and checking the OZW_Log reveals the value changes from 22 to 23 and back again when the sensor is open/closed. I don’t know of a way to poll the sensor as it is in sleep state unless activated.
I removed the sensor and re-added it into HA, I get this in dev-state:
binary_sensor.frontdoor off friendly_name: Front-Door ClosedStatus
value_id: 72057594093240320
new_entity_id: binary_sensor.frontdoor_closedstatus
value_index: 0
node_id: 3
old_entity_id: binary_sensor.frontdoor_closedstatus_3_0
value_instance: 1
I display the sensor in the default view:
default_view:
name: Home
view: yes
icon: mdi:home
entities:
- sun.sun
- switch.switch
- binary_sensor.frontdoor
# - binary_sensor.frontdoor_sensor
- group.speedtest
- group.weather
- sensor.6150_leix_energy_bridge
- group.doors
- updater.updater
And still the state icon still only shows the state in dev-state. And dev-state never changes with the sensor.
Change the state manually in dev-state and the icon reflects it.
It’s like the zwave is decoupled from the frontend for this sensor.
Or do I have to template a binary sensor that compares the value 22 or 23 and base the state on that?
The full project will include about 7 of these door/window sensors in a group and if any one of them is open for a certain length of time, it will de-activate my switch. Closing all the sensors will activate the switch.
But I need to get the binary sensors working with current state output.
I added a Linear FS20Z Isolated Contact Fixture Module to my zwave network in order to check and ensure my zstick was working with HA and I was able to add the switch painlessly and control it from the HA interface with no problem.
Strange it clearly states the NEW id and yet you are still displaying it in the frontend as binary_sensor.frontdoor, so that’s not gonna help matters, also as you have discovered the value for the sensor is 22/23 for open/closed not ‘on’/‘off’, so why you have still got a check for state ‘on’ I have no clue. It seems to me you seem to be basing everything off the friendly name , however the friendly name is ONLY used by the frontend to display the sensor, it’s NOT used for anything else. If you check the state of the real sensor in the dev state table (binary_sensor.frontdoor_closedstatus) what does it say when you open/close the door/sensor?
Here’s the reasoning:
Nowhere in the dev state table is any entity named binary_sensor.frontdoor_closedstatus.
Binary_sensor.frontdoor is all that there is.
My other zwave device shows up in dev state as
switch.switch with an on/off switch I can click to activate it which it does. BUT, the attributes column shows
new_entity_id: switch.linear_fs20z_isolated_contact_fixture_module_accontrol
node_id: 4
value_instance: 1
value_index: 0
value_id: 72057594109837312
old_entity_id: switch.linear_fs20z_isolated_contact_fixture_module_accontrol_4_0
friendly_name: Linear FS20Z Isolated Contact Fixture Module AC-Control
This is why I display binary_sensor.frontdoor
I have tried to display binary_sensor.frontdoor_closedstatus and nothing displays for that sensor.
Well folks, I know you all have been waiting with baited breath. I finally have all my Hank HKZW-DS01 door/window sensors working and here’s what I had to do to finally get it all working.
First, I am running hassbian 0.63.1 . A lot of the issues I had were with trying to add the sensors and have them show up in dev-state, even though they were in the zwave node config and you could tail the OZWLog.txt and see for certain that the sensors were in fact in operation and state values were changing.
I had one sensor that reliably showed up in dev-state and two others were configured and operating but NOT showing up in dev-state.
The process I ended up using went like this:
Add a secure node in zwave config by clicking the controller Add Secure node and then quickly put the sensor in secure association mode by holding the “Z-button” down for 3 seconds, or more reliably, observe the
output of tail -f /home/homeassistant/.homeassistant/OZWLog.txt and release the button after observing the node add process in the log.
Now you wait a while for the controller to finish adding the node, watch the log and make a determination when the process is done.
Next you select Node management and select the new node which probably just has a name of , say Node 22: Complete . ( The node should say complete, if not, rinse and repeat…)
We now have a new node included in the zwave network, it will just need a unique name because there’s a handful more to get working just like it. After selecting the new node, I refreshed the node, maybe not necessary but gave me a log entry that I was talking to the right node.
At this point, I just typed in the new name of the sensor, eg. frontdoor, and then I clicked Save Config under Network management.
I will bet at this point that your newly added and renamed device never shows up in dev-state. No matter how many times you restart or reboot. Be not Afraid, the sensor is working fine, you know because the logs say so.
If you’re fortunate enough to have a working sensor to compare with, when you drop down the selector for node management, you’ll see something like Node5 CachedLode for the working node and Node6 Probe for the newly added, frustratingly missing from dev-state table node you added and renamed.
The zwcfg_0xd3a76624.xml I have in my .homeassistant directory holds the answer.
Stop the homeassistant service and edit the zwcfg_0xd3a76624.xml file.
You will find that each node starts with a line like:
Node id=“13” name=“frontdoor” location="" basic=“4” generic=“7” specific=“1” roletype=“6” devicetype=“3072” nodetype=“0” type=“Notification Sensor” listening=“false” frequentListening=“false” beaming=“true” routing=“true” max_baud_rate=“40000” version=“4” secured=“true” query_stage=“CacheLoad”
Manufacturer id=“208” name=“Hank”
The nodes that don’t show up in dev-state will have one difference:
Node id=“13” name=“frontdoor” location="" basic=“4” generic=“7” specific=“1” roletype=“6” devicetype=“3072” nodetype=“0” type=“Notification Sensor” listening=“false” frequentListening=“false” beaming=“true” routing=“true” max_baud_rate=“40000” version=“4” secured=“true” query_stage=“Probe”
Manufacturer id=“208” name=“Hank”
I found that if I changed the value of query_stage=“Probe” to query_stage=“CacheLoad”, saved the file and restarted homeassistant that after all the devices have been queried and loaded, the edited node now shows in dev-state table and the node is now listed in entity_registry.yaml and I can edit the names and descriptions in entity_registry and have those changes reflected throughout HA.
The second part of the equation is that even though there is a binary_sensor discovered as an entity of these sensors, the only entity that monitors the door switch is labeled access_control. With a value of 22 or 23.
By following the instructions found at https://home-assistant.io/docs/z-wave/entities/#access-control-entity
and creating a template binary sensor as below I can get current status displaying in the front end.
binary_sensor:
- platform: template
sensors:
YOUR_SENSOR:
friendly_name: “Friendly name here”
value_template: >-
{%- if is_state(‘sensor.YOUR_ORIGINAL_SENSOR_access_control’, ‘22’) -%}
true
{%- else -%}
false
{%- endif -%}
Sooo… now the only thing left is to create a trigger for when any door/window is open for 5 minutes to open a switch on the network.