Need help with DynamicGroup reaction for dead nodes in HAAS
-
Good morning,
Occasionally I run into an issue where a z-wave switch or receptacle becomes unresponsive. Probably 90% of the time, a simple ping will resolve the problem. In the Home Assistant community forums, someone came up with an automation to do this, however, the way they do it, they have to enter every sensor.xyz_node_status into the yaml code. I find this method very tedious, and it would force me to remember to update that particular automation every time I add, remove, or replace a device. I also like to keep all my automations in MSR, and not bog down HAAS with those tasks.I've worked with Dynamic Groups for some of my automations, but I'm by no means an expert. I also have the ZWaveJSController set up on my MSR implementation. How would I go about setting this sort of automation in MSR?
-
I do a similar thing. IMO, it's much easier and more reliable to do this through ZWaveJSController than through Home Assistant, which dumbs down and filters way too much for my liking.
Here's a DynamicGroupController config (other config included for spacing reference only) to detect dead nodes:
- id: groups enabled: true implementation: "DynamicGroupController" name: "Dynamic Group Controller" config: # This is the part you want; above is for spacing reference only. zwavejs_dead: select: - include_group: "zwavejs" filter_expression: "entity?.attributes?.zwave_device?.status == 3" group_actions: true
Oh man! Paging @DesT! It looks like fence code block formatting is broken? See above. I tried an experiment elsewhere, and it looks fine (has correct line breaks). I'm at a loss for why this block doesn't display properly. Can you look?
Screen shot of how it should be formatted here:
EDIT: The screen shot should have a line
group_actions: true
following thefilter_expression
line, with the same indent.You then create a rule where if that group is not empty (give it some time -- use the sustained for option), you send a ping to the group. You can perform an action on a group, and it will perform the action on every entity in the group...
The group has pulse output configured, 5 seconds every 3595 seconds up to 10 time, so it makes 10 attempts, one every hour, to ping/recover the dead nodes. The group empty test has the sustained for option for 300 seconds (5 minutes), which gives ZWaveJS time to recover on its own before we start poking it.
The SET reaction looks like this. RESET reaction must be completely empty.
Note the empty expression variable at the end. This allows the evaluation in the Set Variable action to put the output of the group
performAction()
function in the expression into nowhere-land (it's a junk variable to receive the expression result we don't need). -
I do a similar thing. IMO, it's much easier and more reliable to do this through ZWaveJSController than through Home Assistant, which dumbs down and filters way too much for my liking.
Here's a DynamicGroupController config (other config included for spacing reference only) to detect dead nodes:
- id: groups enabled: true implementation: "DynamicGroupController" name: "Dynamic Group Controller" config: # This is the part you want; above is for spacing reference only. zwavejs_dead: select: - include_group: "zwavejs" filter_expression: "entity?.attributes?.zwave_device?.status == 3" group_actions: true
Oh man! Paging @DesT! It looks like fence code block formatting is broken? See above. I tried an experiment elsewhere, and it looks fine (has correct line breaks). I'm at a loss for why this block doesn't display properly. Can you look?
Screen shot of how it should be formatted here:
EDIT: The screen shot should have a line
group_actions: true
following thefilter_expression
line, with the same indent.You then create a rule where if that group is not empty (give it some time -- use the sustained for option), you send a ping to the group. You can perform an action on a group, and it will perform the action on every entity in the group...
The group has pulse output configured, 5 seconds every 3595 seconds up to 10 time, so it makes 10 attempts, one every hour, to ping/recover the dead nodes. The group empty test has the sustained for option for 300 seconds (5 minutes), which gives ZWaveJS time to recover on its own before we start poking it.
The SET reaction looks like this. RESET reaction must be completely empty.
Note the empty expression variable at the end. This allows the evaluation in the Set Variable action to put the output of the group
performAction()
function in the expression into nowhere-land (it's a junk variable to receive the expression result we don't need).@toggledbits said in Need help with DynamicGroup reaction for dead nodes in HAAS:
EDIT: The screen shot should have a line group_actions: true following the filter_expression line, with the same indent.
I saw that in the block code when I was adding it to my instance. Thanks for pointing it out.
Now I'll have to watch the logging to see if it gets triggered.... that and notifications sent to my phone.
-
I do a similar thing. IMO, it's much easier and more reliable to do this through ZWaveJSController than through Home Assistant, which dumbs down and filters way too much for my liking.
Here's a DynamicGroupController config (other config included for spacing reference only) to detect dead nodes:
- id: groups enabled: true implementation: "DynamicGroupController" name: "Dynamic Group Controller" config: # This is the part you want; above is for spacing reference only. zwavejs_dead: select: - include_group: "zwavejs" filter_expression: "entity?.attributes?.zwave_device?.status == 3" group_actions: true
Oh man! Paging @DesT! It looks like fence code block formatting is broken? See above. I tried an experiment elsewhere, and it looks fine (has correct line breaks). I'm at a loss for why this block doesn't display properly. Can you look?
Screen shot of how it should be formatted here:
EDIT: The screen shot should have a line
group_actions: true
following thefilter_expression
line, with the same indent.You then create a rule where if that group is not empty (give it some time -- use the sustained for option), you send a ping to the group. You can perform an action on a group, and it will perform the action on every entity in the group...
The group has pulse output configured, 5 seconds every 3595 seconds up to 10 time, so it makes 10 attempts, one every hour, to ping/recover the dead nodes. The group empty test has the sustained for option for 300 seconds (5 minutes), which gives ZWaveJS time to recover on its own before we start poking it.
The SET reaction looks like this. RESET reaction must be completely empty.
Note the empty expression variable at the end. This allows the evaluation in the Set Variable action to put the output of the group
performAction()
function in the expression into nowhere-land (it's a junk variable to receive the expression result we don't need).@toggledbits THIS. I've been just doing a simple
zwavejs.refresh
every hour via time-based rule, but THIS... this is delightful. Implemented last evening and awoke this morning to a notification of "1" device that had been actioned by this new rule immediately instead of waiting until the next hour (which has proven itself not to be 100% effective as some devices - iblinds, specifically - are a bit stubborn if left dead for too long.)Thank you for this.
-
If I am understanding this rule correctly, say if I have a z wave device that is truly offline ie battery dead or its not working the rule will continually ping it up to 10 times then stop. What if another device goes offline after the max 10 pings are completed, it won't restart pinging correct? If I change the trigger to
sys_group.empty
is FALSE
and
sys_group>members changes
will that work better? That way if another device goes offline it will also ping that device? -
If I am understanding this rule correctly, say if I have a z wave device that is truly offline ie battery dead or its not working the rule will continually ping it up to 10 times then stop. What if another device goes offline after the max 10 pings are completed, it won't restart pinging correct? If I change the trigger to
sys_group.empty
is FALSE
and
sys_group>members changes
will that work better? That way if another device goes offline it will also ping that device? -
@gwp1 So I tested this. This morning I noticed the rule was reset because it had reached its maximum pings. I then unplugged one of my zwave receptacles so it would go offline and it did show up as offline in the dynamic group controller. However the rule didn't change and remained in its reset state. I will toy around with this but adding the
sys_group>members changes
may be the trick here.The reason why yours may have seemed to work is a) you had devices go offline before the maximum amount of 10 pings had been reached or b) you don't have a device that is actually offline. Meaning your
group
goesfalse
once all the devices have been pinged and successfully brough back online, so that when another one goesoffline
your rule goes toset
. -
Fixable. Exercise for the readers.
-
T toggledbits locked this topic on