kardia-as / zigpy-zboss

GNU General Public License v3.0
36 stars 4 forks source link

zigpy-zboss does not appear to be compatible with Python 3.11 #28

Closed Hedda closed 8 months ago

Hedda commented 9 months ago

@DamKast Created an new issue for tracking this (as Home Assistant and zigpy now require supporting Python 3.11 or later).

Originally posted by @puddly in https://github.com/kardia-as/zigpy-zboss/issues/20#issuecomment-1776417791

zigpy-zboss does not appear to be compatible with Python 3.11.

@DamKast Since this repository is based on zigpy-znp, take a look at this PR I made to zigpy-znp that removes unnecessary type duplication within radio libraries: https://github.com/zigpy/zigpy-znp/pull/225

https://github.com/zigpy/zigpy-znp/pull/225

willpuckett commented 8 months ago

Attempting to add the update to HomeAssistant via:

  1. Make a custom component by copying the zha component from inside the docker container /usr/src/homeassistant/homeassistant/components/zha to the /config/custom_components directory.
  2. add a version key (I used "2025.1.1") and "zippy-zboss==1.1.1" to the requirements list in manifest.json
  3. add import zigpy_zboss.zigbee.application and boss = ("boss", zigpy_zboss.application.ControllerApplication,) to custom_components/zha/core/const.py
  4. Restart

I am able to see the custom component:

Screenshot 2023-11-06 at 8 29 35 AM

I select the serial port. It should be passed through into the docker container as I was using it previously with a cc2531.

Screenshot 2023-11-06 at 8 29 57 AM

I select the radio type:

Screenshot 2023-11-06 at 8 30 12 AM

I then get to a port configuration in the control flow, but no matter what combination of flow control and speed I select, it errors and won't move forward, with an "unknown error occurred."

Screenshot 2023-11-06 at 8 30 34 AM

The logs from home assistant:

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: 8:33:22 AM (2 occurrences)
Last logged: 8:35:19 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_zboss/api.py", line 80, in connect
    self._config[conf.CONF_DEVICE], self)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'device'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 293, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha/config_flow.py", line 269, in async_step_manual_port_config
    if await self._radio_mgr.radio_type.controller.probe(user_input):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_zboss/zigbee/application.py", line 480, in probe
    await nrf.connect()
  File "/usr/local/lib/python3.11/site-packages/zigpy_zboss/api.py", line 83, in connect
    "Connection to %s failed, cleaning up", self._port_path)
                                            ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_zboss/api.py", line 63, in _port_path
    return self._config[conf.CONF_DEVICE][conf.CONF_DEVICE_PATH]
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'device'

The nrf52840 is showing up in lsusb

ha@ha:~/ha$
lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Communications, Driver=cdc_acm, 12M
    |__ Port 1: Dev 2, If 1, Class=CDC Data, Driver=cdc_acm, 12M
    |__ Port 1: Dev 2, If 2, Class=Mass Storage, Driver=usb-storage, 12M

ha@ha:~/ha$
ls -l /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Nov  6 08:27 /dev/ttyACM0

Apologies if I'm posting this in the wrong place and thanks for the update!

Hedda commented 8 months ago

Apologies if I'm posting this in the wrong place and thanks for the update!

@willpuckett yes this is the wrong place, you need to open a new issue instead as this being closed now you risk no one else reading it so you are better of open a new issue that is dedicated to only that question, one issue per issue so to say -> https://github.com/kardia-as/zigpy-zboss/issues/new