BLE gateway from Xiaomi Gateway DGNWG05LM * without BLE

(eu version - lumi.gateway.mieu01)

In this post I will tell you how you can collect BLE data and transfer via MQTT to smart home systems, for example, HomeAssistant.





How it all began?

: . root , miio HA openwrt . , , .





zigbee2mqtt . zigbee-herdsman, @xiaomi_gw_hack openwrt , ( RGB, , , wi-fi ).





@lenz1986, @Alx2000y, @belokobylskiy!





, wifi rtl8723bs bluetooth BLE.





bluetooth. uart, — . @lenz1986





Several boards helped a lot to understand the inner world of the gateway.
This is how the board looks like without a processor)
)

, 4 UART . uart bluetooth wifi rtl8723bs. uart DTB, openwrt . @lenz1986 !









! openwrt . uart . ( @divanikus)





https://openlumi.github.io/





Bluetooth rtk_hciattach . hciconfig







2 , bluetooth .





  • hciconfig hci0 up







  • AutoEnable



      /etc/bluetooth/main.conf



    true







  . . hcitool lescan







BLE

BLE , - zigbee2mqtt. Node.Js, node-red. EspruinoHub. ( , )





mqtt , CLI web LYWSDCGQ ( ) .





I used to listen to them on esp32 via esphome.  A small comparison of the received data from one thermometer.
esp32 esphome. .

, , raw . .





example of cli interface with the status of available devices
cli

Xiaomi bluetooth BLE Advertising Packet, , . , .





MiBand .





xiaomi, BLE fe95. . github . espruino , hannseman/homebridge-mi-hygrothermograph. .





Xiaomi, fe95. (, , ), .





EspruinoHub , . , bindKey . bindKey miHome.





MQTT Discovery - Home Assistant

, HomeAssistant. EspruinoHub , . , config homeassistant mqtt





.

raw ( ).





LYWSDCGQ - " ". mqtt discovery HA





testimony before

LYWSD02 - ,






LYWSD03MMC - , ( bindKey). 2 , . pvvx. . , .






MI SCALE - 181d v1 - ( ) - ( ) - . 181b v2 , . -






Mi band 3 fee0 . MiFit.





, . Amazfit GTS






HHCCJCY01 MiFlora, Huahuacaocao - temperature, moisture, illuminance, conductivity, battery_level





. , mqtt bindKey .





YEERC - esp32 tasmota , . YEELIGHT, 32 bindKey . , . ( event counter ) - . . .





EspruinoHub Xiaomi OpenWrt ?

git / npm, EspruinoHub





opkg





https://openlumi.github.io/openwrt-packages/





.





opkg update
opkg install node-espruinohub
      
      



- mqtt . mqtt, /etc/espruinohub/config.json







! . ( )





. "only_known_devices": true



, .





HomeAssistant json , . .





"mqtt_format_json": true,
"homeassistant": true,
"mqtt_cache_state": true
      
      



rssi . rssi .





data from devices fly quite often if they are in line of sight.
.

: BLE, Bluetooth . .





opensource BLE

  • devbis/ble2mqtt - python bleak, , .





  • Beetle-II/lumi - hannseman/homebridge-mi-hygrothermograph, bindKey . raw mqtt. + BLE.





, !





, .








All Articles