Qingping CGDK2
The Qingping model CGDK2 is a indoor hygrometer and displays the temperature and humidity. This unit features Bluetooth LE which can be used to remotely monitor its readings.
MQTT
Out of the box, the sensor readings are broadcast every few seconds and can be read and converted into MQTT messages using OpenMQTTGateway. Messages look like this:
id: "58:2D:34:14:10:E8"
mac_type: 0
name: "Qingping Temp RH Lite"
rssi: -69
brand: "Qingping"
model: "TH lite"
model_id: "CGDK2"
tempc: 22.8
tempf: 73.04
hum: 46.1
The battery level is not reported here. It's only visible if you set the device up to use a bindKey using the app or the TelinkFlasher tool.
For my use case, I think the unencrypted form is easier to use so I dump the readings into InfluxDB using NodeRED.
Bluetooth data
Details about the data is discussed here: https://github.com/atc1441/ATC_MiThermometer/issues/135
Custom firmware
See: https://github.com/atc1441/ATC_MiThermometer
A custom firmware can be flashed either over the air with the TelinkFlasher tool or via serial. The serial connection for this device is:
Pin | Name | Test point |
---|---|---|
3 | UART RX | TP3 |
6 | UART TX | TP1 |
5 | SWS | TP17 |
The SWS pin is bidirectional and is used to flash a custom firmware. Connect the UART in the following way: (see https://github.com/pvvx/TlsrComProg825x)
Device | UART |
---|---|
SWS | to RX |
SWS | to TX via 1.8k resistor |
TX | to RX |
RX | to TX |
RST | to RTS |
You can then flash it using the TlsrComProg.py script by running python3 TlsrComProg.py -p /dev/tty.usbserial-2140 -t5000 wf 0 CGDK2_v37a.bin
.
Question: How do you dump the original firmware?
See also
- Get the bindKey with this tool - https://zaluthar.github.io/TelinkFlasher.html
- ESPHome driver - https://github.com/esphome/esphome/blob/beeb0c7c5af85fa9d05a5338a36b76a3d95084cf/esphome/components/xiaomi_cgdk2/xiaomi_cgdk2.cpp
- Pictures of the internals - https://pvvx.github.io/CGDK2/