AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.46k stars 343 forks source link

Zigbee Homeautomation no longer works with gateway v3 #1182

Closed Nismonx closed 1 year ago

Nismonx commented 1 year ago

Home Assistant 2023.10.4 Supervisor 2023.10.0 Operating System 11.0 Frontend 20231005.0 - latest

'''
2023-10-21 17:04:59.130 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-21 17:04:59.137 ERROR (MainThread) [bellows.uart] Lost serial connection: AssertionError()
2023-10-21 17:05:04.099 ERROR (MainThread) [zigpy.application] Couldn't start application
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 68, in command
    return await future
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 198, in startup
    await self.initialize(auto_form=auto_form)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 150, in initialize
    await self.start_network()
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 184, in start_network
    await self._reset()
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 67, in command
    async with asyncio_timeout(EZSP_CMD_TIMEOUT):
  File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in __aexit__
    raise TimeoutError from exc_val
TimeoutError
2023-10-21 17:05:04.107 WARNING (MainThread) [homeassistant.components.zha.core.gateway] Couldn't start EZSP = Silicon Labs EmberZNet protocol: Elelabs, HUSBZB-1, Telegesis coordinator (attempt 3 of 3)
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 68, in command
    return await future
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 198, in startup
    await self.initialize(auto_form=auto_form)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 150, in initialize
    await self.start_network()
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 184, in start_network
    await self._reset()
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 67, in command
    async with asyncio_timeout(EZSP_CMD_TIMEOUT):
  File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 201, in async_initialize
    await self.application_controller.startup(auto_form=True)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 201, in startup
    await self.shutdown()
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 406, in shutdown
    await self._dblistener.shutdown()
  File "/usr/local/lib/python3.11/site-packages/zigpy/appdb.py", line 187, in shutdown
    await self._set_isolation_level(None)
  File "/usr/local/lib/python3.11/site-packages/zigpy/appdb.py", line 205, in _set_isolation_level
    await self._db._execute(lambda: setattr(self._db, "isolation_level", level))
  File "/usr/local/lib/python3.11/site-packages/aiosqlite/core.py", line 126, in _execute
    raise ValueError("Connection closed")
ValueError: Connection closed
2023-10-21 17:05:04.116 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry socket://192.168.1.193:8888 for zha
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 68, in command
    return await future
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 198, in startup
    await self.initialize(auto_form=auto_form)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 150, in initialize
    await self.start_network()
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 184, in start_network
    await self._reset()
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 67, in command
    async with asyncio_timeout(EZSP_CMD_TIMEOUT):
  File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 172, in async_setup_entry
    await zha_gateway.async_initialize()
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 214, in async_initialize
    raise exc
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 201, in async_initialize
    await self.application_controller.startup(auto_form=True)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 201, in startup
    await self.shutdown()
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 406, in shutdown
    await self._dblistener.shutdown()
  File "/usr/local/lib/python3.11/site-packages/zigpy/appdb.py", line 187, in shutdown
    await self._set_isolation_level(None)
  File "/usr/local/lib/python3.11/site-packages/zigpy/appdb.py", line 205, in _set_isolation_level
    await self._db._execute(lambda: setattr(self._db, "isolation_level", level))
  File "/usr/local/lib/python3.11/site-packages/aiosqlite/core.py", line 126, in _execute
    raise ValueError("Connection closed")
ValueError: Connection closed
'''
Nismonx commented 1 year ago

Come to think of it, this is likely an issue with HA because it only started after the last update...

Should I raise it in HA instead?

thank you

Nismonx commented 1 year ago

this was a HA issue:

https://github.com/home-assistant/core/pull/102471

https://github.com/home-assistant/core/issues/102459

AlexxIT commented 1 year ago

This is a Hass bug. Not related to integration.