giaever-online-iot / home-assistant-snap

Snap recipe for the Open source home automation software that puts local control and privacy first.
Apache License 2.0
21 stars 3 forks source link

Unable to enumerate Serial devices #6

Closed JohnMcLear closed 2 years ago

JohnMcLear commented 2 years ago
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]: 2021-11-19 15:18:44 ERROR (MainThread) [aiohttp.server] Error handling request
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]: Traceback (most recent call last):
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     resp = await self._request_handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     resp = await handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     return await handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     return await handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     return await handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     return await handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     return await handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 144, in auth_middleware
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     return await handler(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 136, in handle
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     result = await result
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 130, in post
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     return await super().post(request)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/http/data_validator.py", line 62, in wrapper
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     result = await method(view, request, *args, **kwargs)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 72, in post
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     result = await self._flow_mgr.async_init(
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 151, in async_init
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     flow, result = await task
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 177, in _async_init
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     result = await self._async_handle_step(flow, flow.init_step, data, init_done)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 256, in _async_handle_step
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     result: FlowResult = await getattr(flow, method)(user_input)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/homeassistant/components/zha/config_flow.py", line 47, in async_step_user
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     ports = await self.hass.async_add_executor_job(serial.tools.list_ports.comports)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     result = self.fn(*self.args, **self.kwargs)
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/serial/tools/list_ports_linux.py", line 102, in comports
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     for info in [SysFS(d) for d in devices]
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/serial/tools/list_ports_linux.py", line 102, in <listcomp>
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     for info in [SysFS(d) for d in devices]
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:   File "/snap/home-assistant-snap/423/lib/python3.8/site-packages/serial/tools/list_ports_linux.py", line 48, in __init__
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]:     num_if = int(self.read_line(self.usb_device_path, 'bNumInterfaces'))
2021-11-19T15:18:44Z home-assistant-snap.home-assistant-snap[460214]: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

When trying to add "Zigbee Home Automation"

# sudo snap connections home-assistant-snap 
Interface                Plug                                         Slot                                Notes
bluez                    home-assistant-snap:bluez                    -                                   -
content                  -                                            home-assistant-snap:components      -
content                  -                                            home-assistant-snap:configurations  -
content                  -                                            home-assistant-snap:vscs-content    -
content                  home-assistant-snap:bin                      -                                   -
desktop                  home-assistant-snap:desktop                  :desktop                            -
network                  home-assistant-snap:network                  :network                            -
network-bind             home-assistant-snap:network-bind             :network-bind                       -
network-control          home-assistant-snap:network-control          :network-control                    -
physical-memory-control  home-assistant-snap:physical-memory-control  -                                   -
raw-usb                  home-assistant-snap:raw-usb                  -                                   -
removable-media          home-assistant-snap:removable-media          :removable-media                    manual
serial-port              home-assistant-snap:serial-port              :usbserial                          manual
jmgiaever commented 2 years ago

Hi, I think this should be reported in the component at HA core.

JohnMcLear commented 2 years ago

@jmgiaever okidoki, what I will do first is attempt to run HA using a docker image instead of snap and see if I can replicate then come back to this :)

jmgiaever commented 2 years ago

Okei. Thanks. :)

jmgiaever commented 2 years ago

Can you give me the track you're on by the way? If your not on "latest/stable" or "2021.11/stable", can you try switch to

"2021.11/stable"

sudo snap switch home-assistant-snap --channel=2021.11
sudo snap refresh home-assistant-snap

This have the lastest supported Python too (3.9).

JohnMcLear commented 2 years ago

tracking: 2021.10/edge I think that's what you wanted to know?

jmgiaever commented 2 years ago

Yes. If you want to be on an edge channel, then you should track latest/edge. VERSION/egde will always stop with that version, so for instance now you won't be updated to 2021.11.

I recommend that you track latest/edge (or even better latest/stable) if you want rolling releases. Edge tracks might be buggy and contain experimental stuff.

If you don't want rolling, use the VERSION/stable track, e.g 2021.11/stable and make an automation for the updater sensor when a new release is published in a new track. Then you can switch on your own convenience.

jmgiaever commented 2 years ago

Btw; Have you tried to use the raw-usb connection instead of the serial-port?

JohnMcLear commented 2 years ago

What's the command to test that please?

jmgiaever commented 2 years ago
sudo snap disconnect home-assistant-snap:serial-port
sudo snap connect home-assistant-snap:raw-usb
JohnMcLear commented 2 years ago

New error

2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]: 2021-11-23 11:22:09 ERROR (MainThread) [aiohttp.server] Error handling request
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]: Traceback (most recent call last):
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     resp = await self._request_handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     resp = await handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return await handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return await handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return await handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return await handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return await handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/http/auth.py", line 138, in auth_middleware
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return await handler(request)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/http/view.py", line 135, in handle
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     result = await result
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/config/config_entries.py", line 157, in post
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return await super().post(request, flow_id)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/http/data_validator.py", line 62, in wrapper
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     result = await method(view, request, *args, **kwargs)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/helpers/data_entry_flow.py", line 110, in post
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     result = await self._flow_mgr.async_configure(flow_id, data)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 246, in async_configure
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 320, in _async_handle_step
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     result: FlowResult = await getattr(flow, method)(user_input)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/zha/config_flow.py", line 68, in async_step_user
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     auto_detected_data = await detect_radios(dev_path)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/homeassistant/components/zha/config_flow.py", line 240, in detect_radios
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     probe_result = await radio.controller.probe(dev_config)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/zigpy_zigate/api.py", line 258, in probe
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     await asyncio.wait_for(api._probe(), timeout=PROBE_TIMEOUT)
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/usr/local/lib/python3.9/asyncio/tasks.py", line 481, in wait_for
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     return fut.result()
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/zigpy_zigate/api.py", line 278, in _probe
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     device = next(serial.tools.list_ports.grep(self._config[zigpy_zigate.config.CONF_DEVICE_PATH]))
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:   File "/snap/home-assistant-snap/442/lib/python3.9/site-packages/serial/tools/list_ports.py", line 48, in grep
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]:     if r.search(port) or r.search(desc) or r.search(hwid):
2021-11-23T11:22:09Z home-assistant-snap.home-assistant-snap[57494]: TypeError: expected string or bytes-like object
jmgiaever commented 2 years ago

Hi. Did you ever solve this? Sorry I've been very busy with work lately, and without any physical to test with there's no way for me to debug this. If you found a solution, please share it! :)