Skip to content

Commit

Permalink
Govee H5055 decoder (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Mar 27, 2022
1 parent fca6b1d commit 4213d1a
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.exports = {
'devices/CGD1',
'devices/CGP1W',
'devices/GAEN',
'devices/H5055',
'devices/H5072',
'devices/H5075',
'devices/H5102',
Expand Down
12 changes: 12 additions & 0 deletions docs/devices/H5055.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Govee H5055

|Model Id|[H5055](https://github.com/theengs/decoder/blob/development/src/devices/H5055_json.h)|
|-|-|
|Brand|Govee|
|Model|Bluetooth BBQ Thermometer|
|Short Description|Bluetooth BBQ Thermometer with 6 probes|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power source|2 AA|
|Exchanged data|temperature, battery|
|Encrypted|No|
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class TheengsDecoder {
IBEACON,
WS02,
WS08,
H5055,
H5075,
H5072,
H5102,
Expand Down
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "devices/CGP1W_json.h"
#include "devices/CGPR1_json.h"
#include "devices/GAEN_json.h"
#include "devices/H5055_json.h"
#include "devices/H5072_json.h"
#include "devices/H5075_json.h"
#include "devices/H5102_json.h"
Expand Down Expand Up @@ -83,6 +84,7 @@ const char* _devices[][2] = {
{_ibeacon_json, _ibeacon_json_props},
{_WS02_json, _WS02_json_props},
{_WS08_json, _WS08_json_props},
{_H5055_json, _H5055_json_props},
{_H5075_json, _H5075_json_props},
{_H5072_json, _H5072_json_props},
{_H5102_json, _H5102_json_props},
Expand Down
72 changes: 72 additions & 0 deletions src/devices/H5055_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const char* _H5055_json = "{\"brand\":\"Govee\",\"model\":\"Bluetooth BBQ Thermometer\",\"model_id\":\"H5055\",\"condition\":[\"manufacturerdata\",\">=\",41,\"index\",12,\"06\",\"&\",\"manufacturerdata\",\"index\",26,\"06\",\"&\",\"manufacturerdata\",\"index\",40,\"0\"],\"properties\":{\"tempc1\":{\"condition\":[\"manufacturerdata\",14,\"!\",\"ffff\",\"&\",\"manufacturerdata\",10,\"0\",\"|\",\"manufacturerdata\",10,\"1\",\"|\",\"manufacturerdata\",10,\"2\",\"|\",\"manufacturerdata\",10,\"3\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",14,4,true,false]},\"tempc2\":{\"condition\":[\"manufacturerdata\",28,\"!\",\"ffff\",\"&\",\"manufacturerdata\",10,\"0\",\"|\",\"manufacturerdata\",10,\"1\",\"|\",\"manufacturerdata\",10,\"2\",\"|\",\"manufacturerdata\",10,\"3\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true,false]},\"tempc3\":{\"condition\":[\"manufacturerdata\",14,\"!\",\"ffff\",\"&\",\"manufacturerdata\",10,\"4\",\"|\",\"manufacturerdata\",10,\"5\",\"|\",\"manufacturerdata\",10,\"6\",\"|\",\"manufacturerdata\",10,\"7\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",14,4,true,false]},\"tempc4\":{\"condition\":[\"manufacturerdata\",28,\"!\",\"ffff\",\"&\",\"manufacturerdata\",10,\"4\",\"|\",\"manufacturerdata\",10,\"5\",\"|\",\"manufacturerdata\",10,\"6\",\"|\",\"manufacturerdata\",10,\"7\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true,false]},\"tempc5\":{\"condition\":[\"manufacturerdata\",14,\"!\",\"ffff\",\"&\",\"manufacturerdata\",10,\"8\",\"|\",\"manufacturerdata\",10,\"9\",\"|\",\"manufacturerdata\",10,\"a\",\"|\",\"manufacturerdata\",10,\"b\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",14,4,true,false]},\"tempc6\":{\"condition\":[\"manufacturerdata\",28,\"!\",\"ffff\",\"&\",\"manufacturerdata\",10,\"8\",\"|\",\"manufacturerdata\",10,\"9\",\"|\",\"manufacturerdata\",10,\"a\",\"|\",\"manufacturerdata\",10,\"b\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",8,2,false]}}}";
/*R""""(
{
"brand":"Govee",
"model":"Bluetooth BBQ Thermometer",
"model_id":"H5055",
"condition":["manufacturerdata", ">=", 41, "index", 12, "06", "&", "manufacturerdata", "index", 26, "06", "&", "manufacturerdata", "index", 40, "0"],
"properties":{
"tempc1":{
"condition":["manufacturerdata", 14, "!", "ffff", "&", "manufacturerdata", 10, "0", "|", "manufacturerdata", 10, "1", "|", "manufacturerdata", 10, "2", "|", "manufacturerdata", 10, "3"],
"decoder":["value_from_hex_data", "manufacturerdata", 14, 4, true, false]
},
"tempc2":{
"condition":["manufacturerdata", 28, "!", "ffff", "&", "manufacturerdata", 10, "0", "|", "manufacturerdata", 10, "1", "|", "manufacturerdata", 10, "2", "|", "manufacturerdata", 10, "3"],
"decoder":["value_from_hex_data", "manufacturerdata", 28, 4, true, false]
},
"tempc3":{
"condition":["manufacturerdata", 14, "!", "ffff", "&", "manufacturerdata", 10, "4", "|", "manufacturerdata", 10, "5", "|", "manufacturerdata", 10, "6", "|", "manufacturerdata", 10, "7"],
"decoder":["value_from_hex_data", "manufacturerdata", 14, 4, true, false]
},
"tempc4":{
"condition":["manufacturerdata", 28, "!", "ffff", "&", "manufacturerdata", 10, "4", "|", "manufacturerdata", 10, "5", "|", "manufacturerdata", 10, "6", "|", "manufacturerdata", 10, "7"],
"decoder":["value_from_hex_data", "manufacturerdata", 28, 4, true, false]
},
"tempc5":{
"condition":["manufacturerdata", 14, "!", "ffff", "&", "manufacturerdata", 10, "8", "|", "manufacturerdata", 10, "9", "|", "manufacturerdata", 10, "a", "|", "manufacturerdata", 10, "b"],
"decoder":["value_from_hex_data", "manufacturerdata", 14, 4, true, false]
},
"tempc6":{
"condition":["manufacturerdata", 28, "!", "ffff", "&", "manufacturerdata", 10, "8", "|", "manufacturerdata", 10, "9", "|", "manufacturerdata", 10, "a", "|", "manufacturerdata", 10, "b"],
"decoder":["value_from_hex_data", "manufacturerdata", 28, 4, true, false]
},
"batt":{
"decoder":["value_from_hex_data", "manufacturerdata", 8, 2, false]
}
}
})"""";*/

const char* _H5055_json_props = "{\"properties\":{\"tempc1\":{\"unit\":\"°C\",\"name\":\"tempc1\"},\"tempc2\":{\"unit\":\"°C\",\"name\":\"tempc2\"},\"tempc3\":{\"unit\":\"°C\",\"name\":\"tempc3\"},\"tempc4\":{\"unit\":\"°C\",\"name\":\"tempc4\"},\"tempc5\":{\"unit\":\"°C\",\"name\":\"tempc5\"},\"tempc6\":{\"unit\":\"°C\",\"name\":\"tempc6\"},\"batt\":{\"unit\":\"%\",\"name\":\"battery\"}}}";
/*R""""(
{
"properties":{
"tempc1":{
"unit":"°C",
"name":"tempc1"
},
"tempc2":{
"unit":"°C",
"name":"tempc2"
},
"tempc3":{
"unit":"°C",
"name":"tempc3"
},
"tempc4":{
"unit":"°C",
"name":"tempc4"
},
"tempc5":{
"unit":"°C",
"name":"tempc5"
},
"tempc6":{
"unit":"°C",
"name":"tempc6"
},
"batt":{
"unit":"%",
"name":"battery"
}
}
})"""";*/
16 changes: 14 additions & 2 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ const char* expected_mfg[] = {
"{\"brand\":\"GENERIC\",\"model\":\"IBEACON\",\"model_id\":\"IBEACON\",\"mfid\":\"4c00\",\"uuid\":\"fda50693a4e24fb1afcfc6eb07647825\",\"major\":1,\"minor\":2,\"volt\":2.6}",
"{\"brand\":\"SensorBlue\",\"model\":\"WS02\",\"model_id\":\"WS02\",\"tempc\":31.3125,\"tempf\":88.3625,\"hum\":70.75,\"volt\":3.160}",
"{\"brand\":\"SensorBlue\",\"model\":\"WS08\",\"model_id\":\"WS08\",\"tempc\":31.3125,\"tempf\":88.3625,\"hum\":70.75,\"volt\":3.160}",
"{\"brand\":\"Govee\",\"model\":\"Bluetooth BBQ Thermometer\",\"model_id\":\"H5055\",\"tempc1\":23,\"tempf1\":73.4,\"tempc2\":115,\"tempf2\":239,\"batt\":70}",
"{\"brand\":\"Govee\",\"model\":\"Bluetooth BBQ Thermometer\",\"model_id\":\"H5055\",\"tempc3\":86,\"tempf3\":186.8,\"tempc4\":145,\"tempf4\":293,\"batt\":65}",
"{\"brand\":\"Govee\",\"model\":\"Bluetooth BBQ Thermometer\",\"model_id\":\"H5055\",\"tempc5\":92,\"tempf5\":197.6,\"tempc6\":55,\"tempf6\":131,\"batt\":97}",
"{\"brand\":\"Govee\",\"model\":\"Bluetooth BBQ Thermometer\",\"model_id\":\"H5055\",\"tempc6\":84,\"tempf6\":183.2,\"batt\":83}",
"{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrometer\",\"model_id\":\"H5075\",\"tempc\":26.8,\"tempf\":80.24,\"hum\":52.6,\"batt\":100}",
"{\"brand\":\"Govee\",\"model\":\"Thermo Hygrometer\",\"model_id\":\"H5072\",\"tempc\":27.5,\"tempf\":81.5,\"hum\":53.1,\"batt\":100}",
"{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrometer\",\"model_id\":\"H5102\",\"tempc\":21.9,\"tempf\":71.42,\"hum\":40.6,\"batt\":100}",
Expand Down Expand Up @@ -189,6 +193,10 @@ const char* test_mfgdata[][3] = {
{"iBeacon", "NRF51822", "4c000215fda50693a4e24fb1afcfc6eb07647825000100021a"},
{"WS02", "ThermoBeacon", "100000001a110000f770580cf5016c0443090000"},
{"WS08", "ThermoBeacon", "110000001a110000f770580cf5016c0443090000"},
{"H5055", "GVH5055", "cf040400461b061700ffff2c01067300ffff2c010000"},
{"H5055", "GVH5055", "cf040400417f065600ffff2c01069100ffff2c010"},
{"H5055", "GVH5055", "cf04040061bf065c00ffff2c01063700ffff2c010000"},
{"H5055", "GVH5055", "cf040400538f06ffffffff2c01065400ffff2c010"},
{"H5075", "GVH5075_1234", "88ec000418ee6400"},
{"H5072", "GVH5072_1234", "88ec0004344b6400"},
{"H5102", "GVH5102_1234", "0100010103590e64"},
Expand Down Expand Up @@ -222,6 +230,10 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::IBEACON,
TheengsDecoder::BLE_ID_NUM::WS02,
TheengsDecoder::BLE_ID_NUM::WS08,
TheengsDecoder::BLE_ID_NUM::H5055,
TheengsDecoder::BLE_ID_NUM::H5055,
TheengsDecoder::BLE_ID_NUM::H5055,
TheengsDecoder::BLE_ID_NUM::H5055,
TheengsDecoder::BLE_ID_NUM::H5075,
TheengsDecoder::BLE_ID_NUM::H5072,
TheengsDecoder::BLE_ID_NUM::H5102,
Expand Down Expand Up @@ -391,7 +403,7 @@ int main() {

DeserializationError error = deserializeJson(doc_exp, decoder.getTheengProperties(bleObject["model_id"].as<const char*>()));
if (error) {
std::cout << "deserializeJson() failed: " << error << std::endl;
std::cout << "trying " << test_mfgdata[i][0] << " : " << test_mfgdata[i][1] << " : " << test_mfgdata[i][2] << std::endl;
return 1;
}

Expand All @@ -406,7 +418,7 @@ int main() {

for (unsigned int i = 0; i < sizeof(test_mfgdata) / sizeof(test_mfgdata[0]); ++i) {
doc.clear();
std::cout << "trying " << test_mfgdata[i][0] << " : " << test_mfgdata[i][1] << std::endl;
std::cout << "trying " << test_mfgdata[i][0] << " : " << test_mfgdata[i][1] << " : " << test_mfgdata[i][2] << std::endl;
doc["name"] = test_mfgdata[i][1];
doc["manufacturerdata"] = test_mfgdata[i][2];
bleObject = doc.as<JsonObject>();
Expand Down

0 comments on commit 4213d1a

Please sign in to comment.