diff --git a/docs/devices/HHCCPOT002.md b/docs/devices/HHCCPOT002.md new file mode 100644 index 000000000..51d61effe --- /dev/null +++ b/docs/devices/HHCCPOT002.md @@ -0,0 +1,12 @@ +# Xiaomi RoPot + +|Model Id|[HHCCPOT002](https://github.com/theengs/decoder/blob/development/src/devices/HHCCPOT002_json.h)| +|-|-| +|Brand|Xiaomi| +|Model|RoPot| +|Short Description|Moisture, temperature and fertility sensor| +|Communication|BLE broadcast| +|Frequency|2.4Ghz| +|Power source|CR2032| +|Exchanged data|temperature, moisture, fertility| +|Encrypted|No| diff --git a/src/decoder.h b/src/decoder.h index c42df9151..1bbbadfc3 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -86,6 +86,7 @@ class TheengsDecoder { BM_V23, MS_CDP, GAEN, + HHCCPOT002, BLE_ID_MAX }; diff --git a/src/devices.h b/src/devices.h index b00a27289..3ed3dca87 100644 --- a/src/devices.h +++ b/src/devices.h @@ -31,6 +31,7 @@ #include "devices/H5075_json.h" #include "devices/H5102_json.h" #include "devices/HHCCJCY01HHCC_json.h" +#include "devices/HHCCPOT002_json.h" #include "devices/IBS_TH1_json.h" #include "devices/IBS_TH2_json.h" #include "devices/IBT_2X_json.h" @@ -100,4 +101,5 @@ const char* _devices[][2] = { {_BM_V23_json, _BM_V23_json_props}, {_MS_CDP_json, _MS_CDP_json_props}, {_GAEN_json, _GAEN_json_props}, + {_HHCCPOT002_json, _HHCCPOT002_json_props}, }; diff --git a/src/devices/HHCCPOT002_json.h b/src/devices/HHCCPOT002_json.h new file mode 100644 index 000000000..dff6cec9f --- /dev/null +++ b/src/devices/HHCCPOT002_json.h @@ -0,0 +1,46 @@ +const char* _HHCCPOT002_json = "{\"brand\":\"HHCC\",\"model\":\"Ropot\",\"model_id\":\"HHCCPOT002\",\"condition\":[\"servicedata\",\"contain\",\"5d01\"],\"properties\":{\"tempc\":{\"condition\":[\"servicedata\",25,\"4\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true],\"post_proc\":[\"/\",10]},\"moi\":{\"condition\":[\"servicedata\",25,\"8\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,2,false]},\"fer\":{\"condition\":[\"servicedata\",25,\"9\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true]}}}"; +/*R""""( +{ + "brand":"Xiaomi", + "model":"RoPot", + "model_id":"HHCCPOT002", + "condition":["servicedata", "contain", "5d01"], + "properties":{ + "tempc":{ + "condition":["servicedata", 25, "4"], + "decoder":["value_from_hex_data", "servicedata", 30, 4, true], + "post_proc":["/", 10] + }, + "moi":{ + "condition":["servicedata", 25, "8"], + "decoder":["value_from_hex_data", "servicedata", 30, 2, false] + }, + "fer":{ + "condition":["servicedata", 25, "9"], + "decoder":["value_from_hex_data", "servicedata", 30, 4, true] + } + } +})"""";*/ + +const char* _HHCCPOT002_json_props = "{\"properties\":{\"batt\":{\"unit\":\"%\",\"name\":\"battery\"},\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"fer\":{\"unit\":\"µS/cm\",\"name\":\"fertility\"},\"moi\":{\"unit\":\"%\",\"name\":\"moisture\"}}}"; +/*R""""( +{ + "properties":{ + "batt":{ + "unit":"%", + "name":"battery" + }, + "tempc":{ + "unit":"°C", + "name":"temperature" + }, + "fer":{ + "unit":"µS/cm", + "name":"fertility" + }, + "moi":{ + "unit":"%", + "name":"moisture" + } + } +})"""";*/ diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 0f24a742c..4d994624a 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -38,6 +38,9 @@ const char* expected_servicedata[] = { "{\"brand\":\"Xiaomi\",\"model\":\"LYWSD03MMC\",\"model_id\":\"LYWSD03MMC_ATC\",\"tempc\":32.5,\"tempf\":90.5,\"hum\":62,\"batt\":81,\"volt\":2.939}", "{\"brand\":\"Xiaomi\",\"model\":\"LYWSD03MMC\",\"model_id\":\"LYWSD03MMC_PVVX\",\"tempc\":21.12,\"tempf\":70.016,\"hum\":50.53,\"batt\":100,\"volt\":3.143}", "{\"brand\":\"Qingping\",\"model\":\"Motion & Light\",\"model_id\":\"CGPR1\",\"lux\":0}", + "{\"brand\":\"Xiaomi\",\"model\":\"RoPot\",\"model_id\":\"HHCCPOT002\",\"moi\":3}", + "{\"brand\":\"Xiaomi\",\"model\":\"RoPot\",\"model_id\":\"HHCCPOT002\",\"tempc\":32,\"tempf\":89.6}", + "{\"brand\":\"Xiaomi\",\"model\":\"RoPot\",\"model_id\":\"HHCCPOT002\",\"fer\":1}", }; const char* expected_mfg[] = { @@ -75,7 +78,6 @@ const char* expected_mfg[] = { "{\"brand\":\"BlueMaestro\",\"model\":\"TempoDisc\",\"model_id\":\"BM_V23\",\"tempc\":23.9,\"tempf\":75.02,\"dp\":10.8,\"hum\":43.5,\"volt\":2.56}", "{\"brand\":\"GENERIC\",\"model\":\"MS-CDP\",\"model_id\":\"MS-CDP\",\"device\":\"Windows 10 Desktop\",\"salt\":\"ac6d90ec\",\"hash\":\"0132b3204cd39c7ced3e48436ba15dc6\"}", "{\"brand\":\"Inkbird/Tenergy\",\"model\":\"iBBQ/SOLIS6\",\"model_id\":\"IBT-6XS/SOLIS-6\",\"tempc\":20,\"tempf\":68,\"tempc2\":20,\"tempf2\":68,\"tempc4\":21,\"tempf4\":69.8}", - }; const char* expected_uuid_mfgsvcdata[] = { @@ -147,6 +149,9 @@ const char* test_servicedata[][2] = { {"LYWSD03MMC_ATC", "a4c138d5d49801453e510b7b62"}, {"LYWSD03MMC_PVVX", "5601cf38c1a44008bd13470c64cc0f"}, {"Qingping Motion & Light", "0812443660342d580201530f0118090400000000"}, + {"RoPot", "71205d0183d20c6d8d7cc40d08100103"}, + {"RoPot", "71205d0183d20c6d8d7cc40d0410024001"}, + {"RoPot", "71205d0188d20c6d8d7cc40d0910020100"}, }; TheengsDecoder::BLE_ID_NUM test_svcdata_id_num[]{ @@ -183,6 +188,9 @@ TheengsDecoder::BLE_ID_NUM test_svcdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::LYWSD03MMC_ATC, TheengsDecoder::BLE_ID_NUM::LYWSD03MMC_PVVX, TheengsDecoder::BLE_ID_NUM::CGPR1, + TheengsDecoder::BLE_ID_NUM::HHCCPOT002, + TheengsDecoder::BLE_ID_NUM::HHCCPOT002, + TheengsDecoder::BLE_ID_NUM::HHCCPOT002, }; // manufacturer data test input [test name] [device name] [data]