Integrating all types of Xiaomi (Mijia) BLE devices into Hass, via TTL of BT gateway(s), by an ESP8266

by relaying messages from Gateway’s TTL to MQTT, running on ESP-01S (ESP8266).

It will relay the information of did/eid/edata from all the ttl messages contain ble_event to hass instance via mqtt, with the topic of mqttl/did xxxx/eid xxx and payload of edata.

On the HA side, the value of edata will be used to mapped to individual sensors.

Works with multiple BLE Gateways of different types and any kinds of Xiaomi (Mijia) BLE devices.


  1. Flash ESP module (by usb-ttl or OTA);
  2. Connect to the TTL pins of BLE Gateway device;
  3. Join the AP named mqttl_xxxx , with the password of mqttlpassword ;
  4. Configure WiFi and MQTT broker;
  5. Configure the sensors by yaml in Home Assistant (this step could be accomplished before flash ESP).

repo on Github

flashing an ESP32 with ESPHome (release 1.15.0 - currently in development) will allow all Xiaomi Mijia BLE Sensors to be connected to HA without the need of MQTT or other BLE Gateway device:

Thanks for your hint.

But the most important for me to integrate is the smart lock, which is not supported by ESPHome, even in release 1.15.0, while it could be integrated by my effort.

And there are many brands and models of smart lock, and other bt devices, could also be integrated this way.

ESPhome is nice, but not for this case.

1 Like

Its a BLE gateway, with an ESP-01S module connected via TTL.

I found that the device on the picture is a gateway from Zelkova smart lock. Probably other internationally-available smart lock gateways can have similar ttl output.