A BLE thermometer
A few years ago, I bought the XIAOMI Mijia LYWSDCGQ which was nice but not really cheap. Its fun characteristic was its ability to broadcast the data (temperature, humidity, battery) as well as having a connected/polled mode.
And another one
Then XIAOMI released a smaller & cheaper version (LYWSD03MMC) running on 3V lithium batteries. Trouble was, they also introduced a "bindkey". Apparently the idea behind was two-fold: To force people to use the official app only and to avoid broadcasting unencrypted data. Well.... whatever...
It wasn't long before someone found a way to intercept the key. The method was awkward at the begining but the process rapidly became easier.
Alternative firmware
Then, the masterstroke came from Aaron Christophel (aka atc1441) who astonished people by releasing an alternative firmware (removing the need of a key) for these device and providing a way to flash them directly from a Chrome browser on a mobile!
Security aspects aside, this is absolutely awesome!!!
ESPHome and OpenMQTTGateway
So I decided to try them and started using ESPHome. Even if the technology is Bluetooth Low Energy, the reaching distance is quite impressive.
ESPHome ecosystem is not bad (far from it) but one needs to define all bluetooth addresses and push a new configuration to the gateway everytime a new thermometer is added (or switched from one protocol to another). I quickly grew tired of it and started to use OpenMQTTGateway instead.
The documentation and the different websites/blog/repositories/libraries make it a little bit messy but the product works quite well and the basic idea is simple:
One board (predominantly ESP8266/ESP32 based) is acting as a gateway between a type of device (RF or BLE mainly -- others are also available) and a MQTT broker.
I'll come back to the RF gateway another time but right now, we are taking about an ESP32 devkit listening to BLE broadcasts and forwarding them as MQTT messages.
The result is something along the lines of:
OpenMQTTGateway_ESP32_BLE/BTtoMQTT/A4C138123456 {"id":"A4:C1:38:12:34:56","name":"ATC_123456","rssi":-30,"model":"LYWSD03MMC_ATC","tempc":21.4,"tempf":70.52,"hum":66,"batt":76,"volt":2.894}
There is nothing to change on the gateway to add new sensors or if you switch from ATC to Xiaomi native protocol (or vice-versa). You only have to select the MQTT messages you want to keep (although there is a white-list feature, should the local laws require filtering).
From an Android Mobile
Aside from the gateway, there is (on Google Play) a handy application called MijiaTemp which is useful to debug and/or check what the sensors are doing.
For information, an new paying one Theengs BLE as appeared recently. I haven't tested it, so I am only mentioning it.
Ecosystem as a diagram
The ecosystem is now: