theengs / app

Theengs mobile application to read BLE sensors and push data to an MQTT broker
https://app.theengs.io
GNU General Public License v3.0
37 stars 7 forks source link

Qingping Alarm Clock CGD1 not fetching data on iOS #56

Closed DigiH closed 1 year ago

DigiH commented 1 year ago

iOS release version 1.2

Having received my new Qingping Alarm Clock CGD1 and trying to add it to Theengs iOS 1.2 I always only ever get it to be recognised as Offline. With the (later Actions run build) macOS version it shows up fine immediately.

Looking through the code I also found https://github.com/theengs/app/blob/development/src/devices/device_hygrotemp_cgd1.cpp#L114

if ((data[0] == 0x88 && data[1] == 0x16) || // CGG1
            (data[0] == 0x08 && data[1] == 0x07) || // CGG1
            (data[0] == 0x88 && data[1] == 0x10) || // CGDK2
            (data[0] == 0x08 && data[1] == 0x10) || // CGDK2
            (data[0] == 0x08 && data[1] == 0x09) || // CGP1W
            (data[0] == 0x08 && data[1] == 0x0c))   // CGD1
        {

which should be adjusted to only take the data[1] byte as the device ID condition - like all the adjusted decoders do for the sole device ID- as the data[0] byte alters with hardware revisions. Also in other similar occurrences it should just be

if (data[1] == 0x16 || // CGG1
            data[1] == 0x07 || // CGG1
            data[1] == 0x10 || // CGDK2
            data[1] == 0x09 || // CGP1W
            data[1] == 0x0c)   // CGD1
        {

Why however my CGD1, which broadcasts manufacturerdata starting with 880c…, is correctly recognised and updated with its data on macOS I haven't really investigated.

iOS CGD1iOS

macOS CGD1macOS

DigiH commented 1 year ago

Closing as fixed with latest 1.3