ZwaveJS - Unknown error / loses connection

He!

A couple of weeks ago I switched from OpenZwave to ZwaveJS. The main reason was that de network became unreliable and was curious about the new integration.
I can say I’m pretty pleased by how fast everything is and how easy it is to set up.
But after a couple of days zwave didn’t work anymore. I couldn’t toggle switches and was getting errors when I tried to put it on(failed to execute…). The switches don’t have a “unavailable” state.
I first tried to reload the integration, no effect. Then I reloaded the ZwaveJS add-on, no effect. Restarting the add-on did the trick and every switch/device was working again.
Days past by and it happened again, so I did a restart on the add-on and it worked again for a couple of days. Somehow the add-on loses connection to the network or something.
Below you will find the logs, but the error is unknown.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/zwave_js/switch.py:68
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: May 23, 2021, 1:00:31 AM (1 occurrences)
Last logged: May 23, 2021, 1:00:31 AM

[1650448824] Command failed: unknown_error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 206, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 649, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/switch.py", line 68, in async_turn_on
    await self.info.node.async_set_value(target_value, True)
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/model/node.py", line 370, in async_set_value
    result = await self.async_send_command(
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/model/node.py", line 349, in async_send_command
    result = await self.client.async_send_command(message, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/client.py", line 73, in async_send_command
    return await future
zwave_js_server.exceptions.FailedCommand: Command failed: unknown_error

And another log

Logger: homeassistant.components.zwave_js
Source: components/zwave_js/__init__.py:251
Integration: Z-Wave JS (documentation, issues)
First occurred: May 23, 2021, 1:20:31 AM (1 occurrences)
Last logged: May 23, 2021, 1:20:31 AM

Failed to connect: Cannot connect to host core-zwave-js:3000 ssl:default [Connect call failed ('172.30.33.1', 3000)]

and another

Logger: homeassistant
Source: components/zwave_js/switch.py:74
First occurred: May 22, 2021, 6:03:44 PM (11 occurrences)
Last logged: May 23, 2021, 1:11:13 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/switch.py", line 74, in async_turn_off
    await self.info.node.async_set_value(target_value, False)
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/model/node.py", line 370, in async_set_value
    result = await self.async_send_command(
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/model/node.py", line 349, in async_send_command
    result = await self.client.async_send_command(message, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/client.py", line 73, in async_send_command
    return await future
zwave_js_server.exceptions.FailedCommand: Command failed: unknown_error

I’m running on:

  • core-2021.4.6
  • supervisor-2021.04.3
  • Home Assistant OS 5.13
  • raspberry pi model 3b+

Does somebody know what is happening and how to fix this issue? I’m not planning to restart the add-on every couple of days :stuck_out_tongue:

Hi,

I have a very similar issue and have no idea where to start looking for a solution.

I migrated my Z-wave network using this guide: Switching from OpenZwave (Beta) to ZwaveJS2MQTT

All worked for a few days, but then the network stopped functioning and the Z-wave devices became unavailable.

This was the typical picture I had:

The only help was to restart the core or sometimes to reboot the whole host. Then I could see the devices as they should be, but again it only worked for a day or two. Today I restarted again and the situation is somewhat different. I can see the devices in the Z-wave JS page, but the overview page shows them as unavailable and I cannot switch on a switch, for example.

On the integrations page in the Z-wave box there is this error message:

Retrying setup: Cannot connect to host core-zwave-js:3000 ssl:default [Connect call failed (‘172.30.33.3’, 3000)]

There are also some new errors in the log:

future: <Task finished name='Task-3778' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)
21-05-24 13:58:50 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-3987' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)
21-05-24 14:00:50 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-4221' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)
21-05-24 14:02:50 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-4442' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)
21-05-24 14:04:50 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-4730' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)
21-05-24 14:06:50 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-4948' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)
21-05-24 14:08:50 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-5125' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)

It seems to be going from bad to worse. What should I try?

I am running HA on RPi, core-2021.5.5, supervisor-2021.04.3, Home Assistant OS 5.13.

Thanks a lot.

It happened again last night. Ugh, tired of restarting zwave

Hi,

I’ve exactly the same error, within the same lines , and I dont use Z-Wave …

21-05-28 00:40:48 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-40044' coro=<Scheduler._run_task.<locals>._wrap_task() done, defined at /usr/src/supervisor/supervisor/misc/scheduler.py:58> exception=TypeError('an integer is required (got type str)')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/misc/scheduler.py", line 62, in _wrap_task
    await task.coro_callback()
  File "/usr/src/supervisor/supervisor/misc/tasks.py", line 416, in _watchdog_addon_application
    if addon.in_progress or await addon.watchdog_application():
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 479, in watchdog_application
    return await self.sys_run_in_executor(check_port, self.ip_address, port)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/supervisor/supervisor/utils/__init__.py", line 43, in check_port
    result = sock.connect_ex((str(address), port))
TypeError: an integer is required (got type str)

UPDATE:
it’s the Mosquito addon - see 2021.5: Stability, performance, triggers, color modes! - #379 by ludeeus

I opened an issue on GitHub, it happened again last night, wife not amused:

I don’t use the mosquito addon. It’s only the Z-Wave JS addon/integration that doesn’t respond.

OK. In my case, error has dissappear

1 Like

I had a similar issue in my network for weeks. (both in zwaveJS and zwavejs2mqtt). Reboot would sometimes solve the issue, but not always. All devices became unresponsive and in most cases I was able to solve the issue for a few days, by excluding one of the nodes, re-including it, then re interviewing one node at a time starting with zwave nodes (closer to the device then outwards) then doing all the zwave plus ones.

After 3 weeks of troubleshooting, I found the one of my devices was generating tons of energy updates. The minute I unplugged the device, the network started responding as expected. Plugged it back in and sure enough the network became unresponsive again. Tried excluding it, factory reseting it and readding it and same issue resurfaced. In my case this happen to be a a zooz zen15. I am leaving it off my network until I get the latest firmware from Zooz.

I recommend looking at the logs and determine which devices is generating tons of events and either unplugging them (if possible) or excluding them from your network. I know this is not an ideal scenario, but at least the network is stable until you can upgrade the firmware.