diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 67ace9e6..43a426f6 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -61,7 +61,6 @@ module.exports = { 'devices/RuuviTag_RAWv2', 'devices/SBS1', 'devices/TPMS', - 'devices/VEGTRUG', 'devices/WS02', 'devices/WS08', 'devices/HHCCJCY01HHCC', diff --git a/docs/devices/HHCCJCY01HHCC.md b/docs/devices/HHCCJCY01HHCC.md index ab8e42c6..ea410ae1 100644 --- a/docs/devices/HHCCJCY01HHCC.md +++ b/docs/devices/HHCCJCY01HHCC.md @@ -1,8 +1,8 @@ -# Xiaomi Mi Flora +# Xiaomi/VegTrug Mi Flora |Model Id|[HHCCJCY01HHCC](https://github.com/theengs/decoder/blob/development/src/devices/HHCCJCY01HHCC_json.h)| |-|-| -|Brand|Xiaomi| +|Brand|Xiaomi/VegTrug| |Model|MiFlora| |Short Description|Moisture, light, temperature and fertility sensor| |Communication|BLE broadcast| diff --git a/docs/devices/HHCCPOT002.md b/docs/devices/HHCCPOT002.md index 51d61eff..5d42ee7d 100644 --- a/docs/devices/HHCCPOT002.md +++ b/docs/devices/HHCCPOT002.md @@ -8,5 +8,5 @@ |Communication|BLE broadcast| |Frequency|2.4Ghz| |Power source|CR2032| -|Exchanged data|temperature, moisture, fertility| +|Exchanged data|moisture, fertility| |Encrypted|No| diff --git a/docs/devices/VEGTRUG.md b/docs/devices/VEGTRUG.md deleted file mode 100644 index 2db44449..00000000 --- a/docs/devices/VEGTRUG.md +++ /dev/null @@ -1,12 +0,0 @@ -# VEGTRUG - -|Model Id|[VEGTRUG](https://github.com/theengs/decoder/blob/development/src/devices/VEGTRUG_json.h)| -|-|-| -|Brand|VEGTRUG| -|Model|VEGTRUG| -|Short Description|Moisture, light, temperature and fertility sensor| -|Communication|BLE broadcast| -|Frequency|2.4Ghz| -|Power source|CR2032| -|Exchanged data|temperature, moisture, fertility, luminance| -|Encrypted|No| diff --git a/src/decoder.h b/src/decoder.h index 1bbbadfc..3f5d4223 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -47,7 +47,6 @@ class TheengsDecoder { enum BLE_ID_NUM { UNKNOWN_MODEL = -1, HHCCJCY01HHCC = 0, - VEGTRUG, LYWSD02, LYWSDCGQ, CGP1W, diff --git a/src/devices.h b/src/devices.h index 3ed3dca8..39789fcd 100644 --- a/src/devices.h +++ b/src/devices.h @@ -51,7 +51,6 @@ #include "devices/RuuviTag_RAWv2_json.h" #include "devices/SBS1_json.h" #include "devices/TPMS_json.h" -#include "devices/VEGTRUG_json.h" #include "devices/WS02_json.h" #include "devices/WS08_json.h" #include "devices/XMTZC04HM_json.h" @@ -62,7 +61,6 @@ const char* _devices[][2] = { {_HHCCJCY01HHCC_json, _HHCCJCY01HHCC_json_props}, - {_VEGTRUG_json, _VEGTRUG_json_props}, {_LYWSD02_json, _LYWSD02_json_props}, {_LYWSDCGQ_json, _LYWSDCGQ_json_props}, {_CGP1W_json, _CGP1W_json_props}, diff --git a/src/devices/H5072_json.h b/src/devices/H5072_json.h index 76e6ebb4..8b2e5ce1 100644 --- a/src/devices/H5072_json.h +++ b/src/devices/H5072_json.h @@ -7,7 +7,7 @@ const char* _H5072_json = "{\"brand\":\"Govee\",\"model\":\"Thermo Hygrometer\", "brand":"Govee", "model":"Thermo Hygrometer", "model_id":"H5072", - "condition":["name", "contain", "GVH5072","&"","manufacturerdata", "index", 0, "88ec"], + "condition":["name", "contain", "GVH5072", "&", "manufacturerdata", "index", 0, "88ec"], "properties":{ "tempc":{ "decoder":["value_from_hex_data", "manufacturerdata", 6, 6, false], diff --git a/src/devices/H5075_json.h b/src/devices/H5075_json.h index 9e606877..e90e5fcb 100644 --- a/src/devices/H5075_json.h +++ b/src/devices/H5075_json.h @@ -7,7 +7,7 @@ const char* _H5075_json = "{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrome "brand":"Govee", "model":"Smart Thermo Hygrometer", "model_id":"H5075", - "condition":["name", "contain", "GVH5075","&"","manufacturerdata", "index", 0, "88ec"], + "condition":["name", "contain", "GVH5075", "&", "manufacturerdata", "index", 0, "88ec"], "properties":{ "tempc":{ "decoder":["value_from_hex_data", "manufacturerdata", 6, 6, false], diff --git a/src/devices/H5102_json.h b/src/devices/H5102_json.h index 29a21f71..b274f883 100644 --- a/src/devices/H5102_json.h +++ b/src/devices/H5102_json.h @@ -7,7 +7,7 @@ const char* _H5102_json = "{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrome "brand":"Govee", "model":"Smart Thermo Hygrometer", "model_id":"H5102", - "condition":["name", "contain", "GVH5102","&"","manufacturerdata", "index", 0, "0100"], + "condition":["name", "contain", "GVH5102", "&", "manufacturerdata", "index", 0, "0100"], "properties":{ "tempc":{ "decoder":["value_from_hex_data", "manufacturerdata", 8, 6, false], diff --git a/src/devices/HHCCJCY01HHCC_json.h b/src/devices/HHCCJCY01HHCC_json.h index 870224ff..18619ce5 100644 --- a/src/devices/HHCCJCY01HHCC_json.h +++ b/src/devices/HHCCJCY01HHCC_json.h @@ -1,10 +1,10 @@ -const char* _HHCCJCY01HHCC_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miflora\",\"model_id\":\"HHCCJCY01HHCC\",\"condition\":[\"servicedata\",\"contain\",\"209800\"],\"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]},\"lux\":{\"condition\":[\"servicedata\",25,\"7\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,6,true]},\"fer\":{\"condition\":[\"servicedata\",25,\"9\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true]}}}"; +const char* _HHCCJCY01HHCC_json = "{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY01HHCC\",\"condition\":[\"servicedata\",\"index\",2,\"209800\",\"|\",\"servicedata\",\"index\",2,\"20bc03\"],\"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]},\"lux\":{\"condition\":[\"servicedata\",25,\"7\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,6,true]},\"fer\":{\"condition\":[\"servicedata\",25,\"9\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true]}}}"; /*R""""( { - "brand":"Xiaomi", - "model":"Miflora", + "brand":"Xiaomi/VegTrug", + "model":"MiFlora", "model_id":"HHCCJCY01HHCC", - "condition":["servicedata", "contain", "209800"], + "condition":["servicedata", "index", 2, "209800", "|", "servicedata", "index", 2, "20bc03"], "properties":{ "tempc":{ "condition":["servicedata", 25, "4"], @@ -26,14 +26,10 @@ const char* _HHCCJCY01HHCC_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miflora\",\ } })"""";*/ -const char* _HHCCJCY01HHCC_json_props = "{\"properties\":{\"batt\":{\"unit\":\"%\",\"name\":\"battery\"},\"lux\":{\"unit\":\"lx\",\"name\":\"illuminance\"},\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"fer\":{\"unit\":\"µS/cm\",\"name\":\"fertility\"},\"moi\":{\"unit\":\"%\",\"name\":\"moisture\"}}}"; +const char* _HHCCJCY01HHCC_json_props = "{\"properties\":{\"lux\":{\"unit\":\"lx\",\"name\":\"illuminance\"},\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"fer\":{\"unit\":\"µS/cm\",\"name\":\"fertility\"},\"moi\":{\"unit\":\"%\",\"name\":\"moisture\"}}}"; /*R""""( { "properties":{ - "batt":{ - "unit":"%", - "name":"battery" - }, "lux":{ "unit":"lx", "name":"illuminance" diff --git a/src/devices/HHCCPOT002_json.h b/src/devices/HHCCPOT002_json.h index 62b3b7db..14fe50ca 100644 --- a/src/devices/HHCCPOT002_json.h +++ b/src/devices/HHCCPOT002_json.h @@ -1,16 +1,11 @@ -const char* _HHCCPOT002_json = "{\"brand\":\"Xiaomi\",\"model\":\"RoPot\",\"model_id\":\"HHCCPOT002\",\"condition\":[\"servicedata\",\"index\",4,\"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 = "{\"brand\":\"Xiaomi\",\"model\":\"RoPot\",\"model_id\":\"HHCCPOT002\",\"condition\":[\"servicedata\",\"index\",2,\"205d01\"],\"properties\":{\"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", "index", 4, "5d01"], + "condition":["servicedata", "index", 2, "205d01"], "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] @@ -22,14 +17,10 @@ const char* _HHCCPOT002_json = "{\"brand\":\"Xiaomi\",\"model\":\"RoPot\",\"mode } })"""";*/ -const char* _HHCCPOT002_json_props = "{\"properties\":{\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"fer\":{\"unit\":\"µS/cm\",\"name\":\"fertility\"},\"moi\":{\"unit\":\"%\",\"name\":\"moisture\"}}}"; +const char* _HHCCPOT002_json_props = "{\"properties\":{\"moi\":{\"unit\":\"%\",\"name\":\"moisture\"},\"fer\":{\"unit\":\"µS/cm\",\"name\":\"fertility\"}}}"; /*R""""( { "properties":{ - "tempc":{ - "unit":"°C", - "name":"temperature" - }, "moi":{ "unit":"%", "name":"moisture" diff --git a/src/devices/JQJCY01YM_json.h b/src/devices/JQJCY01YM_json.h index 328cf7f0..f574648f 100644 --- a/src/devices/JQJCY01YM_json.h +++ b/src/devices/JQJCY01YM_json.h @@ -1,10 +1,10 @@ -const char* _JQJCY01YM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Formaldehyde detector\",\"model_id\":\"JQJCY01YM\",\"condition\":[\"servicedata\",\"contain\",\"20df02\"],\"properties\":{\"for\":{\"condition\":[\"servicedata\",23,\"0\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true],\"post_proc\":[\"/\",100]},\"hum\":{\"condition\":[\"servicedata\",23,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true,false],\"post_proc\":[\"/\",10]},\"tempc\":{\"condition\":[\"servicedata\",23,\"4\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true,false],\"post_proc\":[\"/\",10]},\"batt\":{\"condition\":[\"servicedata\",23,\"a\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,2,false,false]}}}"; +const char* _JQJCY01YM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Formaldehyde detector\",\"model_id\":\"JQJCY01YM\",\"condition\":[\"servicedata\",\"index\",2,\"20df02\"],\"properties\":{\"for\":{\"condition\":[\"servicedata\",23,\"0\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true],\"post_proc\":[\"/\",100]},\"hum\":{\"condition\":[\"servicedata\",23,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true,false],\"post_proc\":[\"/\",10]},\"tempc\":{\"condition\":[\"servicedata\",23,\"4\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true,false],\"post_proc\":[\"/\",10]},\"batt\":{\"condition\":[\"servicedata\",23,\"a\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,2,false,false]}}}"; /*R""""( { "brand":"Xiaomi", "model":"Formaldehyde detector", "model_id":"JQJCY01YM", - "condition":["servicedata", "contain", "20df02"], + "condition":[""servicedata", "index", 2, "20df02"], "properties":{ "for":{ "condition":["servicedata", 23, "0"], diff --git a/src/devices/LYWSD02_json.h b/src/devices/LYWSD02_json.h index f938af57..e187c2c8 100644 --- a/src/devices/LYWSD02_json.h +++ b/src/devices/LYWSD02_json.h @@ -1,12 +1,12 @@ #include "common_props.h" -const char* _LYWSD02_json = "{\"brand\":\"Xiaomi\",\"model\":\"Cleargrass clock\",\"model_id\":\"LYWSD02\",\"condition\":[\"servicedata\",\"contain\",\"205b04\"],\"properties\":{\"tempc\":{\"condition\":[\"servicedata\",25,\"4\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true],\"post_proc\":[\"/\",10]},\"hum\":{\"condition\":[\"servicedata\",25,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true,false],\"post_proc\":[\"/\",10]}}}"; +const char* _LYWSD02_json = "{\"brand\":\"Xiaomi\",\"model\":\"Cleargrass clock\",\"model_id\":\"LYWSD02\",\"condition\":[\"servicedata\",\"index\",2,\"205b04\"],\"properties\":{\"tempc\":{\"condition\":[\"servicedata\",25,\"4\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true],\"post_proc\":[\"/\",10]},\"hum\":{\"condition\":[\"servicedata\",25,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true,false],\"post_proc\":[\"/\",10]}}}"; /* R""""( { "brand":"Xiaomi", "model":"Cleargrass clock", "model_id":"LYWSD02", - "condition":["servicedata", "contain", "205b04"], + "condition":[""servicedata", "index", 2, "205b04"], "properties":{ "tempc":{ "condition":["servicedata", 25, "4"], diff --git a/src/devices/LYWSD03MMC_ATC_json.h b/src/devices/LYWSD03MMC_ATC_json.h index 2aa94a06..91429643 100644 --- a/src/devices/LYWSD03MMC_ATC_json.h +++ b/src/devices/LYWSD03MMC_ATC_json.h @@ -1,12 +1,12 @@ #include "common_props.h" -const char* _LYWSD03MMC_ATC_json = "{\"brand\":\"Xiaomi\",\"model\":\"LYWSD03MMC\",\"model_id\":\"LYWSD03MMC_ATC\",\"condition\":[\"servicedata\",\"contain\",\"a4c138\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",12,4,false],\"post_proc\":[\"/\",10]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",16,2,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,2,false]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,4,false],\"post_proc\":[\"/\",1000]}}}"; +const char* _LYWSD03MMC_ATC_json = "{\"brand\":\"Xiaomi\",\"model\":\"LYWSD03MMC\",\"model_id\":\"LYWSD03MMC_ATC\",\"condition\":[\"servicedata\",\"index\",0,\"a4c138\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",12,4,false],\"post_proc\":[\"/\",10]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",16,2,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,2,false]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,4,false],\"post_proc\":[\"/\",1000]}}}"; /* R""""( { "brand":"Xiaomi", "model":"LYWSD03MMC", "model_id":"LYWSD03MMC_ATC", - "condition":["servicedata", "contain", "a4c138"], + "condition":[""servicedata", "index", 0, "a4c138"], "properties":{ "tempc":{ "decoder":["value_from_hex_data", "servicedata", 12, 4, false], diff --git a/src/devices/LYWSDCGQ_json.h b/src/devices/LYWSDCGQ_json.h index 9935ba99..2190e9af 100644 --- a/src/devices/LYWSDCGQ_json.h +++ b/src/devices/LYWSDCGQ_json.h @@ -1,12 +1,12 @@ #include "common_props.h" -const char* _LYWSDCGQ_json = "{\"brand\":\"Xiaomi\",\"model\":\"Mi Jia round\",\"model_id\":\"LYWSDCGQ\",\"condition\":[\"servicedata\",\"contain\",\"20aa01\"],\"properties\":{\"tempc\":{\"condition\":[\"servicedata\",23,\"d\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true],\"post_proc\":[\"/\",10]},\"hum\":{\"condition\":[\"servicedata\",23,\"d\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",32,4,true,false],\"post_proc\":[\"/\",10]},\"_hum\":{\"condition\":[\"servicedata\",23,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true,false],\"post_proc\":[\"/\",10]}}}"; +const char* _LYWSDCGQ_json = "{\"brand\":\"Xiaomi\",\"model\":\"Mi Jia round\",\"model_id\":\"LYWSDCGQ\",\"condition\":[\"servicedata\",\"index\",2,\"20aa01\"],\"properties\":{\"tempc\":{\"condition\":[\"servicedata\",23,\"d\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true],\"post_proc\":[\"/\",10]},\"hum\":{\"condition\":[\"servicedata\",23,\"d\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",32,4,true,false],\"post_proc\":[\"/\",10]},\"_hum\":{\"condition\":[\"servicedata\",23,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",28,4,true,false],\"post_proc\":[\"/\",10]}}}"; /*R""""( { "brand":"Xiaomi", "model":"Mi Jia round", "model_id":"LYWSDCGQ", - "condition":["servicedata", "contain", "20aa01"], + "condition":[""servicedata", "index", 2, "20aa01"], "properties":{ "tempc":{ "condition":["servicedata", 23, "d"], diff --git a/src/devices/MUE4094RT_json.h b/src/devices/MUE4094RT_json.h index b523863d..e0eb95a9 100644 --- a/src/devices/MUE4094RT_json.h +++ b/src/devices/MUE4094RT_json.h @@ -1,19 +1,17 @@ -const char* _MUE4094RT_json = "{\"brand\":\"Xiaomi\",\"model\":\"MiLamp\",\"model_id\":\"MUE4094RT\",\"condition\":[\"servicedata\",\"contain\",\"4030dd\"],\"properties\":{\"pres\":{\"condition\":[\"servicedata\",0,\"4812\"],\"decoder\":[\"static_value\",true],\"is_bool\":1},\"darkness\":{\"condition\":[\"servicedata\",0,\"4812\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,true]}}}"; +const char* _MUE4094RT_json = "{\"brand\":\"Xiaomi\",\"model\":\"MiLamp\",\"model_id\":\"MUE4094RT\",\"condition\":[\"servicedata\",\"index\",0,\"4030dd\"],\"properties\":{\"pres\":{\"decoder\":[\"static_value\",true],\"is_bool\":1},\"darkness\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,true]}}}"; /* R""""( { "brand":"Xiaomi", "model":"MiLamp", "model_id":"MUE4094RT", - "condition":["servicedata", "contain", "4030dd"], + "condition":["servicedata", "index", 0, "4030dd"], "properties":{ "pres":{ - "condition":["servicedata", 0, "4812"], "decoder":["static_value", true], "is_bool":1 }, "darkness":{ - "condition":["servicedata", 0, "4812"], "decoder":["value_from_hex_data", "servicedata", 8, 2, true] } } diff --git a/src/devices/VEGTRUG_json.h b/src/devices/VEGTRUG_json.h deleted file mode 100644 index 859a0ef8..00000000 --- a/src/devices/VEGTRUG_json.h +++ /dev/null @@ -1,50 +0,0 @@ -const char* _VEGTRUG_json = "{\"brand\":\"VEGTRUG\",\"model\":\"VEGTRUG\",\"model_id\":\"VEGTRUG\",\"condition\":[\"servicedata\",\"contain\",\"20bc03\"],\"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]},\"lux\":{\"condition\":[\"servicedata\",25,\"7\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,6,true]},\"fer\":{\"condition\":[\"servicedata\",25,\"9\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",30,4,true]}}}"; -/*R""""( -{ - "brand":"VEGTRUG", - "model":"VEGTRUG", - "model_id":"VEGTRUG", - "condition":["servicedata", "contain", "20bc03"], - "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] - }, - "lux":{ - "condition":["servicedata", 25, "7"], - "decoder":["value_from_hex_data", "servicedata", 30, 6, true] - }, - "fer":{ - "condition":["servicedata", 25, "9"], - "decoder":["value_from_hex_data", "servicedata", 30, 4, true] - } - } -})"""";*/ - -const char* _VEGTRUG_json_props = "{\"properties\":{\"lux\":{\"unit\":\"lx\",\"name\":\"illuminance\"},\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"fer\":{\"unit\":\"µS/cm\",\"name\":\"fertility\"},\"moi\":{\"unit\":\"%\",\"name\":\"moisture\"}}}"; -/*R""""( -{ - "properties":{ - "lux":{ - "unit":"lx", - "name":"illuminance" - }, - "tempc":{ - "unit":"°C", - "name":"temperature" - }, - "fer":{ - "unit":"µS/cm", - "name":"fertility" - }, - "moi":{ - "unit":"%", - "name":"moisture" - } - } -})"""";*/ \ No newline at end of file diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 4d994624..0bc398aa 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -5,10 +5,11 @@ #include "decoder.h" const char* expected_servicedata[] = { - "{\"brand\":\"Xiaomi\",\"model\":\"Miflora\",\"model_id\":\"HHCCJCY01HHCC\",\"lux\":9971}", - "{\"brand\":\"Xiaomi\",\"model\":\"Miflora\",\"model_id\":\"HHCCJCY01HHCC\",\"moi\":30}", - "{\"brand\":\"Xiaomi\",\"model\":\"Miflora\",\"model_id\":\"HHCCJCY01HHCC\",\"tempc\":32,\"tempf\":89.6}", - "{\"brand\":\"Xiaomi\",\"model\":\"Miflora\",\"model_id\":\"HHCCJCY01HHCC\",\"fer\":0}", + "{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY01HHCC\",\"lux\":9971}", + "{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY01HHCC\",\"moi\":30}", + "{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY01HHCC\",\"tempc\":32,\"tempf\":89.6}", + "{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY01HHCC\",\"fer\":0}", + "{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY01HHCC\",\"tempc\":32,\"tempf\":89.6}", "{\"brand\":\"Xiaomi\",\"model\":\"Cleargrass clock\",\"model_id\":\"LYWSD02\",\"tempc\":25.6,\"tempf\":78.08}", "{\"brand\":\"Xiaomi\",\"model\":\"Cleargrass clock\",\"model_id\":\"LYWSD02\",\"hum\":69}", "{\"brand\":\"Xiaomi\",\"model\":\"Cleargrass clock\",\"model_id\":\"LYWSD02\",\"tempc\":26.5,\"tempf\":79.7}", @@ -39,8 +40,8 @@ const char* expected_servicedata[] = { "{\"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}", + "{\"brand\":\"Xiaomi\",\"model\":\"MiLamp\",\"model_id\":\"MUE4094RT\",\"pres\":true,\"darkness\":29}", }; const char* expected_mfg[] = { @@ -120,6 +121,7 @@ const char* test_servicedata[][2] = { {"Mi flora", "712098005763b6658d7cc40d0810011e"}, {"Mi flora", "712098000163b6658d7cc40d0410024001"}, {"Mi flora", "712098000863b6658d7cc40d0910020000"}, + {"VegTrug flora", "712098000163b6658d7cc40d0410024001"}, {"Cleargrass clock", "70205b04756ab883c8593f090410020001"}, {"Cleargrass clock", "70205b04dc6ab883c8593f09061002b202"}, {"Cleargrass clock", "70205b04756ab883c8593f090410020901"}, @@ -150,8 +152,8 @@ const char* test_servicedata[][2] = { {"LYWSD03MMC_PVVX", "5601cf38c1a44008bd13470c64cc0f"}, {"Qingping Motion & Light", "0812443660342d580201530f0118090400000000"}, {"RoPot", "71205d0183d20c6d8d7cc40d08100103"}, - {"RoPot", "71205d0183d20c6d8d7cc40d0410024001"}, {"RoPot", "71205d0188d20c6d8d7cc40d0910020100"}, + {"MiLamp", "4030dd031d0300010100"}, }; TheengsDecoder::BLE_ID_NUM test_svcdata_id_num[]{ @@ -159,6 +161,7 @@ TheengsDecoder::BLE_ID_NUM test_svcdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::HHCCJCY01HHCC, TheengsDecoder::BLE_ID_NUM::HHCCJCY01HHCC, TheengsDecoder::BLE_ID_NUM::HHCCJCY01HHCC, + TheengsDecoder::BLE_ID_NUM::HHCCJCY01HHCC, TheengsDecoder::BLE_ID_NUM::LYWSD02, TheengsDecoder::BLE_ID_NUM::LYWSD02, TheengsDecoder::BLE_ID_NUM::LYWSD02, @@ -190,7 +193,7 @@ TheengsDecoder::BLE_ID_NUM test_svcdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::CGPR1, TheengsDecoder::BLE_ID_NUM::HHCCPOT002, TheengsDecoder::BLE_ID_NUM::HHCCPOT002, - TheengsDecoder::BLE_ID_NUM::HHCCPOT002, + TheengsDecoder::BLE_ID_NUM::MUE4094RT, }; // manufacturer data test input [test name] [device name] [data]