Just wiped out my ZWave stick and updated to ZWave JS. Got everything back working after excluding and including. Now, my devices don’t always update their state. In the old setup, there was a variable I could set to poll these every so often. How can I accomplish this with ZWave JS?
Unless you’re running zwavejs2mqtt
you have to setup an automation, or replace these old zwave devices with ones that regularly report their status.
How difficult is migrating now to zwavejs2mqtt?
Definitely won’t replace the devices due to amount of effort and cost. Do you also have a link to the automation I’d need to setup?
Thanks for the help!
How to switch is in the docs.
No I don’t have an example of an automation for that but you’d be using the zwave_js.refresh_value
service call.
Here’s the automation I use. I replicate it for each device I need using sed. Runs every 10 minutes and at home assistant start with a random delay to prevent polls for all devices hitting at the same time.
- id: "switch_1 poll switch state"
alias: switch_1 poll switch state
description: "Automation to periodically poll switches"
trigger:
- platform: time_pattern
minutes: "/10"
- platform: homeassistant
event: start
action:
- delay:
seconds: "{{ range(0, 60)|random|int }}"
- service: zwave_js.refresh_value
data:
entity_id: switch.switch_1
Example script
#/bin/bash -xv
TARGET="/mnt/c/github/ha_config”
generic_switch_template()
# ENTITY_ID to refresh
# Output file
{
sed "s/switch.switch_1/$1/g" generic_switch_template_refresh_automation.yaml | sed "s/switch_1/$2/g" > $TARGET/automation/$3
}
generic_switch_template switch.hvac_uv hvac_uv generic_switch_template_refresh_hvac_uv_automation.yaml
generic_switch_template switch.newwell newwell generic_switch_template_refresh_newwell_automation.yaml
generic_switch_template switch.oldwell oldwell generic_switch_template_refresh_oldwell_automation.yaml
generic_switch_template switch.outdoor_switch outdoor_switch generic_switch_template_refresh_outdoor_switch_automation.yaml
generic_switch_template switch.switch_1_switch switch_1 generic_switch_template_refresh_switch_1_automation.yaml
generic_switch_template switch.switch_2_switch switch_2 generic_switch_template_refresh_switch_2_automation.yaml
generic_switch_template switch.switch_3_switch switch_3 generic_switch_template_refresh_switch_3_automation.yaml
generic_switch_template switch.water_softener water_softener generic_switch_template_refresh_water_softener_switch_automation.yaml
And what if I am indeed running zwavejs2mqtt? How can I get Zwave JS+zwavejs2mqtt to update state of devices?
In zwavejs2mqtt go to Settings → General
-
You’ll see a
Devices values configuration
table with a button that saysNew Value
click that. -
Select your device that needs polling and the value you’d like to refresh, likely
Current value
. -
Then enable the
Poll
toggle and enter the amount of seconds to poll, then press theAdd
button.
This one setting will poll ALL the devices of the same type for you.