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.42k stars 339 forks source link

Help!Multiple errors occurred after updating to version 3.3.4/3.3.5 #1268

Open will-huang9531 opened 8 months ago

will-huang9531 commented 8 months ago

Gateway:Xiaomi Multimode Gateway (CN) ZNDMWG03LM Gateway Version: 1.5.4_0090 XiaomiGateway3 Version: 3.3.4/3.3.5 Home Assistant Version: 2023.12.1

When I tried to upgrade GW3 version to 3.3.5, the gateway and all devices (zigbee and ble) were unavailable. Then I tried 3.3.4, the problem still exists. I have attempted to roll back to an older version, but the issue remains unresolved. Multiple logs mentioned in Home Assistant

Logger: custom_components.xiaomi_gateway3.core.gateway
Source: custom_components/xiaomi_gateway3/core/gateway/base.py:108
Integration: Xiaomi Gateway 3 ([documentation](https://github.com/AlexxIT/XiaomiGateway3), [issues](https://github.com/AlexxIT/XiaomiGateway3/issues))
First occurred: 16:05:42 (2 occurrences)
Last logged: 16:13:42

192.168.31.105 | Can't prepare gateway
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 500, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 640, in readuntil
    await self._wait_for_data('readuntil')
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 525, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/config/custom_components/xiaomi_gateway3/core/gateway/__init__.py", line 188, in prepare_gateway
    return await self.gw3_prepare_gateway(sh)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_gateway3/core/gateway/gate_mgw.py", line 49, in gw3_prepare_gateway
    await self.dispatcher_send(SIGNAL_PREPARE_GW, sh=sh)
  File "/config/custom_components/xiaomi_gateway3/core/gateway/base.py", line 108, in dispatcher_send
    await handler(**kwargs)
  File "/config/custom_components/xiaomi_gateway3/core/gateway/openmiio.py", line 38, in openmiio_prepare_gateway
    if "openmiio_agent" not in await sh.get_running_ps():
                               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_gateway3/core/shell/shell_mgw.py", line 34, in get_running_ps
    return await self.exec("ps -ww | grep -v ' 0 SW'")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_gateway3/core/shell/base.py", line 41, in exec
    raw = await asyncio.wait_for(coro, timeout=timeout)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 502, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

Logger: custom_components.xiaomi_gateway3.core.gateway
Source: custom_components/xiaomi_gateway3/core/shell/__init__.py:45
Integration: Xiaomi Gateway 3 ([documentation](https://github.com/AlexxIT/XiaomiGateway3), [issues](https://github.com/AlexxIT/XiaomiGateway3/issues))
First occurred: 16:04:55 (1 occurrences)
Last logged: 16:04:55

192.168.31.105 | Can't restart openmiio
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 500, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 640, in readuntil
    await self._wait_for_data('readuntil')
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 525, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/config/custom_components/xiaomi_gateway3/core/gateway/openmiio.py", line 66, in openmiio_timer
    async with shell.Session(self.host) as sh:
  File "/config/custom_components/xiaomi_gateway3/core/shell/__init__.py", line 31, in __aenter__
    return await self.login()
           ^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_gateway3/core/shell/__init__.py", line 45, in login
    resp: bytes = await asyncio.wait_for(coro, 3)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 502, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:509
Integration: 传感器 ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 16:02:51 (8 occurrences)
Last logged: 16:02:51

Error adding entities for domain sensor with platform xiaomi_gateway3
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 565, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 215, in add_to_platform_start
    super().add_to_platform_start(hass, platform, parallel_updates)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'sensor.0x00158d0003d11d15_battery' cannot be added a second time to an entity platform

Logger: homeassistant.components.switch
Source: helpers/entity_platform.py:509
Integration: 开关 ([documentation](https://www.home-assistant.io/integrations/switch), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+switch%22))
First occurred: 16:02:45 (1 occurrences)
Last logged: 16:02:45

Error adding entities for domain switch with platform xiaomi_gateway3
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 565, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'switch.6490c178a774_led' cannot be added a second time to an entity platform

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:509
Integration: 二元传感器 ([documentation](https://www.home-assistant.io/integrations/binary_sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+binary_sensor%22))
First occurred: 16:02:45 (7 occurrences)
Last logged: 16:02:51

Error adding entities for domain binary_sensor with platform xiaomi_gateway3
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 565, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'binary_sensor.6490c178a774_gateway' cannot be added a second time to an entity platform

Logger: homeassistant.components.select
Source: helpers/entity_platform.py:509
Integration: 选择器 ([documentation](https://www.home-assistant.io/integrations/select), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+select%22))
First occurred: 16:02:45 (2 occurrences)
Last logged: 16:02:45

Error adding entities for domain select with platform xiaomi_gateway3
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 565, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'select.6490c178a774_command' cannot be added a second time to an entity platform

Logger: homeassistant.components.alarm_control_panel
Source: helpers/entity_platform.py:509
Integration: 警报控制器 ([documentation](https://www.home-assistant.io/integrations/alarm_control_panel), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+alarm_control_panel%22))
First occurred: 16:02:45 (1 occurrences)
Last logged: 16:02:45

Error adding entities for domain alarm_control_panel with platform xiaomi_gateway3
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 565, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'alarm_control_panel.6490c178a774_alarm' cannot be added a second time to an entity platform
AlexxIT commented 7 months ago

Some problem with connection to your gateway. Maybe not solid WiFi. Also you can try to reboot your gateway.