Need Help: Xiaomi Gateway 3 Integration Issues After Home Assistant 2023.6.1 Update

Hello,

I recently updated HomeAssistant to the latest version - Home Assistant 2023.6.1. After the update, the integration for Xiaomi Gateway 3 (custom component GitHub - AlexxIT/XiaomiGateway3: Control Zigbee, BLE and Mesh devices from Home Assistant with Xiaomi Gateway 3 on original firmware) became unavailable. So, I removed it and installed the “Xiomi Miio” integration for “Xiaomi Gateway 3”. In the settings, I provided my login, password, and country for connection via Xiaomi Miio Cloud. The devices were identified.

However, the gateway’s alarm_control_panel.shliuz_alarm status is “unavailable”. The controls for its “Armed” and “Disarmed” states are also unavailable.

Here are the entries from my Home Assistant Core Logs:

ERROR
Logger: miio.miioprotocol
Source: /usr/local/lib/python3.11/site-packages/miio/miioprotocol.py:255
First occurred: 14:49:45 (15 occurrences)
Last logged: 14:53:15
Got error when receiving: {'code': -9999, 'message': 'user ack timeout'}
Warning
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:754
First occurred: 14:59:25 (43 occurrences)
Last logged: 15:09:55
Update of alarm_control_panel.gateway_alarm is taking over 10 seconds
Update of sensor.gateway_illuminance is taking over 10 seconds

I couldn’t find a solution to the problem on the Google forum. Could anyone help me figure out what’s going wrong?

Additionally:

The temperature/humidity sensors and leak detectors were identified and are working correctly. They are grouped under Xiaomi BLE.

Raspberry Pi 4 (rpi4-64)

lumi.gateway.mgl03 
Software version: 1.5.5_0006

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.6.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.3",
    "docker": true,
    "arch": "aarch64",
    "timezone": "**REDACTED**",
    "os_name": "Linux",
    "os_version": "6.1.21-v8",
    "supervisor": "2023.06.1",
    "host_os": "Home Assistant OS 10.2",
    "docker_version": "23.0.6",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "sonoff": {
      "version": "3.3.1",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    }
  },
  "integration_manifest": {
    "domain": "xiaomi_miio",
    "name": "Xiaomi Miio",
    "codeowners": [
      "@rytilahti",
      "@syssi",
      "@starkillerOG"
    ],
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/xiaomi_miio",
    "iot_class": "local_polling",
    "loggers": [
      "micloud",
      "miio"
    ],
    "requirements": [
      "construct==2.10.56",
      "micloud==0.5",
      "python-miio==0.5.12"
    ],
    "zeroconf": [
      "_miio._udp.local."
    ],
    "is_built_in": true
  },
  "data": {
    "config_entry": {
      "entry_id": "**REDACTED**",
      "version": 1,
      "domain": "xiaomi_miio",
      "title": "\u0428\u043b\u044e\u0437",
      "data": {
        "config_flow_device": "gateway",
        "host": "**REDACTED**",
        "token": "**REDACTED**",
        "model": "lumi.gateway.mgl03",
        "mac": "**REDACTED**",
        "cloud_username": "**REDACTED**",
        "cloud_password": "**REDACTED**",
        "cloud_country": "cn"
      },
      "options": {
        "cloud_subdevices": true
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "**REDACTED**",
      "disabled_by": null
    }
  }
}

I had this issue for a good while now and I recently found out why this is happening.

In order to get the relevant information for the gateway I had to connect via the cloud account first. So for convenience I left this connection in place, just in case.

It turns out having the 2 connection, cloud and local, disturbs the local one causing it to become unavailable regularly. I would fix this by changing the IP and reconnecting but it would become unavailable in a matter of minutes.

After disabling the cloud connection the local connection is stable. I’ve been testing that for a number of days now and it hasn’t been unavailable once… so far at least.