Home Assistant Z-Wave Network Viewer (using Docker)

I just saw this in the system logs:

MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.5:6123 ssl:default [Host is unreachable]

Addon version is not being maintained by me, seems like the package is not installed (not updated in addon docker file)

This docker container doesn’t seem to be working for me anymore. I get a dark window that says “Z-Wave Network Viewer” in the upper left and the little file icon that says JSON in the upper right corner. The docker container log file does throw an error that repeats multiple times whenever I try to visit the network viewer webpage.

Docker command:
sudo docker create --name=zwavemap --restart no -v /etc/localtime:/etc/localtime:ro -e TZ=America/Chicago -e HA_URL=https://super.secret.url:8123 -e HA_TOKEN=WoUlDnTYoULiKeToKnOw -p 6124:6123 eladbar/ha-zwave-network:latest

You’ll notice my port is mapped to a different port. I also have an ESPHome container on the same Docker host, so I had to change this container (this has been discussed previously in this thread). The z wave network viewer was working, it would just take a while to load.

Log error that gets repeated:

|2020-10-23 01:51:09|stderr|----------------------------------------|
|---|---|---|
|2020-10-23 01:51:09|stderr|----------------------------------------|
|2020-10-23 01:51:09|stderr|IndexError: list index out of range|
|2020-10-23 01:51:09|stderr|    identifier = device.get("identifiers")[0]|
|2020-10-23 01:51:09|stderr|  File "/Managers/data_manager.py", line 364, in load_devices|
|2020-10-23 01:51:09|stderr|    self.load_devices(devices, entities, states)|
|2020-10-23 01:51:09|stderr|  File "/Managers/data_manager.py", line 321, in _async_load_data|
|2020-10-23 01:51:09|stderr|    return future.result()|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete|
|2020-10-23 01:51:09|stderr|    self._loop.run_until_complete(self._async_load_data())|
|2020-10-23 01:51:09|stderr|  File "/Managers/data_manager.py", line 63, in load_data|
|2020-10-23 01:51:09|stderr|    manager.load_data()|
|2020-10-23 01:51:09|stderr|  File "/Managers/handler.py", line 41, in do_GET|
|2020-10-23 01:51:09|stderr|    method()|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/http/server.py", line 415, in handle_one_request|
|2020-10-23 01:51:09|stderr|    self.handle_one_request()|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/http/server.py", line 427, in handle|
|2020-10-23 01:51:09|stderr|    self.handle()|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/socketserver.py", line 720, in __init__|
|2020-10-23 01:51:09|stderr|    super().__init__(*args, **kwargs)|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/http/server.py", line 647, in __init__|
|2020-10-23 01:51:09|stderr|    self.RequestHandlerClass(request, client_address, self)|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request|
|2020-10-23 01:51:09|stderr|    self.finish_request(request, client_address)|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/socketserver.py", line 347, in process_request|
|2020-10-23 01:51:09|stderr|    self.process_request(request, client_address)|
|2020-10-23 01:51:09|stderr|  File "/usr/local/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock|
|2020-10-23 01:51:09|stderr|Traceback (most recent call last):|
|2020-10-23 01:51:09|stderr|Exception happened during processing of request from ('172.17.0.1', 52596)|

EDIT: the log is newest first, so read from the bottom up.

I will add more logs (info / debug) and release new version later today, I can guess what happened, not sure I will be able to solve it without the additional logs

What kind of integration are you using? (ZWave / OZW)

Thanks

I’m using the built in ZWave integration in HA.

Release new version with lots of changes, mostly to make the component easier to maintain,
but also to be able to assist faster in case there’s an issue.

To define the container web server port - set the SERVER_PORT

@squirtbrnr, please let me know if you have an issue once switching to that version,
In case you do, you can create mount to local PC (mount bind) of container’s folder /debug,
send me a link to download the files from that folder (as zip file) and I will be able to reproduce it in my PC.

In addition, added lots of logs, so maybe you will be able to find the issue over there.

Breaking change

  • files moved to folder app, entry point is now ENTRYPOINT ["python3", "/app/webserver.py"]

Change-log:

  • WebServer changed to Flask
  • Added support to change the port using environment variable SERVER_PORT
  • Added support to change the default log level from INFO to DEBUG using environment variable DEBUG
  • Added support to read data from /debug volume instead of HA (for debugging purposes) using environment variable LOCAL
  • Continuous connection using WebSocket to HA for future support in WebSocket to the UI

Is the addon version dead? there hasn’t been any response.

Sorry, I’ve been swamped at work. I’m working on releasing a new version of the addon, I have the dependency issue fixed but the new version of the tool has caused some other issues with the addon. I’m trying to figure out what is going on there.

@bar I’m trying to get the addon working with the new release, but am running into issues getting the container talking to HA. Any idea what would be causing the error below to repeat over and over again in the logs (hostnames and tokens have been obfuscated)?

I’m assuming the HA_URL environment variable should be pointing to my HA front-end, and not the supervisor API like I used in the past. That doesn’t seem to work with this new version.

UPDATE: I just tried building a docker container using the ha-zwave-network Dockerfile and running it on my home server and I see the same errors.

INFO:Managers.configuration_manager:Configuration is valid, data: {'home_assistant_url': 'https://hassio.example.com:8123/', 'home_assistant_token': 'xxxxxxxx', 'ssl_key': '/ssl/privkey.pem', 'ssl_certificate': '/ssl/fullchain.pem', 'is_debug': True, 'is_local': False, 'server_port': 6123, 'home_assistant_web_socket_url': 'wss://hassio.example.com:8123/', 'is_ssl': True, 'ssl_context': ('/ssl/fullchain.pem', '/ssl/privkey.pem')}
DEBUG:asyncio:Using selector: EpollSelector
INFO:Managers.data_manager:Connecting to wss://hassio.example.com:8123/
 * Serving Flask app "webserver" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
INFO:werkzeug: * Running on https://0.0.0.0:6123/ (Press CTRL+C to quit)
INFO:werkzeug: * Restarting with stat
ERROR:Managers.data_manager:Failed to connect due to error: 'NoneType' object has no attribute 'encode'
INFO:Managers.configuration_manager:Configuration is valid, data: {'home_assistant_url': 'https://hassio.example.com:8123/', 'home_assistant_token': 'xxxxxxx', 'ssl_key': '/ssl/privkey.pem', 'ssl_certificate': '/ssl/fullchain.pem', 'is_debug': True, 'is_local': False, 'server_port': 6123, 'home_assistant_web_socket_url': 'wss://hassio.example.com:8123/', 'is_ssl': True, 'ssl_context': ('/ssl/fullchain.pem', '/ssl/privkey.pem')}
DEBUG:asyncio:Using selector: EpollSelector
INFO:Managers.data_manager:Connecting to wss://hassio.example.com:8123/
WARNING:werkzeug: * Debugger is active!
ERROR:Managers.data_manager:Failed to connect due to error: 'NoneType' object has no attribute 'encode'
INFO:werkzeug: * Debugger PIN: xxx-xxx-xxx
INFO:Managers.data_manager:Connecting to wss://hassio.example.com:8123/
ERROR:Managers.data_manager:Failed to connect due to error: 'NoneType' object has no attribute 'encode'
INFO:Managers.data_manager:Connecting to wss://hassio.example.com:8123/

I’m working on additional release with more details when exceptions takes place,
Before that, just to make sure, can you please check if the container can access the host that you are trying to connect ping / curl,
I want to rule out any communication error because the line the code fail on was related to the connect function of websocket.
Another direction I would like to rule out is about the certificate, are you using self-sign or CA certificate?

thanks

I comared the logs you have sent to the one I have,
URL ends with /, please remove it and it will work for you (reproduced it).

new release

  • Better error handling
  • Added error line for all logs related to exceptions
  • Handle WebSocket state changes to reconnect when needed
  • Skip WebSocket SSL verification

sorry it took me a while to reply. Here’s the extended error I was getting:

date stream content
2020-10-24 13:52:55 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:52:55 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:52:54 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:52:53 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:52:53 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:52:53 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:52:47 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:47] “[33mGET /favicon.ico HTTP/1.1[0m” 404 -
2020-10-24 13:52:47 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:47] “[37mGET /data/nodes.json HTTP/1.1[0m” 200 -
2020-10-24 13:52:47 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:47] “[37mGET /index.html HTTP/1.1[0m” 200 -
2020-10-24 13:52:43 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:43] “[33mGET /favicon.ico HTTP/1.1[0m” 404 -
2020-10-24 13:52:43 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:43] “[33mGET /index.htm HTTP/1.1[0m” 404 -
2020-10-24 13:52:39 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:39] “[33mGET /favicon.ico HTTP/1.1[0m” 404 -
2020-10-24 13:52:39 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:39] “[33mGET /index.tm HTTP/1.1[0m” 404 -
2020-10-24 13:52:36 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:36] “[37mGET /data/nodes.json HTTP/1.1[0m” 200 -
2020-10-24 13:52:36 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:36] “[37mGET / HTTP/1.1[0m” 200 -
2020-10-24 13:52:33 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:33] “[33mGET /favicon.ico HTTP/1.1[0m” 404 -
2020-10-24 13:52:33 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:33] “[37mGET /data/nodes.json HTTP/1.1[0m” 200 -
2020-10-24 13:52:32 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:32] “[37mGET /static/images/json.png HTTP/1.1[0m” 200 -
2020-10-24 13:52:32 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:32] “[37mGET /static/css/styles.css HTTP/1.1[0m” 200 -
2020-10-24 13:52:32 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:32] “[37mGET /static/scripts/networkViewer.js HTTP/1.1[0m” 200 -
2020-10-24 13:52:32 stderr INFO:werkzeug:192.168.1.95 - - [24/Oct/2020 13:52:32] “[37mGET / HTTP/1.1[0m” 200 -
2020-10-24 13:52:24 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:52:24 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:52:24 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:52:23 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:52:23 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:52:22 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:51:54 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:51:54 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:51:53 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:51:52 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:51:52 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:51:52 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:51:23 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:51:23 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Login completed, Home Assistant version: 0.116.4
2020-10-24 13:51:22 stderr DEBUG:Managers.data_manager:Login message received: {“type”: “auth_ok”, “ha_version”: “0.116.4”}
2020-10-24 13:51:22 stderr DEBUG:Managers.data_manager:Login message received: {“type”: “auth_required”, “ha_version”: “0.116.4”}
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Logging into wss://super.secret.url:8123
2020-10-24 13:51:22 stderr INFO:werkzeug: * Debugger PIN: ###-###-###
2020-10-24 13:51:22 stderr WARNING:werkzeug: * Debugger is active!
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Connecting to wss://super.secret.url:8123
2020-10-24 13:51:22 stderr DEBUG:asyncio:Using selector: EpollSelector
2020-10-24 13:51:22 stderr INFO:Managers.configuration_manager:Configuration is valid, data: {‘home_assistant_url’: ‘https://super.secret.url:8123’, ‘home_assistant_token’: ‘WoUlDnTYoULiKeToKnOw’, ‘ssl_key’: ‘’, ‘ssl_certificate’: ‘’, ‘is_debug’: True, ‘is_local’: False, ‘server_port’: 6123, ‘home_assistant_web_socket_url’: ‘wss://super.secret.url:8123’, ‘is_ssl’: False, ‘ssl_context’: None}
2020-10-24 13:51:22 stderr ERROR:Managers.data_manager:Failed to refresh data due to error: invalid literal for int() with base 10: ‘volume_1’
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Loading devices
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Reloading data
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Login completed, Home Assistant version: 0.116.4
2020-10-24 13:51:22 stderr DEBUG:Managers.data_manager:Login message received: {“type”: “auth_ok”, “ha_version”: “0.116.4”}
2020-10-24 13:51:22 stderr DEBUG:Managers.data_manager:Login message received: {“type”: “auth_required”, “ha_version”: “0.116.4”}
2020-10-24 13:51:22 stderr INFO:Managers.data_manager:Logging into wss://super.secret.url:8123
2020-10-24 13:51:22 stderr INFO:werkzeug: * Restarting with stat
2020-10-24 13:51:22 stderr INFO:werkzeug: * Running on http://0.0.0.0:6123/ (Press CTRL+C to quit)
2020-10-24 13:51:21 stdout * Debug mode: on
2020-10-24 13:51:21 stdout Use a production WSGI server instead.
2020-10-24 13:51:21 stdout WARNING: This is a development server. Do not use it in a production deployment.
2020-10-24 13:51:21 stdout * Environment: production
2020-10-24 13:51:21 stdout * Serving Flask app “webserver” (lazy loading)
2020-10-24 13:51:21 stderr INFO:Managers.data_manager:Connecting to wss://super.secret.url:8123
2020-10-24 13:51:21 stderr DEBUG:asyncio:Using selector: EpollSelector
2020-10-24 13:51:21 stderr INFO:Managers.configuration_manager:Configuration is valid, data: {‘home_assistant_url’: ‘https://super.secret.url:8123’, ‘home_assistant_token’: ‘WoUlDnTYoULiKeToKnOw’, ‘ssl_key’: ‘’, ‘ssl_certificate’: ‘’, ‘is_debug’: True, ‘is_local’: False, ‘server_port’: 6123, ‘home_assistant_web_socket_url’: ‘wss://super.secret.url:8123’, ‘is_ssl’: False, ‘ssl_context’: None}

“volume_1” refers to a sensor for my Synology disk station:

    {
        "config_entries": [
            "dc3476f9c26e405f98b29d61a69de76d"
        ],
        "connections": [],
        "manufacturer": "Synology",
        "model": "DS1515+",
        "name": "Synology NAS (Volume 1 - SHR with 1 disk protect)",
        "sw_version": "DSM 6.2.3-25426 Update 2",
        "entry_type": null,
        "id": "59ef40738d5b48baba9760ec7b21e6d7",
        "identifiers": [
            [
                "synology_dsm",
                "XXXXXXXXXXXXX",
                "volume_1"
            ]
        ],
        "via_device_id": "bb0acb15501a405597ef76cd2fa88d0a",
        "area_id": null,
        "name_by_user": null
    },

found the issue and fixed it, new release is available

1 Like

I want to use the addon but get:

INFO:werkzeug: * Running on http://0.0.0.0:6123/ (Press CTRL+C to quit)
ERROR:Managers.data_manager:Failed to connect due to error: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123) [LN: 87]
INFO:Managers.data_manager:Connecting to ws://supervisor/core
ERROR:Managers.data_manager:Failed to connect due to error: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123) [LN: 87]

I using SSL https://domain.nl
what can I do? because the addon has no configuration parameters.

are you using SSL? seems that you’ve entered http://supervisor/core as URL
Currently from the logs above there are 3 potential issues:

  • code is not working well with non SSL HA - I will check it if that’s the case
  • your HA is using SSL but you’ve entered env. variable of URL - http://…
  • you’ve entered env. variable of URL to the supvisor and not HA

please check and let me know which one of them cause the error

thanks

The addon is fubared at the moment, I’m working on a fix but running into issues with some of the recent changes.

I just published a new release of the addon that should get it working for everyone again. There are two big changes:

  1. You can no longer place the viewer in the sidebar
  2. The addon now requires configuration.

Here is the changelog update:

[0.3] - 2020-10-27

Added

  • Added missing python modules for latest Z-Wave Network Viewer #1
  • Added and updated configuration settings to match updates to the viewer, including adding the HA url, a long-lived access token, ssl support and configuration of the debug parameter

Changed

  • Upgraded to version 8.0.5 of the addon base image

Removed

  • Ingress support. It will not work with SSL and was not working properly with the latest version of the viewer even with SSL disabled. The “Open Web UI” link will now open the viewer in a separate window or tab, and it is no longer an option to put it in the sidebar.

Can you share what caused the change that forces to enter the configuration manually?

Thanks

The old version worked with the http://supervisor/core URL and the supervisor token. The supervisor token won’t work on the regular URL, so that requires creating a token and adding it to the config. I also can’t find anything in the addon APIs that will give me the URL and port of the web interface, so that needs to be in the config as well. Supposedly there is a function bassio::core.port that should at least give me the port number, but I have yet to get it to return anything. I’m guessing there is some magic value that needs to be set in the addon config.json that I haven’t found yet. I’m planning on pulling down some addons and digging through their code to see if I can find one where that works.

If SSL isn’t enabled on HA, it should be possible to use http://homeassistant.local.hass.io:. But if SSL is enabled on HA, that URL will fail unless you also add homeassistant.local.hass.io as a SAN on the certificate. And I still have the issue of needed to get the port from somewhere. Unfortunately it can’t just use http[s]://127.0.0.1: either, since localhost doesn’t map to the docker image running HA from inside the addon container.

I’m going to try and find some time to do some code refactoring for the addon, and in the process I’m going to do some more digging. Unfortunately, I don’t think there is any way around needing at least the token in the config even if I do figure out how to get the hostname or IP and port.