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.47k stars 345 forks source link

ZHA: Failed setup, will retry - XiaomiGateway3 extensions: Can't prepare gateway #1394

Closed mwaskowski closed 2 months ago

mwaskowski commented 4 months ago

My ZHA is broken since last reboot of homeassistant

Logs

{"log":"\u001b[36m2024-07-02 17:09:19.615 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'uid': '5ce50cc485c7', 'did': '317113676', 'msg': 'add_device'}\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.62402391Z"}
{"log":"\u001b[36m2024-07-02 17:09:19.617 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'uid': '5ce50cc485c7', 'did': '317113676', 'msg': 'add_entity', 'entity': 'select.5ce50cc485c7_command'}\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.636553288Z"}
{"log":"\u001b[36m2024-07-02 17:09:19.620 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'uid': '5ce50cc485c7', 'did': '317113676', 'msg': 'add_entity', 'entity': 'select.5ce50cc485c7_data'}\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.64072321Z"}
{"log":"\u001b[36m2024-07-02 17:09:19.625 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'uid': '5ce50cc485c7', 'did': '317113676', 'msg': 'add_entity', 'entity': 'alarm_control_panel.5ce50cc485c7_alarm'}\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.641628875Z"}
{"log":"\u001b[36m2024-07-02 17:09:19.627 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'uid': '5ce50cc485c7', 'did': '317113676', 'msg': 'add_entity', 'entity': 'switch.5ce50cc485c7_alarm_trigger'}\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.643031398Z"}
{"log":"\u001b[36m2024-07-02 17:09:19.632 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'uid': '5ce50cc485c7', 'did': '317113676', 'msg': 'add_entity', 'entity': 'switch.5ce50cc485c7_led'}\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.643925044Z"}
{"log":"\u001b[36m2024-07-02 17:09:19.633 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'uid': '5ce50cc485c7', 'did': '317113676', 'msg': 'add_entity', 'entity': 'binary_sensor.5ce50cc485c7_gateway'}\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.644928095Z"}
{"log":"\u001b[36m2024-07-02 17:09:19.718 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.XXX.XXX.XX.XXX] {'msg': \"Can't prepare gateway\"}\n","stream":"stderr","time":"2024-07-02T15:09:19.721695994Z"}
{"log":"Traceback (most recent call last):\n","stream":"stderr","time":"2024-07-02T15:09:19.721793973Z"}
{"log":"  File \"/config/custom_components/xiaomi_gateway3/core/gateway.py\", line 95, in prepare_gateway\n","stream":"stderr","time":"2024-07-02T15:09:19.721842657Z"}
{"log":"    await self.lumi_read_devices(sh)\n","stream":"stderr","time":"2024-07-02T15:09:19.721888082Z"}
{"log":"  File \"/config/custom_components/xiaomi_gateway3/core/gate/lumi.py\", line 15, in lumi_read_devices\n","stream":"stderr","time":"2024-07-02T15:09:19.721932229Z"}
{"log":"    lumi = json.loads(raw)[\"devInfo\"]\n","stream":"stderr","time":"2024-07-02T15:09:19.721977802Z"}
{"log":"           ^^^^^^^^^^^^^^^\n","stream":"stderr","time":"2024-07-02T15:09:19.722022208Z"}
{"log":"  File \"/usr/local/lib/python3.12/json/__init__.py\", line 341, in loads\n","stream":"stderr","time":"2024-07-02T15:09:19.722065874Z"}
{"log":"    s = s.decode(detect_encoding(s), 'surrogatepass')\n","stream":"stderr","time":"2024-07-02T15:09:19.722109466Z"}
{"log":"        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n","stream":"stderr","time":"2024-07-02T15:09:19.722152835Z"}
{"log":"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 486: invalid start byte\u001b[0m\n","stream":"stderr","time":"2024-07-02T15:09:19.722195593Z"}

Im running: Version: 2024.6.4 Homeassistant docker container Version: 4.0.5 Xiaomi Gateway 3 installed via Hacs Version: 1.34.0 Hacs

Gateway information fw_ver: 1.5.6_0001 market_brand: Xiaomi market_model: ZNDMWG03LM market_name: Multimode Gateway type: gateway last_seen: {} listeners: 5 model: lumi.gateway.mgl03 params: {} ttl: 0s

I tried several custom firmware Versions from https://github.com/zvldz/mgl03_fw/tree/main/firmware/custom The firmware seems to be not relevant for this issue.

AlexxIT commented 4 months ago

You have broken file /data/zigbee/device.info. It should be at least: {"devInfo":[]}