Mantoui / XiaomiGateway3

Control Zigbee and BLE devices from Home Assistant with Xiaomi Gateway 3 (ZNDMWG03LM) on original firmware

Home Page:https://www.youtube.com/c/AlexxIT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xiaomi Gateway 3 integration for Home Assistant

hacs_badge Donate Donate

Control Zigbee devices from Home Assistant with Xiaomi Gateway 3 (ZNDMWG03LM) on original firmware.

Gateway support Zigbee 3, Bluetooth Mesh and HomeKit.

This method does not change the device firmware. Gateway continues to work with Mi Home and HomeKit.

Thanks to Serrj for instruction how to enable Telnet on this device.

Important: This component does not work with:

  • Xiaomi Gateway 2 (DGNWG02LM, lumi.gateway.v3) - use this component
  • Xiaomi Gateway EU (DGNWG05LM, lumi.gateway.mieu01)

Supported Zigbee Devices

Tested Devices:

  • Aqara Bulb (ZNLDP12LM)
  • Aqara Button (WXKG11LM)
  • Aqara Cube (MFKZQ01LM)
  • Aqara Door Sensor (MCCGQ11LM)
  • Aqara Double Wall Button (WXKG02LM)
  • Aqara Motion Sensor (RTCGQ11LM)
  • Aqara Opple Six Button (WXCJKG13LM)
  • Aqara Relay (LLKZMK11LM)
  • Aqara Socket (QBCZ11LM)
  • Aqara Vibration Sensor (DJT11LM)
  • Aqara Wall Double Switch (QBKG03LM)
  • Aqara Water Leak Sensor (SJCGQ11LM)
  • IKEA Bulb E14
  • Xiaomi Button (WXKG01LM)
  • Xiaomi Door Sensor (MCCGQ01LM)
  • Xiaomi Light Sensor (GZCGQ01LM)
  • Xiaomi Motion Sensor (RTCGQ01LM)
  • Xiaomi Plug (ZNCZ02LM)
  • Xiaomi Plug EU (ZNCZ04LM)
  • Xiaomi TH Sensor (WSDCGQ01LM)

Currently supported, but not tested other Xiaomi and Aqara Zibee devices officially supported by the Gateway. Check list here.

Plans to support for Zigbee devices from other manufacturers. May be support for ZHA.

Supported BLE Devices

Demo video:

Xiaomi Rubik's Cube

Tested Devices:

  • Xiaomi Door Sensor 2 (MCCGQ02HL)
  • Xiaomi Flower Monitor (HHCCJCY01)
  • Xiaomi Rubik's Cube (XMMF01JQD) - don't sends edge info, only direction!
  • Xiaomi TH Sensor (LYWSD03MMC)
  • Xiaomi TH Sensor (LYWSDCGQ/01ZM)
  • Xiaomi TH Watch (LYWSD02MMC)

Currently supported, but not tested, other Xiaomi BLE devices officially supported by the Gateway with these attributes:

temperature, humidity, motion, illuminance, moisture, conductivity, formaldehyde, mosquitto, battery

BLE devices and their attributes do not appear immediately! And don't save their data across HA reboots! Their data is updated only when the device itself sends them. Temperature, humidity and battery may refresh at different times.

Install

HOWTO video:

Xiaomi Gateway 3 control from Home Assistant

You can install component with HACS custom repo (example): AlexxIT/XiaomiGateway3.

Or manually copy xiaomi_gateway3 folder from latest release to custom_components folder in your config folder.

Config

With GUI. Configuration > Integration > Xiaomi Gateway 3. And enter Gateway IP address and Mi Home token.

You need obtain Mi Home token. I am using the method with Mi Home v5.4.54 for non-rooted Android. If you don't have an Android - you can install the emulator on Windows.

Advanced config

Support custom occupancy timeout for motion sensor. Default 90 seconds.

xiaomi_gateway3:
  devices:
    '0x158d00044c5dff':
      occupancy_timeout: 90  # (optional) default 90 seconds

How it works

The component enables Telnet on Gateway via Miio protocol. Only this Gateway supports this command. Do not try to execute it on other Xiaomi/Aqara Gateways.

The component starts the MQTT Server on the public port of the Gateway. All the logic in the Gateway runs on top of the built-in MQTT Server. By default, access to it is closed from the outside.

ATTENTION: Telnet and MQTT work without a password! Do not use this method on public networks.

After rebooting the device, all changes will be reset. The component will launch Telnet and public MQTT every time it detects that they are disabled.

Debug mode

Component support debug mode. Shows only component logs. The link to the logs is always random.

Demo video of my other component, but the idea is the same:

Control Sonoff Devices with eWeLink firmware over LAN from Home Assistant

With debug: bluetooth or debug debug: mqtt opntion you will get advanced log for raw BLE and MQTT data.

With debug: true option you will get usual component logs.

xiaomi_gateway3:
  debug: true  # you will get HA notification with a link to the logs page

You can filter data in the logs and enable auto refresh (in seconds).

http://192.168.1.123:8123/c4e99cfc-0c83-4a39-b7f0-278b0e719bd1?q=ble_event&r=2

About

Control Zigbee and BLE devices from Home Assistant with Xiaomi Gateway 3 (ZNDMWG03LM) on original firmware

https://www.youtube.com/c/AlexxIT


Languages

Language:Python 100.0%