zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
970 stars 204 forks source link

[question] Issue interacting with Inovelli LZW31-SN parameter 16 after re-interview #2390

Closed jdiegmueller closed 2 years ago

jdiegmueller commented 2 years ago

Hello! I'm not quite sure if this should be a zwavejs, zwavejs2mqtt, or HomeAssistant issue. Hoping someone can point me in the right direction:

I am running zwavejs2mqtt 6.7.4 with zwavejs 9.0.4 and HomeAssistant 2022.4.8. I often use HA services zwave_js.multicast_set_value and zwave_js.set_config_parameter in order to change the LED on Inovelli LZW31-SN switches. The other day I noticed that setting parameter 16 was no longer working for a certain group of switches.

I find the following traceback in the HomeAssistant log when attempting to call one of the two services: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 659, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1628, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1665, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/components/zwave_js/services.py", line 493, in async_multicast_set_value success = await async_multicast_set_value( File "/usr/local/lib/python3.9/site-packages/zwave_js_server/util/multicast.py", line 45, in async_multicast_set_value raise NotFoundError(f"Node {node} doesn't have value {value_id}") zwave_js_server.exceptions.NotFoundError: Node Node(node_id=77) doesn't have value 77-112-0-16 2022-04-25 13:52:07 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Node Node(node_id=77) doesn't have value 77-112-0-16 Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 662, in _async_call_service_step await self._async_run_long_action(service_task) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 623, in _async_run_long_action long_task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1628, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1665, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 289, in service_handler await script_entity.async_turn_on( File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 397, in async_turn_on await coro File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 423, in _async_run return await self.script.async_run(script_vars, context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1487, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1042, in async_run await super().async_run() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 393, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 428, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 659, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1628, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1665, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/components/zwave_js/services.py", line 493, in async_multicast_set_value success = await async_multicast_set_value( File "/usr/local/lib/python3.9/site-packages/zwave_js_server/util/multicast.py", line 45, in async_multicast_set_value raise NotFoundError(f"Node {node} doesn't have value {value_id}") zwave_js_server.exceptions.NotFoundError: Node Node(node_id=77) doesn't have value 77-112-0-16

I tried re-interviewing the node, refreshing values on the node, heal'ing the node .. still unable to change parameter 16. After removing the node from the HA group I am trying to set parameter 16 on, the service began working again. Armed with that knowledge, I performd an exclude & reinclude on the node, but it still complains about the node not having 162-112-0-16 (new node number is 162).

I then issued a re-interview on one of the other nodes I am attempting to set parameter 16 on via multicast, and once that completed that node now has the same problem: zwave_js_server.exceptions.NotFoundError: Node Node(node_id=77) doesn't have value 77-112-0-16

I suspect that doing a re-interview on node 73 or 76 -- in the same group I am trying to interact with above -- will cause the issue to include them as well.

Note that this issue does not happen with parameters 13 or 14 -- those are still working just fine -- it seems specific to parameter 16, and only happens after I perform a re-interview (or a new interview). Existing nodes I haven't recently done a re-interview on continue to respond to changes to parameter 16 as expected.

Any suggestion on which component might be causing the trouble, and/or how I can start interacting with parameter 16 again?

Thanks.

jdiegmueller commented 2 years ago

Ok, I've learned a little more:

Looking closely at the way ZwaveJS2MQTT handles parameter 16, there's actually 4 different components to it:

If I use use the 5th figure above as the "property key" when calling the service in HomeAssistant, I am able to set it. However, I can no longer do this in a single command like I was previously (recently, even) able to do. For example, I previously would set parameter 16 with value "58198536" and it would configure all four of the above simultaneously. The value(s) I use are generated by this tool: https://nathanfiscus.github.io/inovelli-notification-calc/.

Any insight is welomed + appreciated. Thanks.

prilly-dev commented 2 years ago

Do you have timeout repons on zwave communication statistics? I suspect you might have that during reinterview

jdiegmueller commented 2 years ago

Do you have timeout repons on zwave communication statistics? I suspect you might have that during reinterview

I show a dash under timeout response, which I assume means 0? I have been restarting zwavejs2mqtt quite a bit as I've been playing with this, so I did a re-interview of one of the "broken" nodes and it stayed 0.

kpine commented 2 years ago

However, I can no longer do this in a single command like I was previously (recently, even) able to do. For example, I previously would set parameter 16 with value "58198536" and it would configure all four of the above simultaneously.

In fact you can: https://www.home-assistant.io/integrations/zwave_js/#service-zwave_jsbulk_set_partial_config_parameters

You can't do that with multicast though. Your options for that are to use an MQTT command, or you can write a custom device config file that replaces the partial parameters with a single integer value.

jdiegmueller commented 2 years ago

In fact you can: https://www.home-assistant.io/integrations/zwave_js/#service-zwave_jsbulk_set_partial_config_parameters

You can't do that with multicast though. Your options for that are to use an MQTT command, or you can write a custom device config file that replaces the partial parameters with a single integer value.

Hmm; unfortunately I must politely disagree. I've been using this exact same setup for roughly 10 weeks without issue.

This specific use case had 5 nodes in it, but as I outline above I've "broken" 2 of them (162 and 77) with an interview. If I remove those 2 nodes from the HA group, everything behaves normally and I'm able to use zwave_js.multicast_set_value as I traditionally have. I pulled out a Zniffer to make sure only a single command is being sent via multicast, and it seems to confirm: image

The above multicast frame was generated as a result of a single zwave_js.multicast_set_value service call in HA, triggered from a script:

   - service: zwave_js.multicast_set_value
    data_template:
      command_class: '112'
      property: '16'
      value: 58198536
      entity_id: group.shower_alert_switches

Perhaps the thing that most suggests this might be an HA issue: I performed a network packet capture and observed the HA<->ZwaveJS WS interface .. and HA makes no attempt to even reach out to ZwaveJS. The error shows up in the HA log, but there is no traffic on the websocket by HA. I'll see if there is a way for me to dig in to the HA internals and compare a working node vs. broken/re-interviewed node.

kpine commented 2 years ago

Z-Wave JS the driver defines the configuration parameters. At one point parameter 16 for the LZW31-SN was defined as a plain integer, then it was converted to partial parameters. https://github.com/zwave-js/node-zwave-js/commit/5d59a90b040dd5b7fc9cc72d8a6d8cfe7a1c4588

What you're seeing is some of your nodes used the earlier config file, and the other nodes using the new config file. The re-interview uses the new file. The config parameter values are cached during the initial interview and are never updated unless you re-interview or re-include.

For partial parameters you must use the bulk service call for setting the combined value. You have even seen this yourself:

Looking closely at the way ZwaveJS2MQTT handles parameter 16, there's actually 4 different components to it:

[162-112-0-16-255] LED Indicator: Effect Color [162-112-0-16-65280] LED Indicator: Effect Brightness [162-112-0-16-16711680] LED Indicator: Effect Duration, and [162-112-0-16-2130706432] LED Indicator: Effect Type

There is no 162-112-0-16, only 162-112-0-16-<bitmask>.

You can confirm this yourself by downloading the Diagnostic info from the Device page. Download one from a working node, and one from a non-working node. You'll see the same difference in these configuration parameter values.

jdiegmueller commented 2 years ago

Bingo, thanks for the pointer to that. I manually reverted the LZW31-SN's device file to go back to being a single parameter and I'm back to multicasting. Thanks.