homebridge-mi-hygrothermograph icon indicating copy to clipboard operation
homebridge-mi-hygrothermograph copied to clipboard

Support for CGDK2?

Open bnussbau opened this issue 3 years ago • 3 comments

I'd like to see the Qingping Temp & RH Monitor Lite (CGDK2) supported. I saw there is an implementation for https://github.com/custom-components/ble_monitor available.

Can I support somehow to make this device compatible with homebridge-mi-hygrothermograph ?

image

Expected Behavior

Current Behavior

Steps to Reproduce (for bugs)

Versions

  • homebridge: homebridge --version
  • homebridge-mi-hygrothermograph: npm list --depth 1 --global homebridge-mi-hygrothermograph
  • node: node --version
  • OS:

Configuration


Homebridge Log / Command Output

[3/27/2021, 4:22:06 PM] [Innenthermometer all] No event
[3/27/2021, 4:22:10 PM] [Innenthermometer all] [58-2d-xx-xx-xx-xx] Discovered peripheral
      Id: 6e08ecfa3dca428297fdxxxxxxxxxxxx
      LocalName: Qingping Temp RH Lite
      rssi: -61
      serviceData: 30586f0626d69411342d5808

bnussbau avatar Mar 27 '21 16:03 bnussbau

20:07:11.3380: connected in underlying BLE layer.
20:07:11.3390: discovered services: (
    "Device Information",
    FE95,
    "22210000-554A-4546-5542-46534450464D",
    "00010203-0405-0607-0809-0A0B0C0D1912",
    "00000100-0065-6C62-2E74-6F696D2E696D"
)
20:07:11.4480: discovered characteristics for service 180A: (
    "Manufacturer Name String",
    "Model Number String",
    "Firmware Revision String",
    "Serial Number String",
    "Hardware Revision String"
)
20:07:11.4930: discovered characteristics for service 00010203-0405-0607-0809-0A0B0C0D1912: (
    "00010203-0405-0607-0809-0A0B0C0D2B12"
)
20:07:11.5610: discovered characteristics for service 22210000-554A-4546-5542-46534450464D: (
    0001,
    0002,
    0003,
    0004,
    0100
)
20:07:11.6510: discovered characteristics for service FE95: (
    0004,
    0010,
    0017,
    0018,
    0019
)
20:07:11.7410: discovered characteristics for service 00000100-0065-6C62-2E74-6F696D2E696D: (
    "00000101-0065-6C62-2E74-6F696D2E696D",
    "00000102-0065-6C62-2E74-6F696D2E696D"
)
20:07:11.7410: state changed to 'Connected'.
20:07:12.0780: received update from characteristic 2A25___180A: <35383244 33343131 39344436>
20:07:12.5060: received update from characteristic 2A27___180A: <30303031 0000>
20:07:12.5510: received update from characteristic 2A29___180A: <51696e67 70696e67 20546563 686e6f6c 6f677920 28426569 6a696e67 2920436f 2e2c204c 746400>
20:07:12.5730: received update from characteristic 2A24___180A: <4347444b 32000000 00000000>
20:11:24.6200: received update from characteristic 0004___FE95: <312e312e 315f3032 30390000 00000000 00000000>
20:11:24.6420: received update from characteristic 0004___FE95: <312e312e 315f3032 30390000 00000000 00000000>
20:11:31.0430: received update from characteristic 00010203-0405-0607-0809-0A0B0C0D2B12___00010203-0405-0607-0809-0A0B0C0D1912: <00>
20:11:31.0660: received update from characteristic 00010203-0405-0607-0809-0A0B0C0D2B12___00010203-0405-0607-0809-0A0B0C0D1912: <00>
20:11:40.9420: received update from characteristic 2A29___180A: <51696e67 70696e67 20546563 686e6f6c 6f677920 28426569 6a696e67 2920436f 2e2c204c 746400>
20:11:40.9450: received update from characteristic 2A25___180A: <35383244 33343131 39344436>
20:11:40.9450: received update from characteristic 2A29___180A: <51696e67 70696e67 20546563 686e6f6c 6f677920 28426569 6a696e67 2920436f 2e2c204c 746400>
20:11:40.9450: received update from characteristic 2A25___180A: <35383244 33343131 39344436>
20:11:40.9660: received update from characteristic 2A24___180A: <4347444b 32000000 00000000>
20:11:40.9880: received update from characteristic 2A26___180A: <322e302e 3900>
20:11:41.0110: received update from characteristic 2A27___180A: <30303031 0000>
20:11:41.0330: received update from characteristic 2A24___180A: <4347444b 32000000 00000000>
20:11:41.0560: received update from characteristic 2A26___180A: <322e302e 3900>
20:11:41.0780: received update from characteristic 2A27___180A: <30303031 0000>

Reference implementations:

  • https://github.com/zaluthar/esphome/commit/efb6a012c59a7cca10dc7e0b6610baefa13a629d
  • https://github.com/1technophile/OpenMQTTGateway/commit/2c2de8970698ed82e2e8afd1bdfce969ada54146

bnussbau avatar Mar 28 '21 19:03 bnussbau

after reading https://github.com/atc1441/ATC_MiThermometer/issues/135#issuecomment-748096538 i was able to understand how this works.

  1. Download Qingping+ App and pair CGDK2
  2. set SERVICE_DATA_UUID = "fdcd"
  3. Values are reported unencrypted.
Manufacturer Data
8810 000000042d58 01 04  14 01  21 02 0201 14
xxxx   MAC-addr.  xx xx  temp   hum   fw?  batt

var buffer = Buffer.from([0x88,0x10,0x00,0x00,0x00,0x34,0x2d,0x58,0x01,0x04,0x08,0x01,0x7e,0x01,0x02,0x01,0x14]);
var mac = buffer.slice(2,8);
var mac = mac.reverse();

var temp = buffer.readUInt16LE(10) / 10;
var hum = buffer.readUInt16LE(12) / 10;
var bat = buffer.readUInt8(16)
console.log("[" + mac.toString("hex") + "]" , "temp: " + temp, "hum:" + hum, "battery:" + bat + "%" );
//[582d341194d6] temp: 26.4 hum:38.2 battery:20%
[582d34000000] temp: 26.4 hum:38.2 battery:20%

bnussbau avatar Mar 30 '21 07:03 bnussbau

https://github.com/ormisum/homebridge-hygrothermograph-cgdk2

ormisum avatar Apr 17 '21 09:04 ormisum