home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.56k stars 30.73k forks source link

ZHA not able to add ZNP or EZSP devices #102963

Closed hanbo1990 closed 10 months ago

hanbo1990 commented 1 year ago

The problem

I have Sonoff Zigbee Bridge pro (ZNP) & another EZSP device. Both can be added in home assistant ZHA integration but both failed while creating network. Reboot of all devices are also attempted.

What version of Home Assistant Core has the issue?

core-2023.10.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

ZHA

Link to integration documentation on our website

No response

Diagnostics information

For EZSP,


2023-10-27 23:56:29.526 WARNING (MainThread) [homeassistant.config_entries] Config entry '00:1A:7D:DA:71:13' for bluetooth integration not ready yet: hci0 (00:1A:7D:DA:71:13): Failed to start Bluetooth: [org.freedesktop.DBus.Error.ServiceUnknown] The name org.bluez was not provided by any .service files; Retrying in background
2023-10-27 23:56:40.507 ERROR (MainThread) [homeassistant.components.homewizard.coordinator] Error fetching homewizard data: Timeout occurred while connecting to the HomeWizard Energy device
2023-10-27 23:57:47.451 ERROR (MainThread) [homeassistant] Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1003, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.11/site-packages/bellows/uart.py", line 81, in data_received
    self.frame_received(frame)
  File "/usr/local/lib/python3.11/site-packages/bellows/uart.py", line 108, in frame_received
    self.data_frame_received(data)
  File "/usr/local/lib/python3.11/site-packages/bellows/uart.py", line 129, in data_frame_received
    self._application.frame_received(self._randomize(data[1:-3]))
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/__init__.py", line 337, in frame_received
    self._protocol(data)
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 119, in __call__
    assert expected_id == frame_id
           ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
2023-10-27 23:57:47.499 ERROR (MainThread) [bellows.uart] Lost serial connection: AssertionError()
2023-10-27 23:57:47.510 ERROR (MainThread) [bellows.ezsp] NCP entered failed state. Requesting APP controller restart
2023-10-27 23:57:51.266 WARNING (MainThread) [bellows.zigbee.application] ControllerApplication reset unsuccessful: NetworkNotFormed('Node is not part of a network')
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 681, in _reset_controller_loop
    await self._reset_controller()
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 703, in _reset_controller
    await self.initialize()
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 117, in initialize
    await self.load_network_info(load_devices=False)
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 232, in load_network_info
    await self._ensure_network_running()
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 165, in _ensure_network_running
    raise NetworkNotFormed("Node is not part of a network")

For znp:


2023-10-27 23:20:39.814 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 335, in form_network
    await self.start_network()
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 201, in start_network
    await self.load_network_info()
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 168, in load_network_info
    await self._znp.load_network_info(load_devices=load_devices)
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 228, in load_network_info
    await self._load_network_info(load_devices=load_devices)
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 117, in _load_network_info
    raise NetworkNotFormed()
zigpy.exceptions.NetworkNotFormed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/nvram.py", line 177, in osal_read
    read_rsp = await self.znp.request(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 1037, in request
    raise InvalidCommandResponse(
zigpy_znp.exceptions.InvalidCommandResponse: Expected SRSP response SYS.OSALNVReadExt.Rsp(Status=<Status.SUCCESS: 0>, Value=None), got SYS.OSALNVReadExt.Rsp(Status=<Status.INVALID_PARAMETER: 2>, Value=b'')

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 289, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 394, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/config_flow.py", line 381, in async_step_form_initial_network
    return await self.async_step_form_new_network(user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/config_flow.py", line 387, in async_step_form_new_network
    await self._radio_mgr.async_form_network()
  File "/usr/src/homeassistant/homeassistant/components/zha/radio_manager.py", line 260, in async_form_network
    await app.form_network()
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 338, in form_network
    await self.start_network()
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 201, in start_network
    await self.load_network_info()
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 168, in load_network_info
    await self._znp.load_network_info(load_devices=load_devices)
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 228, in load_network_info
    await self._load_network_info(load_devices=load_devices)
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 130, in _load_network_info
    key_desc = await self.nvram.osal_read(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/nvram.py", line 191, in osal_read
    raise SecurityError(
zigpy_znp.exceptions.SecurityError: NV item cannot be read due to security constraints: <OsalNvIds.NWK_ACTIVE_KEY_INFO: 58>```

### Example YAML snippet

_No response_

### Anything in the logs that might be useful for us?

_No response_

### Additional information

_No response_
TheJulianJES commented 1 year ago

For EZSP, try to upgrade to the latest Home Assistant Core 2023.11 beta. (Take a backup before!) Although this might be a different issue than the one I'm thinking of. (Still try though)

dopeytree commented 11 months ago

Did you get any fix on this?

dopeytree commented 11 months ago

Incase anyone else has this issue. Fear not your coordinator is working fine. My fix is to use Zigbee2mqqt

omriiluz commented 11 months ago

Make sure you are flashing the coordinator firmware as per the instructions here. I had the same issue and resolved it by flashing the new firmware.