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.43k stars 341 forks source link

Alarm & Firmware Lock controls are unavailable #775

Closed liorpapir closed 1 year ago

liorpapir commented 2 years ago

Hi,

I'm using the maintained firmware (v1.5.0_0102) and everything works great except for the Mi Smart Home Hub controls. I cannot enable/disable firmware lock or arm/disarm the alarm. It used to work a while ago, but one day just became unavailable. I can control the alarm with the Mi Home app, but not through the XiaomiGateway3 integration.

I tried to reboot gateway, but it didn't help. All the devices that are connected to the gateway are working properly, it's only the gateway controls that are not available.

Thanks ahead for any help.

Screenshot: https://ibb.co/wy9QhRX Integration debug (removed IP address):

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.6.7",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.12",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Asia/Jerusalem",
    "os_name": "Linux",
    "os_version": "5.15.45",
    "supervisor": "2022.05.3",
    "host_os": "Home Assistant OS 8.2",
    "docker_version": "20.10.14",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.25.5",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "mass": {
      "version": "2022.6.10",
      "requirements": [
        "music-assistant==1.4.11"
      ]
    },
    "smartthings_soundbar": {
      "version": "v1.0.2",
      "requirements": []
    },
    "localtuya": {
      "version": "4.0.1",
      "requirements": []
    },
    "scheduler": {
      "version": "v0.0.0",
      "requirements": []
    },
    "citymind_water_meter": {
      "version": "1.0.5",
      "requirements": [
        "requests",
        "beautifulsoup4"
      ]
    },
    "sonoff": {
      "version": "3.0.5",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "edgeos": {
      "version": "1.2.6",
      "requirements": [
        "aiohttp"
      ]
    },
    "electrasmart": {
      "version": "2022.4.25",
      "requirements": [
        "electrasmart~=0.7.0"
      ]
    },
    "xiaomi_gateway3": {
      "version": "2.1.0",
      "requirements": [
        "zigpy>=0.33.0"
      ]
    }
  },
  "integration_manifest": {
    "domain": "xiaomi_gateway3",
    "name": "Xiaomi Gateway 3",
    "config_flow": true,
    "documentation": "https://github.com/AlexxIT/XiaomiGateway3",
    "issue_tracker": "https://github.com/AlexxIT/XiaomiGateway3/issues",
    "codeowners": [
      "@AlexxIT"
    ],
    "dependencies": [
      "http"
    ],
    "requirements": [
      "zigpy>=0.33.0"
    ],
    "version": "2.1.0",
    "iot_class": "local_push",
    "is_built_in": false
  },
  "data": {
    "version": "3d126a5",
    "options": {
      "host": "***",
      "token": "***",
      "telnet_cmd": "{\"method\":\"set_ip_info\",\"params\":{\"ssid\":\"\\\"\\\"\",\"pswd\":\"123123 ; passwd -d admin ; echo enable > /sys/class/tty/tty/enable; telnetd\"}}",
      "ble": true,
      "stats": false,
      "debug": [],
      "buzzer": false,
      "memory": false,
      "zha": false
    },
    "errors": [
      {
        "name": "custom_components.xiaomi_gateway3.core.gateway",
        "message": [
          "xxx.x.x.xxx | Can't prepare gateway"
        ],
        "level": "ERROR",
        "source": [
          "custom_components/xiaomi_gateway3/core/shell/__init__.py",
          25
        ],
        "timestamp": 1656865066.9382315,
        "exception": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.9/asyncio/streams.py\", line 52, in open_connection\n    transport, _ = await loop.create_connection(\n  File \"/usr/local/lib/python3.9/asyncio/base_events.py\", line 1050, in create_connection\n    sock = await self._connect_sock(\n  File \"/usr/local/lib/python3.9/asyncio/base_events.py\", line 961, in _connect_sock\n    await self.sock_connect(sock, address)\n  File \"/usr/local/lib/python3.9/asyncio/selector_events.py\", line 499, in sock_connect\n    return await fut\nasyncio.exceptions.CancelledError\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.9/asyncio/tasks.py\", line 490, in wait_for\n    return fut.result()\nasyncio.exceptions.CancelledError\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"/config/custom_components/xiaomi_gateway3/core/gateway/__init__.py\", line 166, in prepare_gateway\n    async with shell.Session(self.host) as session:\n  File \"/config/custom_components/xiaomi_gateway3/core/shell/__init__.py\", line 25, in __aenter__\n    self.reader, self.writer = await asyncio.wait_for(self.coro, 5)\n  File \"/usr/local/lib/python3.9/asyncio/tasks.py\", line 492, in wait_for\n    raise exceptions.TimeoutError() from exc\nasyncio.exceptions.TimeoutError\n",
        "count": 1,
        "first_occurred": 1656865066.9382315
      },
      {
        "name": "custom_components.xiaomi_gateway3.core.mini_miio",
        "message": [
          "xxx.x.x.xxx | Device offline"
        ],
        "level": "WARNING",
        "source": [
          "custom_components/xiaomi_gateway3/core/mini_miio.py",
          324
        ],
        "timestamp": 1656865332.9001598,
        "exception": "",
        "count": 4,
        "first_occurred": 1656864522.952829
      },
      {
        "name": "custom_components.xiaomi_gateway3.core.gateway",
        "message": [
          "xxx.x.x.xxx | Can't prepare gateway",
          "xxx.x.x.xxx | Can't update gateway stats"
        ],
        "level": "ERROR",
        "source": [
          "custom_components/xiaomi_gateway3/core/shell/__init__.py",
          34
        ],
        "timestamp": 1656933888.532765,
        "exception": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.9/asyncio/streams.py\", line 632, in readuntil\n    await self._wait_for_data('readuntil')\n  File \"/usr/local/lib/python3.9/asyncio/streams.py\", line 517, in _wait_for_data\n    await self._waiter\nasyncio.exceptions.CancelledError\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.9/asyncio/tasks.py\", line 490, in wait_for\n    return fut.result()\nasyncio.exceptions.CancelledError\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"/config/custom_components/xiaomi_gateway3/core/gateway/__init__.py\", line 167, in prepare_gateway\n    sh = await session.login()\n  File \"/config/custom_components/xiaomi_gateway3/core/shell/__init__.py\", line 34, in login\n    resp: bytes = await asyncio.wait_for(coro, 3)\n  File \"/usr/local/lib/python3.9/asyncio/tasks.py\", line 492, in wait_for\n    raise exceptions.TimeoutError() from exc\nasyncio.exceptions.TimeoutError\n",
        "count": 2,
        "first_occurred": 1656865261.8900914
      }
    ],
    "error": "KeyError: '0x847127fffe3ca5e5'"
  }
}
Niconaco commented 2 years ago

Ciao, ho anch'io questo problema, ho provato ad eliminare tutto e rifare da capo ma non riesco più ad accedere, se provo ad accedere mi dice di seguire il link per il 2fa, lo seguo faccio tutti i procedimenti mi da la conferma con ok ma in ha non cambia niente e me lo richiede all'infinito, tu sei riuscito a risolvere? Grazie

liorpapir commented 2 years ago

Hi Niconaco, No unfortunately I haven't managed to solve the issue. Still cannot toggle any of the above to change their status. I hope someone will be able to help. Thanks, Lior

AlexxIT commented 2 years ago

You have a lot of different errors related to the connection to gateway.

liorpapir commented 2 years ago

You have a lot of different errors related to the connection to gateway.

Thanks for your response @AlexxIT :) Any suggestions on what should I do? Shall I try to remove the integration and add it back? Any chance that this will help? If I do so, will I have to update all of my automations or the existing entities of the different zigbee devices will remain the same? Thanks ahead, Lior

AlexxIT commented 2 years ago

I never saw so many different errors about connection. And don't know history of your gateway. Maybe you need to change your home router. Maybe change some router settings. Maybe change gateway position. Maybe reset gateway...

AlexxIT commented 1 year ago

Please reopen the issue if it is still relevant