Z-Wave
The Z-Wave integration connects Home Assistant to your Z-Wave network, through Z-Wave JS. Every Z-Wave device is a device in Home Assistant, with its entities.
A Z-Wave network needs some upkeep now and then. When you move a device, or add a few, the routes the messages take through the mesh get stale: rebuild them. When Z-Wave JS gets a newer configuration file for a device, some of what it knows about that device is stale until the device is asked again: re-interview it. Home Assistant raises a repair that tells you to do that.
Home Assistant has all of this, but only as buttons: on a device page, and on the Z-Wave settings page. An automation cannot press them, not early every Sunday morning, and not for every device in a room at once.
Spook adds three actions for that: rebuild the routes of devices, rebuild the routes of the whole network, and re-interview devices.
Actions
Spook adds three actions to the Z-Wave integration. You find them wherever you add an action, marked with a 👻. All three are for administrators only, as the buttons in Home Assistant are.
Rebuild device routes
Rebuilds the routes of one or more Z-Wave devices, like Rebuild routes on a device page.
One device at a time, sorted by node ID, and each rebuild finished before the next one starts. A Z-Wave network is one radio: a rebuild keeps it busy, and two at the same time would only get in each other's way. The action waits until the last one is done.
Pick the devices, their entities, or areas that hold them, like Z-Wave's own actions take them. An entity or a device of another integration is passed over, so an area with a mix of devices is fine. A target without a single Z-Wave device is refused with an error.
One device failing does not stop the rest. What happens next depends on whether you ask for the response:
- With a response variable, nothing is raised. The response lists the devices that were rebuilt, and the ones that failed and why. Check it in your automation.
- Without one, nobody would see a failure. So once every device had its turn, the action fails with an error that names each device that failed, and why.
How to use it
- Open the automation or script that should rebuild the routes, and select Add action.
- Search for rebuild device routes, and select Z-Wave: Rebuild device routes 👻.
- Choose the devices, the entities or the areas.
- Select Save.
| Action properties | |
|---|---|
| Action | Z-Wave: Rebuild device routes 👻 |
| Action name | zwave_js.rebuild_node_routes |
| Action targets | Z-Wave devices, entities and areas |
| Action response | Optional, the devices that were rebuilt and the ones that failed |
| Spook's influence | Newly added action |
| Tools | Try this action |
| Action data parameters | |||
|---|---|---|---|
| Attribute | Type | Required | Default / Example |
device_id | string or list | No | 8f4219cfa57e23f6f669c4616c2205e2 |
entity_id | string or list | No | sensor.front_door_node_status |
area_id | string or list | No | living_room |
Give at least one of them. They work under target too.
The response:
| Attribute | Type | Description |
|---|---|---|
rebuilt | list | The devices whose routes were rebuilt, in the order they were done. |
rebuilt[].device_id | string or null | The device in Home Assistant. null when Home Assistant has no device for it. |
rebuilt[].node_id | integer | The node ID of the device in the Z-Wave network. |
rebuilt[].name | string | The name of the device, the one you gave it first. |
failed | list | The devices whose routes could not be rebuilt, with the same three attributes. |
failed[].error | string | Why it failed, as Z-Wave JS said it. |
Rebuild the routes of everything in the garden, after moving the devices out there for the summer:
action: zwave_js.rebuild_node_routes
target:
area_id: garden
The same, and a notification for the devices that failed:
actions:
- action: zwave_js.rebuild_node_routes
target:
area_id: garden
response_variable: result
- if:
- condition: template
value_template: "{{ result.failed | count > 0 }}"
then:
- action: notify.persistent_notification
data:
title: Not every route was rebuilt
message: >-
{% for failure in result.failed %}
{{ failure.name }}: {{ failure.error }}
{% endfor %}
- The action waits for every rebuild, one after the other. A long list of devices can take a while.
- A device on a battery is only reachable when it wakes up. Z-Wave JS can wait for that, and the action waits with it.
- Z-Wave JS refuses to rebuild the routes of one device while it rebuilds the whole network. That device is then listed as failed.
- Floors and labels are not taken, like with Z-Wave's own actions.
Rebuild network routes
Starts rebuilding the routes of every device in a Z-Wave network, like Rebuild under the network on the Z-Wave settings page.
It only starts the rebuild. Z-Wave JS works through the network on its own, which takes from minutes to hours, so the action does not wait for it. The Z-Wave settings page shows how far it is.
Pick the network with Network, the integration entry of your Z-Wave stick. Leave it empty to rebuild every Z-Wave network that is loaded; most homes have one. A network that is already rebuilding is fine: it is not started again, and it is no error.
An integration entry that is not Z-Wave, or a network that is not loaded, is refused with an error. When one of several networks fails to start, the others still start, and the action fails with an error that names the one that did not.
How to use it
- Open the automation or script that should rebuild the network, and select Add action.
- Search for rebuild network routes, and select Z-Wave: Rebuild network routes 👻.
- Pick the Network, or leave it empty for all of them.
- Select Save.
| Action properties | |
|---|---|
| Action | Z-Wave: Rebuild network routes 👻 |
| Action name | zwave_js.rebuild_routes |
| Action targets | No targets |
| Action response | No |
| Spook's influence | Newly added action |
| Tools | Try this action |
| Action data parameters | |||
|---|---|---|---|
| Attribute | Type | Required | Default / Example |
config_entry_id | string | No | 01JDX4K6P5W0Q3V2N8T7R9M1ZB |
Rebuild the routes of the whole network early every Sunday morning, while nobody is pressing light switches:
triggers:
- trigger: time
at: "03:00:00"
conditions:
- condition: time
weekday: sun
actions:
- action: zwave_js.rebuild_routes
- The action returns once the rebuild started. Whether every device got new routes shows on the Z-Wave settings page, not in the action.
- While the network rebuilds, Z-Wave devices can respond slower than usual. Pick a time nobody is around to notice.
Re-interview devices
Asks one or more Z-Wave devices to be interviewed again, like Re-interview on a device page. Z-Wave JS asks the device everything again: what it is, what it can do, how it is set up. Home Assistant then sets up its entities anew.
One device at a time, sorted by node ID. Each request goes out without waiting for an answer, the way Home Assistant's own repair sends it. The interview itself runs afterwards, in Z-Wave JS, so the action is done long before the interviews are.
Pick the devices, their entities, or areas that hold them, the same as for Rebuild device routes. A target without a single Z-Wave device is refused with an error.
A request that does not get out, because the connection to Z-Wave JS dropped, does not stop the rest. With a response variable, the response lists it; without one, the action fails with an error that names the devices, once every device had its turn.
How to use it
- Open the automation or script that should re-interview the devices, and select Add action.
- Search for re-interview, and select Z-Wave: Re-interview devices 👻.
- Choose the devices, the entities or the areas.
- Select Save.
| Action properties | |
|---|---|
| Action | Z-Wave: Re-interview devices 👻 |
| Action name | zwave_js.reinterview_node |
| Action targets | Z-Wave devices, entities and areas |
| Action response | Optional, the devices that were asked and the ones that failed |
| Spook's influence | Newly added action |
| Tools | Try this action |
The action data parameters are the same as for Rebuild device routes.
The response:
| Attribute | Type | Description |
|---|---|---|
started | list | The devices asked for a re-interview, in the order they were asked. |
started[].device_id | string or null | The device in Home Assistant. null when Home Assistant has no device for it. |
started[].node_id | integer | The node ID of the device in the Z-Wave network. |
started[].name | string | The name of the device, the one you gave it first. |
failed | list | The devices the request did not get out for, with the same three attributes. |
failed[].error | string | Why it failed. |
When Z-Wave JS gets a newer configuration file for a device, Home Assistant raises a repair that asks you to re-interview it. A script to do that for every Z-Wave device in the kitchen at once, to run by hand or from a button on a dashboard. A notification names the devices the request did not get out for:
alias: Re-interview the kitchen
sequence:
- action: zwave_js.reinterview_node
target:
area_id: kitchen
response_variable: result
- if:
- condition: template
value_template: "{{ result.failed | count > 0 }}"
then:
- action: persistent_notification.create
data:
title: Not every re-interview was asked for
message: >-
{% for failure in result.failed %}
{{ failure.name }}: {{ failure.error }}
{% endfor %}
- The action returns once the requests went out. Whether an interview finished, or failed, shows on the device page, not in the action.
- A device on a battery is only interviewed when it wakes up. That can be hours later. Wake it up by hand to speed it up.
- Floors and labels are not taken, like with Z-Wave's own actions.
Missing something here?
An action, an entity or a repair this integration should have? Say so. Stuck, or found a bug? There is help.
