ZwaveJS2mqtt need to be restarted at each HomeAssistant restart

I figured out since 2021.12.x updates, that my ZwaveJS2mqtt add-on needs to be always manually restarted after a home assistant restart occurs.

Anyone with the same behaviour and a workaround for that?

I tried to restart it automatically with an automation but without success :

  alias: Restart ZwaveJS2mqtt When hassio is restarted
  trigger:
    - event: start
      platform: homeassistant
  action:
    - service: hassio.addon_stdin
      data:
        addon: core_ssh
        input: "ha addons restart a0d7b954_zwavejs2mqtt"

Home Assistant OS 7.0
core-2021.12.3
supervisor-2021.12.2
Zwavejs2mqtt add-on version : 0.32.1
zwavejs2mqtt: 6.1.1
zwave-js: 8.9.0-beta.1 (don’t know why I’m in a beta version).

You didn’t explain why do you need to restart zwavejs2mqtt. That isn’t normal. What problems are you having?

zwave-js: 8.9.0-beta.1 (don’t know why I’m in a beta version).

Because zwavejs2mqtt accidentally released a new version with the beta driver, and I guess the addon was updated without checking.

The reason is that my Home Assistant is no more able to interact with my zwave devices without a reboot of the zwavejs2mqtt add-on.

When I look at “server control” logs I got the following errors, It says it cannot connect to the add-on :

Detailed example of one error :

Logger: homeassistant.core
Source: components/zwave_js/light.py:337
First occurred: 07:38:01 (1 occurrences)
Last logged: 07:38:01

Error executing service: <ServiceCall light.turn_on (c:038eebcbf67902429df1b6da9db882a6): entity_id=['light.bain_wc_light_shelf'], params=>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1511, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 494, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/light.py", line 283, in async_turn_on
    await self._async_set_brightness(kwargs.get(ATTR_BRIGHTNESS), transition)
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/light.py", line 337, in _async_set_brightness
    await self.info.node.async_set_value(
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/model/node.py", line 449, in async_set_value
    result = await self.async_send_command(
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/model/node.py", line 406, in async_send_command
    result = await self.client.async_send_command(message, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/client.py", line 77, in async_send_command
    await self._send_json_message(message)
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/client.py", line 329, in _send_json_message
    raise NotConnected
zwave_js_server.exceptions.NotConnected

I don’t see specific error in zwave2mqtt addon logs tab (still reports device value correctly), but

  • my motion detector don’t trigger anymore automation in ha,
  • my remote button doesn’t switch on any light when i press on it,
  • my door opening sensors doesn’t trigger notification

… until I restart the add-on.

A zwave-js server connection problem says that the add-on is stopping for some reason. You’ll want to look at the add-on logs, or probably the driver debug logs as well to see what’s going on there.

I have noticed this behavior on my system also, but it is not every time. It happened once or twice this month.

Never had this kind of issues before. It really started since the December updates.

On my system it can be reproduce each time I initiate a reboot of the core-homeassistant.

Even a full host restart requires (when HA become available) to restart zwavejs2mqtt add-on.

I had a look to add-on / zwave / zwave2mqtt logs (in silly mode) but not find any error. I have only errors (mentioned above in my previous reply) that appears in the HomeAssistant Logs (Configuration > Home Assistant > Logs).

As the HomeAssistant OS was updated to OS7.0, could it be possible that this “connexion” issue could be linked to docker environment preventing communication between network of the core and the network of the add-on?

@freshcoast : do you know other methods to gather more verbose logs? I already specified “silly” for zwave2mqtt and “silly” for the zwave drivers. But nothing specials appears on these logs. Therefor I’m a little bit blind to troubleshoot something with this issue.

Since my update to core-2021.12.4 yesterday evening, the issue shift a little bit… On restart it’s random, sometimes zwave2mqtt is correctly connected to HA, sometimes not. But at most 2 hours later, HA is no more able to connect the add-on and need to restart it again.

In parallel I checked the health of my Hypervisor host (proxmox), I found the vm is using more memory than usual since the updates 2021.12.x (now quite all the 4GB allocated the VM, instead of an average of 2.5GB for the previous months). This has the effect to create memory swapping on the hypervisor host (as I was short on physical memory on proxmox all my 8GB of my hypervisor host was used then).

I added 8GB more of physical RAM to my hypervisor host the in order to avoid swapping.

Touching wood… for now it is running correctly after several reboots and no communication issue between ha-core and zwavejs2mqtt add-on running after more than 3 hours now.

But I’m bit surprised than it could be a memory swapping issue, otherwise some component produce memory leaks…

Where are you looking for logs? You’ll want to save to a log file and download it from the Store page (folder icon in sidebar).

If the problem comes back, what is the state of the server connection when things go bad? Does it show connected or disconnected?

I’m pretty sure I am having the exact same issue. I posted a question about it on the github page for zwavejs2mqtt ---- I believe its a js server issue where its not maintaining connection to HA and HA either wont or cant reconnect for whatever reason… perhaps a session expires or something idk

Hi,

Since I solved the issue of swapping memory on my hypervisor host (impact on overall system performance of the virtual machines) the issue is gone.

More than 36h running zwavejs2mqtt with no issue and no need to restart anythin! :crossed_fingers:

As I explained above, in my last comment, my HomeAssistant consume more RAM than before (between 1.5 and 2 times more) . And I had almost 1GB of RAM swapped to disk, maybe for that reason there was strange behaviour in interaction between HA and zwavejs2mqtt.

Maybe (I don’t say that’s the reason but just an analysis by myslef of what might occurs) something like : HA waiting ACK from zwavwjs2mqtt add-on, but as zwavejs2mqtt is possibly slowed down by memory swapping, it can,'t answered in a fashion time, but continue to treat correctly and to prioritize it’s own internal communication with its zwave devices => in reality no error reported in add-on, logs. On the other hand, HA in unable to dialog with it and reported that it is not available in its core-logs. Restarting add-on might flush addressed memory in swap and new memory will be loaded in “real” RAM instead in the swap. After a certain amount of time memory is progressively moved to swap, then the issue come back again.

No body… no murder
This is the same for the errors:
No error… no issue
:laughing:

, this is difficult to troubleshoot when no relevant error is reported.

They also released a new docker image yesterday. My problem was the fact that the previous release accidentally had the beta drivers for zwavejs server. Updated to the new release (without beta drivers) and everything is currently working fine