From de63b10ab6c491cb406eafcf25a7c43dd3d7948f Mon Sep 17 00:00:00 2001 From: DigiH Date: Mon, 14 Feb 2022 15:18:12 +0100 Subject: [PATCH 01/23] XMTZC04HM stabilised change XMTZC04HM stabilised change to 'a' --- src/devices/XMTZC04HM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index 7de05d9d..6d57f800 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,13 +2,13 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized -const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", "model":"Miscale_v1", "model_id":"XMTZC04HM", - "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "2"], + "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "a"], "properties":{ "unit":{ "condition":["servicedata", 1, "2"], From a119c65a3f07228e1a41542fa9cbb0de5be064b8 Mon Sep 17 00:00:00 2001 From: DigiH Date: Mon, 14 Feb 2022 15:21:07 +0100 Subject: [PATCH 02/23] XMTZC05HM Stabilised addition XMTZC05HM Stabilised addition with 'a' --- src/devices/XMTZC05HM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/XMTZC05HM_json.h b/src/devices/XMTZC05HM_json.h index c74cfab3..2559ff66 100644 --- a/src/devices/XMTZC05HM_json.h +++ b/src/devices/XMTZC05HM_json.h @@ -1,12 +1,12 @@ #include "common_props.h" -const char* _XMTZC05HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"condition\":[\"uuid\",\"contain\",\"181b\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",100]},\"impedance\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false]}}}"; +const char* _XMTZC05HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"condition\":[\"uuid\",\"contain\",\"181b\",\"&\",\"servicedata\",\"index\",2,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",100]},\"impedance\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false]}}}"; /*R""""( { "brand":"Xiaomi", "model":"Miscale_v2", "model_id":"XMTZC05HM", - "condition":["uuid", "contain", "181b"], + "condition":["uuid", "contain", "181b", "&", "servicedata", "index", 2, "a"], "properties":{ "unit":{ "condition":["servicedata", 1, "2"], From e65d3f90e5b1e95f6b4a1507b530e64acf2606f7 Mon Sep 17 00:00:00 2001 From: DigiH Date: Mon, 14 Feb 2022 15:42:03 +0100 Subject: [PATCH 03/23] Stabilised Test changes --- tests/BLE/test_ble.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 10132f07..e014ad4a 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -200,8 +200,8 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ // uuid test input [test name] [uuid] [data source] [data] const char* test_uuid[][4] = { {"MiBand", "fee0", "servicedata", "a21e0000"}, - {"Miscale", "0x181d", "servicedata", "223e30b207010708031f"}, - {"Miscale_v2", "0x181b", "servicedata", "0284e5070c170c301df7019a38"}, + {"Miscale", "0x181d", "servicedata", "a23e30b207010708031f"}, + {"Miscale_v2", "0x181b", "servicedata", "02a4e5070c170c301df7019a38"}, {"Mokobeacon", "0xff01", "servicedata", "64000000005085a000f0ffe003"}, {"MokoXPro", "feab", "servicedata", "70000a011201ee0caf03def14635998a"}, }; From 1e2c0f5b66e573072a54f3576db7e886442756f1 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:20:40 +0100 Subject: [PATCH 04/23] Split 2 OR a decoder test --- src/devices/XMTZC04HM_json.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index 6d57f800..c6c13576 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,11 +2,40 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized +const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +/*R""""( +{ + "brand":"Xiaomi", + "model":"Miscale_v1_2", + "model_id":"XMTZC04HM", + "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "2"], + "properties":{ + "unit":{ + "condition":["servicedata", 1, "2"], + "decoder":["static_value", "kg"] + }, + "weight":{ + "condition":["servicedata", 1, "2"], + "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], + "post_proc":["/", 200] + }, + "_unit":{ + "condition":["servicedata", 1, "3"], + "decoder":["static_value", "lbs"] + }, + "_weight":{ + "condition":["servicedata", 1, "3"], + "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], + "post_proc":["/", 100] + } + } +})"""";*/ + const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", - "model":"Miscale_v1", + "model":"Miscale_v1_a", "model_id":"XMTZC04HM", "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "a"], "properties":{ From 23403745aba368ad26e49276dda2efc741104b64 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:22:26 +0100 Subject: [PATCH 05/23] Update XMTZC04HM_json.h --- src/devices/XMTZC04HM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index c6c13576..07e9757e 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,7 +2,7 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized -const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", @@ -31,7 +31,7 @@ const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\" } })"""";*/ -const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_va = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", From 28546dd01f6dbfcfdbb5316b564ca6ac28ebdf20 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:25:18 +0100 Subject: [PATCH 06/23] Update XMTZC04HM_json.h --- src/devices/XMTZC04HM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index 07e9757e..766d6729 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,7 +2,7 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized -const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_2\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", @@ -31,7 +31,7 @@ const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\" } })"""";*/ -const char* _XMTZC04HM_json_va = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_va = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_a\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", From 55009ef6a436e242a644619274ef9b644f73a88f Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:26:26 +0100 Subject: [PATCH 07/23] Update devices.h --- src/devices.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/devices.h b/src/devices.h index 3f9cb8cf..3af29c25 100644 --- a/src/devices.h +++ b/src/devices.h @@ -72,7 +72,8 @@ const char* _devices[][2] = { {_IBT_4XS_json, _IBT_4XS_json_props}, {_IBT_6XS_json, _IBT_6XS_json_props}, {_Miband_json, _Miband_json_props}, - {_XMTZC04HM_json, _XMTZC04HM_json_props}, + {_XMTZC04HM_json_v2, _XMTZC04HM_json_props}, + {_XMTZC04HM_json_va, _XMTZC04HM_json_props}, {_XMTZC05HM_json, _XMTZC05HM_json_props}, {_TPMS_json, _TPMS_json_props}, {_LYWSD03MMC_ATC_json, _LYWSD03MMC_ATC_props}, From 9bf7ddde55eebaf72070d9d7b45e2da096ae4716 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:32:45 +0100 Subject: [PATCH 08/23] Update test_ble.cpp --- tests/BLE/test_ble.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index e014ad4a..f31fcc36 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -67,7 +67,7 @@ const char* expected_mfg[] = { const char* expected_uuid[] = { "{\"brand\":\"Xiaomi\",\"model\":\"Miband\",\"model_id\":\"MiBand\",\"steps\":7842}", - "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"unit\":\"kg\",\"weight\":61.75}", + "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_a\",\"model_id\":\"XMTZC04HM\",\"unit\":\"kg\",\"weight\":61.75}", "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"unit\":\"kg\",\"weight\":72.45,\"impedance\":503}", "{\"brand\":\"Mokosmart\",\"model\":\"Beacon\",\"model_id\":\"Mokobeacon\",\"batt\":100,\"x_axis\":-24576,\"y_axis\":-3841,\"z_axis\":-8189}", "{\"brand\":\"Mokosmart\",\"model\":\"BeaconX Pro\",\"model_id\":\"MBXPRO\",\"tempc\":27.4,\"tempf\":81.32,\"hum\":49.4,\"volt\":3.247}", From 29d615e65e71bc6bbb5e736f88567587d19c3a6d Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:49:47 +0100 Subject: [PATCH 09/23] Update decoder.h --- src/decoder.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/decoder.h b/src/decoder.h index f224bada..9bbd3874 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -62,7 +62,8 @@ class TheengsDecoder { IBT4XS, IBT6XS, MIBAND, - XMTZC04HM, + XMTZC04HM_v2, + XMTZC04HM_va, XMTZC05HM, TPMS, LYWSD03MMC_ATC, From 245534083588f6eeeac41efd5f7ad13a8d663668 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:55:42 +0100 Subject: [PATCH 10/23] Update test_ble.cpp --- tests/BLE/test_ble.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index f31fcc36..a1e20e8f 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -208,7 +208,7 @@ const char* test_uuid[][4] = { TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::MIBAND, - TheengsDecoder::BLE_ID_NUM::XMTZC04HM, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM_va, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::MOKOBEACON, TheengsDecoder::BLE_ID_NUM::MOKOBEACONXPRO, From ec426ebd14d938f13921703d0dcaf9cb74f77fc3 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 02:04:05 +0100 Subject: [PATCH 11/23] Update test_ble.cpp --- tests/BLE/test_ble.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index a1e20e8f..b23272a3 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -68,6 +68,7 @@ const char* expected_mfg[] = { const char* expected_uuid[] = { "{\"brand\":\"Xiaomi\",\"model\":\"Miband\",\"model_id\":\"MiBand\",\"steps\":7842}", "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_a\",\"model_id\":\"XMTZC04HM\",\"unit\":\"kg\",\"weight\":61.75}", + "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_2\",\"model_id\":\"XMTZC04HM\",\"unit\":\"kg\",\"weight\":61.75}", "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"unit\":\"kg\",\"weight\":72.45,\"impedance\":503}", "{\"brand\":\"Mokosmart\",\"model\":\"Beacon\",\"model_id\":\"Mokobeacon\",\"batt\":100,\"x_axis\":-24576,\"y_axis\":-3841,\"z_axis\":-8189}", "{\"brand\":\"Mokosmart\",\"model\":\"BeaconX Pro\",\"model_id\":\"MBXPRO\",\"tempc\":27.4,\"tempf\":81.32,\"hum\":49.4,\"volt\":3.247}", @@ -201,6 +202,7 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ const char* test_uuid[][4] = { {"MiBand", "fee0", "servicedata", "a21e0000"}, {"Miscale", "0x181d", "servicedata", "a23e30b207010708031f"}, + {"Miscale", "0x181d", "servicedata", "223e30b207010708031f"}, {"Miscale_v2", "0x181b", "servicedata", "02a4e5070c170c301df7019a38"}, {"Mokobeacon", "0xff01", "servicedata", "64000000005085a000f0ffe003"}, {"MokoXPro", "feab", "servicedata", "70000a011201ee0caf03def14635998a"}, @@ -209,6 +211,7 @@ const char* test_uuid[][4] = { TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::MIBAND, TheengsDecoder::BLE_ID_NUM::XMTZC04HM_va, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM_v2, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::MOKOBEACON, TheengsDecoder::BLE_ID_NUM::MOKOBEACONXPRO, From fe3b268dbeb3b04fba5dc150bf410b0789d4140a Mon Sep 17 00:00:00 2001 From: Koen Vervloesem Date: Sat, 19 Feb 2022 00:18:13 +0100 Subject: [PATCH 12/23] Add Google/Apple Exposure Notification (GAEN) decoder (#73) --- docs/.vuepress/config.js | 1 + docs/devices/GAEN.md | 12 ++++++++++++ src/decoder.h | 1 + src/devices.h | 2 ++ src/devices/GAEN_json.h | 32 ++++++++++++++++++++++++++++++++ tests/BLE/test_ble.cpp | 3 +++ 6 files changed, 51 insertions(+) create mode 100644 docs/devices/GAEN.md create mode 100644 src/devices/GAEN_json.h diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 1175676c..6d6febec 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -32,6 +32,7 @@ module.exports = { 'devices/BM_V23', 'devices/CGD1', 'devices/CGP1W', + 'devices/GAEN', 'devices/H5072', 'devices/H5075', 'devices/H5102', diff --git a/docs/devices/GAEN.md b/docs/devices/GAEN.md new file mode 100644 index 00000000..8735995f --- /dev/null +++ b/docs/devices/GAEN.md @@ -0,0 +1,12 @@ +# Google/Apple Exposure Notification + +|Model Id|[MS-CDP](https://github.com/theengs/decoder/blob/development/src/devices/GAEN_json.h)| +|-|-| +|Brand|Generic| +|Model|GAEN| +|Short Description|Google/Apple Exposure Notification (GAEN) for digital contact tracing| +|Communication|BLE broadcast| +|Frequency|2.4Ghz| +|Power source|Dependent on device| +|Exchanged data|rolling proximity identifier, associated encrypted metadata| +|Encrypted|Yes| diff --git a/src/decoder.h b/src/decoder.h index 8396cdda..df0ec1c4 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -83,6 +83,7 @@ class TheengsDecoder { RUUVITAG_RAWV2, BM_V23, MS_CDP, + GAEN, BLE_ID_MAX }; diff --git a/src/devices.h b/src/devices.h index 49362794..26586a92 100644 --- a/src/devices.h +++ b/src/devices.h @@ -25,6 +25,7 @@ #include "devices/CGH1_json.h" #include "devices/CGP1W_json.h" #include "devices/CGPR1_json.h" +#include "devices/GAEN_json.h" #include "devices/H5072_json.h" #include "devices/H5075_json.h" #include "devices/H5102_json.h" @@ -94,4 +95,5 @@ const char* _devices[][2] = { {_RuuviTag_RAWv2_json, _RuuviTag_RAWv2_json_props}, {_BM_V23_json, _BM_V23_json_props}, {_MS_CDP_json, _MS_CDP_json_props}, + {_GAEN_json, _GAEN_json_props}, }; diff --git a/src/devices/GAEN_json.h b/src/devices/GAEN_json.h new file mode 100644 index 00000000..bc75e03e --- /dev/null +++ b/src/devices/GAEN_json.h @@ -0,0 +1,32 @@ +const char* _GAEN_json = "{\"brand\":\"GENERIC\",\"model\":\"GAEN\",\"model_id\":\"GAEN\",\"condition\":[\"uuid\",\"index\",0,\"fd6f\"],\"properties\":{\"rpi\":{\"decoder\":[\"string_from_hex_data\",\"servicedata\",0,32]},\"aem\":{\"decoder\":[\"string_from_hex_data\",\"servicedata\",32,8]}}}"; + +/*R""""( +{ + "brand":"GENERIC", + "model":"GAEN", + "model_id":"GAEN", + "condition":["uuid", "index", 0, "fd6f"], + "properties":{ + "rpi":{ + "decoder":["string_from_hex_data", "servicedata", 0, 32] + }, + "aem":{ + "decoder":["string_from_hex_data", "servicedata", 32, 8] + } + } +})"""";*/ + +const char* _GAEN_json_props = "{\"properties\":{\"rpi\":{\"unit\":\"hex\",\"name\":\"rolling proximity identifier\"},\"aem\":{\"unit\":\"hex\",\"name\":\"associated encrypted metadata\"}}}"; +/*R""""( +{ + "properties":{ + "rpi":{ + "unit":"hex", + "name":"rolling proximity identifier" + }, + "aem":{ + "unit":"hex", + "name":"associated encrypted metadata" + } + } +})"""";*/ diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index d361b6d2..5f882602 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -72,6 +72,7 @@ const char* expected_uuid[] = { "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"unit\":\"kg\",\"weight\":72.45,\"impedance\":503}", "{\"brand\":\"Mokosmart\",\"model\":\"Beacon\",\"model_id\":\"Mokobeacon\",\"batt\":100,\"x_axis\":-24576,\"y_axis\":-3841,\"z_axis\":-8189}", "{\"brand\":\"Mokosmart\",\"model\":\"BeaconX Pro\",\"model_id\":\"MBXPRO\",\"tempc\":27.4,\"tempf\":81.32,\"hum\":49.4,\"volt\":3.247}", + "{\"brand\":\"GENERIC\",\"model\":\"GAEN\",\"model_id\":\"GAEN\",\"rpi\":\"e7c6d34c71e48baf278bd99be74685bc\",\"aem\":\"a78126ab\"}", }; // Service data test input [test name] [data] @@ -207,6 +208,7 @@ const char* test_uuid[][4] = { {"Miscale_v2", "0x181b", "servicedata", "0284e5070c170c301df7019a38"}, {"Mokobeacon", "0xff01", "servicedata", "64000000005085a000f0ffe003"}, {"MokoXPro", "feab", "servicedata", "70000a011201ee0caf03def14635998a"}, + {"GAEN", "fd6f", "servicedata", "e7c6d34c71e48baf278bd99be74685bca78126ab"}, }; TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ @@ -215,6 +217,7 @@ TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::MOKOBEACON, TheengsDecoder::BLE_ID_NUM::MOKOBEACONXPRO, + TheengsDecoder::BLE_ID_NUM::GAEN, }; template From 0f31a2b12e00f0664e0de66db9e35c84ed8d9760 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 22 Feb 2022 00:10:16 +0100 Subject: [PATCH 13/23] Extended XMTZC05HM decoder (#74) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Extension of XMTZC05HM decoder - Pulled back _XMTZC05HM_json_props into XMTZC05HM_json.h - Renamed "model" to more informative "Mi_Body_Scale_2" and amended description in the docs - Implemented 'stabilised' only decoding for XMTZC05HM - Recognises 'stabilised' 2 (scale display active) and 'stabilised' a (scale display deactivated) to guarantee published 'stabilised' reading without the need for very short TimeBtwRead - New 'mode' attribute to indicate if the weighing was of a person or a small object (if this option is activated in the scale's settings). This allows filtering to only record person readings in HA or openHAB - Only publish 'impedance' attribute if the weighing of a person was done barefoot and the impedance value could be recorded correctly I suspect that the 1st version of the Mi Body Composition Scale (XMTZCO2HM) is also being recognised by this decoder, and should therefor be mentioned in the docs and published model_id, but without confirmation of XMTZCO2HM owners this is just a guess. * Extend properties conditions to use "OR" and "AND" params. * XMTZC05HM final adjustments Small final changes • abbreviated property names for discovery inclusion • decoder back to original _XMTZC05HM_json Co-authored-by: h2zero --- docs/devices/XMTZC05HM.md | 10 +- src/decoder.cpp | 261 +++++++++++++++++++---------------- src/devices/XMTZC05HM_json.h | 50 +++++-- src/devices/common_props.h | 15 -- tests/BLE/test_ble.cpp | 42 +++++- 5 files changed, 221 insertions(+), 157 deletions(-) diff --git a/docs/devices/XMTZC05HM.md b/docs/devices/XMTZC05HM.md index 5a23c23a..7c56e88b 100644 --- a/docs/devices/XMTZC05HM.md +++ b/docs/devices/XMTZC05HM.md @@ -1,12 +1,12 @@ -# Xiaomi MiScale V2 +# Xiaomi Mi Body Composition Scale 2 |Model Id|[XMTZC05HM](https://github.com/theengs/decoder/blob/development/src/devices/XMTZC05HM_json.h)| |-|-| |Brand|Xiaomi| -|Model|MiScale V2| -|Short Description|Second version of the scale| +|Model|Mi Body Scale 2| +|Short Description|Second version of the Mi Body Composition Scale| |Communication|BLE broadcast| |Frequency|2.4Ghz| -|Power source|3 AAA| -|Exchanged data|unit, weight, impedance| +|Power source|4 AAA| +|Exchanged data|weighing_mode, unit, weight, impedance| |Encrypted|No| diff --git a/src/decoder.cpp b/src/decoder.cpp index 5cffb869..f4dd1764 100644 --- a/src/decoder.cpp +++ b/src/decoder.cpp @@ -281,145 +281,162 @@ int TheengsDecoder::decodeBLEJson(JsonObject& jsondata) { JsonObject prop = kv.value().as(); JsonArray prop_condition = prop["condition"]; - if (prop_condition.isNull() || strstr((const char*)prop_condition[0], "servicedata") != nullptr || - strstr((const char*)prop_condition[0], "manufacturerdata") != nullptr) { - if (prop_condition.isNull() || - (svc_data && svc_data[prop_condition[1].as()] == *prop_condition[2].as()) || - (mfg_data && mfg_data[prop_condition[1].as()] == *prop_condition[2].as())) { - JsonArray decoder = prop["decoder"]; - if (strstr((const char*)decoder[0], "value_from_hex_data") != nullptr) { - const char* src = svc_data; - if (strstr((const char*)decoder[1], "manufacturerdata")) { - src = mfg_data; - } + int cond_size = prop_condition.size(); + bool cond_met = prop_condition.isNull(); + + for (int i = 0; i < cond_size; i += 4) { + if (svc_data && + strstr((const char*)prop_condition[i], "servicedata") != nullptr && + svc_data[prop_condition[i + 1].as()] == *prop_condition[i + 2].as()) { + cond_met = true; + } else if (mfg_data && + strstr((const char*)prop_condition[i], "manufacturerdata") != nullptr && + mfg_data[prop_condition[i + 1].as()] == *prop_condition[i + 2].as()) { + cond_met = true; + } - /* use a double for all values and cast later if required */ - double temp_val; - static long cal_val = 0; + if (!cond_met && cond_size > (i + 3) && *prop_condition[i + 3].as() == '|') { + continue; + } else if (cond_met && cond_size > (i + 3) && *prop_condition[i + 3].as() == '&') { + cond_met = false; + continue; + } + } - if (data_index_is_valid(src, decoder[2].as(), decoder[3].as())) { - decoder_function dec_fun = &TheengsDecoder::value_from_hex_string; + if (cond_met) { + JsonArray decoder = prop["decoder"]; + if (strstr((const char*)decoder[0], "value_from_hex_data") != nullptr) { + const char* src = svc_data; + if (strstr((const char*)decoder[1], "manufacturerdata")) { + src = mfg_data; + } - if (strstr((const char*)decoder[0], "bf") != nullptr) { - dec_fun = &TheengsDecoder::bf_value_from_hex_string; - } + /* use a double for all values and cast later if required */ + double temp_val; + static long cal_val = 0; - temp_val = (this->*dec_fun)(src, decoder[2].as(), - decoder[3].as(), - decoder[4].as(), - decoder[5].isNull() ? true : decoder[5].as()); + if (data_index_is_valid(src, decoder[2].as(), decoder[3].as())) { + decoder_function dec_fun = &TheengsDecoder::value_from_hex_string; - } else { - break; + if (strstr((const char*)decoder[0], "bf") != nullptr) { + dec_fun = &TheengsDecoder::bf_value_from_hex_string; } - /* Do any required post processing of the value */ - if (prop.containsKey("post_proc")) { - JsonArray post_proc = prop["post_proc"]; - for (unsigned int i = 0; i < post_proc.size(); i += 2) { - if (cal_val && post_proc[i + 1].as() != NULL && - strncmp(post_proc[i + 1].as(), ".cal", 4) == 0) { - switch (*post_proc[i].as()) { - case '/': - temp_val /= cal_val; - break; - case '*': - temp_val *= cal_val; - break; - case '-': - temp_val -= cal_val; - break; - case '+': - temp_val += cal_val; - break; + temp_val = (this->*dec_fun)(src, decoder[2].as(), + decoder[3].as(), + decoder[4].as(), + decoder[5].isNull() ? true : decoder[5].as()); + + } else { + break; + } + + /* Do any required post processing of the value */ + if (prop.containsKey("post_proc")) { + JsonArray post_proc = prop["post_proc"]; + for (unsigned int i = 0; i < post_proc.size(); i += 2) { + if (cal_val && post_proc[i + 1].as() != NULL && + strncmp(post_proc[i + 1].as(), ".cal", 4) == 0) { + switch (*post_proc[i].as()) { + case '/': + temp_val /= cal_val; + break; + case '*': + temp_val *= cal_val; + break; + case '-': + temp_val -= cal_val; + break; + case '+': + temp_val += cal_val; + break; + } + } else { + switch (*post_proc[i].as()) { + case '/': + temp_val /= post_proc[i + 1].as(); + break; + case '*': + temp_val *= post_proc[i + 1].as(); + break; + case '-': + temp_val -= post_proc[i + 1].as(); + break; + case '+': + temp_val += post_proc[i + 1].as(); + break; + case '%': { + long val = (long)temp_val; + temp_val = val % post_proc[i + 1].as(); + break; + } + case '<': { + long val = (long)temp_val; + temp_val = val << post_proc[i + 1].as(); + break; + } + case '>': { + long val = (long)temp_val; + temp_val = val >> post_proc[i + 1].as(); + break; } - } else { - switch (*post_proc[i].as()) { - case '/': - temp_val /= post_proc[i + 1].as(); - break; - case '*': - temp_val *= post_proc[i + 1].as(); - break; - case '-': - temp_val -= post_proc[i + 1].as(); - break; - case '+': - temp_val += post_proc[i + 1].as(); - break; - case '%': { - long val = (long)temp_val; - temp_val = val % post_proc[i + 1].as(); - break; - } - case '<': { - long val = (long)temp_val; - temp_val = val << post_proc[i + 1].as(); - break; - } - case '>': { - long val = (long)temp_val; - temp_val = val >> post_proc[i + 1].as(); - break; - } - case '!': { - bool val = (bool)temp_val; - temp_val = !val; - break; - } - case '&': { - long val = (long)temp_val; - temp_val = val & post_proc[i + 1].as(); - break; - } + case '!': { + bool val = (bool)temp_val; + temp_val = !val; + break; + } + case '&': { + long val = (long)temp_val; + temp_val = val & post_proc[i + 1].as(); + break; } } } } + } - /* If there is any underscores at the beginning of the property name, there is multiple - * properties of this type, we need remove the underscores for creating the key. - */ - std::string _key = sanitizeJsonKey(kv.key().c_str()); - - /* calculation values extracted from data are not added to the deocded outupt - * instead we store them teporarily to use with the next data properties. - */ - if (_key == ".cal") { - cal_val = (long)temp_val; - continue; - } - - /* Cast to a differnt value type if specified */ - if (prop.containsKey("is_bool")) { - jsondata[_key] = (bool)temp_val; - } else { - jsondata[_key] = temp_val; - } + /* If there is any underscores at the beginning of the property name, there is multiple + * properties of this type, we need remove the underscores for creating the key. + */ + std::string _key = sanitizeJsonKey(kv.key().c_str()); + + /* calculation values extracted from data are not added to the deocded outupt + * instead we store them teporarily to use with the next data properties. + */ + if (_key == ".cal") { + cal_val = (long)temp_val; + continue; + } - /* If the property is temp in C, make sure to convert and add temp in F */ - if (_key.find("tempc", 0, 5) != std::string::npos) { - double tc = jsondata[_key]; - _key[4] = 'f'; - jsondata[_key] = tc * 1.8 + 32; - _key[4] = 'c'; - } + /* Cast to a differnt value type if specified */ + if (prop.containsKey("is_bool")) { + jsondata[_key] = (bool)temp_val; + } else { + jsondata[_key] = temp_val; + } - success = i_main; - DEBUG_PRINT("found value = %s : %.2f\n", _key.c_str(), jsondata[_key].as()); - } else if (strstr((const char*)decoder[0], "static_value") != nullptr) { - jsondata[sanitizeJsonKey(kv.key().c_str())] = decoder[1]; - success = i_main; - } else if (strstr((const char*)decoder[0], "string_from_hex_data") != nullptr) { - const char* src = svc_data; - if (strstr((const char*)decoder[1], "manufacturerdata")) { - src = mfg_data; - } + /* If the property is temp in C, make sure to convert and add temp in F */ + if (_key.find("tempc", 0, 5) != std::string::npos) { + double tc = jsondata[_key]; + _key[4] = 'f'; + jsondata[_key] = tc * 1.8 + 32; + _key[4] = 'c'; + } - std::string value(src + decoder[2].as(), decoder[3].as()); - jsondata[sanitizeJsonKey(kv.key().c_str())] = value; - success = i_main; + success = i_main; + DEBUG_PRINT("found value = %s : %.2f\n", _key.c_str(), jsondata[_key].as()); + } else if (strstr((const char*)decoder[0], "static_value") != nullptr) { + jsondata[sanitizeJsonKey(kv.key().c_str())] = decoder[1]; + success = i_main; + } else if (strstr((const char*)decoder[0], "string_from_hex_data") != nullptr) { + const char* src = svc_data; + if (strstr((const char*)decoder[1], "manufacturerdata")) { + src = mfg_data; } + + std::string value(src + decoder[2].as(), decoder[3].as()); + jsondata[sanitizeJsonKey(kv.key().c_str())] = value; + success = i_main; } } } diff --git a/src/devices/XMTZC05HM_json.h b/src/devices/XMTZC05HM_json.h index c74cfab3..2568c75d 100644 --- a/src/devices/XMTZC05HM_json.h +++ b/src/devices/XMTZC05HM_json.h @@ -1,35 +1,59 @@ -#include "common_props.h" - -const char* _XMTZC05HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"condition\":[\"uuid\",\"contain\",\"181b\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",100]},\"impedance\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false]}}}"; +const char* _XMTZC05HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"condition\":[\"servicedata\",\"index\",2,\"2\",\"|\",\"servicedata\",\"index\",2,\"a\",\"&\",\"uuid\",\"contain\",\"181b\"],\"properties\":{\"weighing_mode\":{\"condition\":[\"servicedata\",1,\"2\",\"|\",\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"person\"]},\"_weighing_mode\":{\"condition\":[\"servicedata\",1,\"6\",\"|\",\"servicedata\",1,\"7\"],\"decoder\":[\"static_value\",\"object\"]},\"unit\":{\"condition\":[\"servicedata\",1,\"2\",\"|\",\"servicedata\",1,\"6\"],\"decoder\":[\"static_value\",\"kg\"]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\",\"|\",\"servicedata\",1,\"7\"],\"decoder\":[\"static_value\",\"lbs\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\",\"|\",\"servicedata\",1,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",200]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\",\"|\",\"servicedata\",1,\"7\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",100]},\"impedance\":{\"condition\":[\"servicedata\",3,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false]}}}"; /*R""""( { "brand":"Xiaomi", - "model":"Miscale_v2", + "model":"Mi_Body_Scale_2", "model_id":"XMTZC05HM", - "condition":["uuid", "contain", "181b"], + "condition":["servicedata", "index", 2, "2", "|", "servicedata", "index", 2, "a", "&", "uuid", "contain", "181b"], "properties":{ + "weighing_mode":{ + "condition":["servicedata", 1, "2", "|", "servicedata", 1, "3"], + "decoder":["static_value", "person"] + }, + "_weighing_mode":{ + "condition":["servicedata", 1, "6", "|", "servicedata", 1, "7"], + "decoder":["static_value", "object"] + }, "unit":{ - "condition":["servicedata", 1, "2"], + "condition":["servicedata", 1, "2", "|", "servicedata", 1, "6"], "decoder":["static_value", "kg"] }, + "_unit":{ + "condition":["servicedata", 1, "3", "|", "servicedata", 1, "7"], + "decoder":["static_value", "lbs"] + }, "weight":{ - "condition":["servicedata", 1, "2"], + "condition":["servicedata", 1, "2", "|", "servicedata", 1, "6"], "decoder":["value_from_hex_data", "servicedata", 22, 4, true, false], "post_proc":["/", 200] }, - "_unit":{ - "condition":["servicedata", 1, "3"], - "decoder":["static_value", "lbs"] - }, "_weight":{ - "condition":["servicedata", 1, "3"], + "condition":["servicedata", 1, "3", "|", "servicedata", 1, "7"], "decoder":["value_from_hex_data", "servicedata", 22, 4, true, false], "post_proc":["/", 100] }, "impedance":{ + "condition":["servicedata", 3, "6"], "decoder":["value_from_hex_data", "servicedata", 18, 4, true, false] } } })"""";*/ -const char* _XMTZC05HM_json_props = _common_weight_impedance_props; +const char* _XMTZC05HM_json_props = "{\"properties\":{\"weighing_mode\":{\"unit\":\"string\",\"name\":\"weighing_mode\"},\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"},\"impedance\":{\"unit\":\"Ohm\",\"name\":\"impedance\"}}}"; +/*R""""( +{ + "properties":{ + "weighing_mode":{ + "unit":"string", + "name":"weighing_mode" + }, + "weight":{ + "unit":"kg", + "name":"weight" + }, + "impedance":{ + "unit":"Ohm", + "name":"impedance" + } + } +})"""";*/ \ No newline at end of file diff --git a/src/devices/common_props.h b/src/devices/common_props.h index 1776f3e2..24789694 100644 --- a/src/devices/common_props.h +++ b/src/devices/common_props.h @@ -70,19 +70,4 @@ const char* _common_weight_props = "{\"properties\":{\"weight\":{\"unit\":\"kg\" } })"""";*/ -const char* _common_weight_impedance_props = "{\"properties\":{\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"},\"impedance\":{\"unit\":\"Ohm\",\"name\":\"impedance\"}}}"; -/*R""""( -{ - "properties":{ - "weight":{ - "unit":"kg", - "name":"weight" - } - "impedance":{ - "unit":"Ohm", - "name":"impedance" - } - } -})"""";*/ - #endif diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 5f882602..90e53410 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -69,7 +69,18 @@ const char* expected_mfg[] = { const char* expected_uuid[] = { "{\"brand\":\"Xiaomi\",\"model\":\"Miband\",\"model_id\":\"MiBand\",\"steps\":7842}", "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"unit\":\"kg\",\"weight\":61.75}", - "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"unit\":\"kg\",\"weight\":72.45,\"impedance\":503}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":72.45,\"impedance\":503}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":72.45}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"object\",\"unit\":\"kg\",\"weight\":5.1}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"lbs\",\"weight\":140.65,\"impedance\":503}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"lbs\",\"weight\":140.65}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"object\",\"unit\":\"lbs\",\"weight\":12.3}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":72.45,\"impedance\":503}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":72.45}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"object\",\"unit\":\"kg\",\"weight\":5.1}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"lbs\",\"weight\":140.65,\"impedance\":503}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"lbs\",\"weight\":140.65}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"object\",\"unit\":\"lbs\",\"weight\":12.3}", "{\"brand\":\"Mokosmart\",\"model\":\"Beacon\",\"model_id\":\"Mokobeacon\",\"batt\":100,\"x_axis\":-24576,\"y_axis\":-3841,\"z_axis\":-8189}", "{\"brand\":\"Mokosmart\",\"model\":\"BeaconX Pro\",\"model_id\":\"MBXPRO\",\"tempc\":27.4,\"tempf\":81.32,\"hum\":49.4,\"volt\":3.247}", "{\"brand\":\"GENERIC\",\"model\":\"GAEN\",\"model_id\":\"GAEN\",\"rpi\":\"e7c6d34c71e48baf278bd99be74685bc\",\"aem\":\"a78126ab\"}", @@ -205,7 +216,18 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ const char* test_uuid[][4] = { {"MiBand", "fee0", "servicedata", "a21e0000"}, {"Miscale", "0x181d", "servicedata", "223e30b207010708031f"}, - {"Miscale_v2", "0x181b", "servicedata", "0284e5070c170c301df7019a38"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "0226e607020e10293af7019a38"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "0224e607020e10293a00009a38"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "0624e607020e10293a0000fc03"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "0326e607020e10293af701f136"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "0324e607020e10293a0000f136"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "0724e607020e10293a0000ce04"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "02a6e607020e10293af7019a38"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "02a4e607020e10293a00009a38"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "06a4e607020e10293a0000fc03"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "03a6e607020e10293af701f136"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "03a4e607020e10293a0000f136"}, + {"Mi_Body_Scale_2", "0x181b", "servicedata", "07a4e607020e10293a0000ce04"}, {"Mokobeacon", "0xff01", "servicedata", "64000000005085a000f0ffe003"}, {"MokoXPro", "feab", "servicedata", "70000a011201ee0caf03def14635998a"}, {"GAEN", "fd6f", "servicedata", "e7c6d34c71e48baf278bd99be74685bca78126ab"}, @@ -215,6 +237,17 @@ TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::MIBAND, TheengsDecoder::BLE_ID_NUM::XMTZC04HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, + TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::MOKOBEACON, TheengsDecoder::BLE_ID_NUM::MOKOBEACONXPRO, TheengsDecoder::BLE_ID_NUM::GAEN, @@ -228,6 +261,11 @@ static bool floatEqual(T f1, T f2) { bool checkResult(JsonObject result, JsonObject expected) { if (result.size() != expected.size()) { std::cout << "Key:value count mismatch, result " << result.size() << ", expected " << expected.size() << std::endl; + std::cout << "Expected: "; + serializeJson(expected, std::cout); + std::cout << std::endl; + std::cout << "Got JSON: "; + serializeJson(result, std::cout); return false; } From 8604ffa6540b5bdc1285d87ca2cb018a4f5d7494 Mon Sep 17 00:00:00 2001 From: DigiH Date: Mon, 14 Feb 2022 15:18:12 +0100 Subject: [PATCH 14/23] XMTZC04HM stabilised change XMTZC04HM stabilised change to 'a' --- src/devices/XMTZC04HM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index 7de05d9d..6d57f800 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,13 +2,13 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized -const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", "model":"Miscale_v1", "model_id":"XMTZC04HM", - "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "2"], + "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "a"], "properties":{ "unit":{ "condition":["servicedata", 1, "2"], From b196bbcd2466f027c90b4c21009c9f2ff25471d9 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:20:40 +0100 Subject: [PATCH 15/23] Split 2 OR a decoder test --- src/devices/XMTZC04HM_json.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index 6d57f800..c6c13576 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,11 +2,40 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized +const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +/*R""""( +{ + "brand":"Xiaomi", + "model":"Miscale_v1_2", + "model_id":"XMTZC04HM", + "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "2"], + "properties":{ + "unit":{ + "condition":["servicedata", 1, "2"], + "decoder":["static_value", "kg"] + }, + "weight":{ + "condition":["servicedata", 1, "2"], + "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], + "post_proc":["/", 200] + }, + "_unit":{ + "condition":["servicedata", 1, "3"], + "decoder":["static_value", "lbs"] + }, + "_weight":{ + "condition":["servicedata", 1, "3"], + "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], + "post_proc":["/", 100] + } + } +})"""";*/ + const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", - "model":"Miscale_v1", + "model":"Miscale_v1_a", "model_id":"XMTZC04HM", "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "a"], "properties":{ From 5e74615b339dda17bd59518832e9dc8053a9c588 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:22:26 +0100 Subject: [PATCH 16/23] Update XMTZC04HM_json.h --- src/devices/XMTZC04HM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index c6c13576..07e9757e 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,7 +2,7 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized -const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", @@ -31,7 +31,7 @@ const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\" } })"""";*/ -const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_va = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", From 824bb4c8105063d234f221359909a07d8f536736 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:25:18 +0100 Subject: [PATCH 17/23] Update XMTZC04HM_json.h --- src/devices/XMTZC04HM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index 07e9757e..766d6729 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -2,7 +2,7 @@ // A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized -const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_2\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", @@ -31,7 +31,7 @@ const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\" } })"""";*/ -const char* _XMTZC04HM_json_va = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_va = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_a\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", From fb2a6205472e925c49412b5b0d9a4d2abba01bc8 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:26:26 +0100 Subject: [PATCH 18/23] Update devices.h --- src/devices.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/devices.h b/src/devices.h index 26586a92..f8d6524e 100644 --- a/src/devices.h +++ b/src/devices.h @@ -74,7 +74,8 @@ const char* _devices[][2] = { {_IBT_4XS_json, _IBT_4XS_json_props}, {_IBT_6XS_json, _IBT_6XS_json_props}, {_Miband_json, _Miband_json_props}, - {_XMTZC04HM_json, _XMTZC04HM_json_props}, + {_XMTZC04HM_json_v2, _XMTZC04HM_json_props}, + {_XMTZC04HM_json_va, _XMTZC04HM_json_props}, {_XMTZC05HM_json, _XMTZC05HM_json_props}, {_TPMS_json, _TPMS_json_props}, {_LYWSD03MMC_ATC_json, _LYWSD03MMC_ATC_props}, From 7150866233ac6e4187fdb22f5f14af28b662d227 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:49:47 +0100 Subject: [PATCH 19/23] Update decoder.h --- src/decoder.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/decoder.h b/src/decoder.h index df0ec1c4..da30ec55 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -62,7 +62,8 @@ class TheengsDecoder { IBT4XS, IBT6XS, MIBAND, - XMTZC04HM, + XMTZC04HM_v2, + XMTZC04HM_va, XMTZC05HM, TPMS, LYWSD03MMC_ATC, From 328ae66b7ed5f028b084069170da0fddb28bb903 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 01:55:42 +0100 Subject: [PATCH 20/23] Update test_ble.cpp --- tests/BLE/test_ble.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 90e53410..3d797fb7 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -235,7 +235,7 @@ const char* test_uuid[][4] = { TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::MIBAND, - TheengsDecoder::BLE_ID_NUM::XMTZC04HM, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM_va, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, From 5ceb83e1402c5a14ff3f63ab000bd6b2ec6be74b Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 15 Feb 2022 02:04:05 +0100 Subject: [PATCH 21/23] Update test_ble.cpp --- tests/BLE/test_ble.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 3d797fb7..203879cc 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -236,6 +236,7 @@ const char* test_uuid[][4] = { TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::MIBAND, TheengsDecoder::BLE_ID_NUM::XMTZC04HM_va, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM_v2, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, From 5ea8909d789f2ca7e6b3105f3850e1a6a836c41c Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 22 Feb 2022 02:12:47 +0100 Subject: [PATCH 22/23] Latest XMTZC04HM Update for testing Latest XMTZC04HM Update for testing with multiple model and property conditions. Should work fine with kg for person and object weighing recognition, possibly also already for lbs, but needs testing and for person and object lbs weighings. --- docs/devices/XMTZC04HM.md | 8 +++--- src/decoder.h | 3 +- src/devices.h | 3 +- src/devices/XMTZC04HM_json.h | 54 ++++++++++++++---------------------- src/devices/common_props.h | 11 -------- tests/BLE/test_ble.cpp | 16 ++++++++--- 6 files changed, 39 insertions(+), 56 deletions(-) diff --git a/docs/devices/XMTZC04HM.md b/docs/devices/XMTZC04HM.md index 1b82b70d..c5550bac 100644 --- a/docs/devices/XMTZC04HM.md +++ b/docs/devices/XMTZC04HM.md @@ -1,12 +1,12 @@ -# Xiaomi MiScale V1 +# Xiaomi Mi Smart Scale 2 |Model Id|[XMTZC04HM](https://github.com/theengs/decoder/blob/development/src/devices/XMTZC04HM_json.h)| |-|-| |Brand|Xiaomi| -|Model|MiScale V1| -|Short Description|First version of the scale| +|Model|Mi Smart Scale 2| +|Short Description|Second version of the Mi Smart Scale| |Communication|BLE broadcast| |Frequency|2.4Ghz| |Power source|3 AAA| -|Exchanged data|unit, weight| +|Exchanged data|weighing_mode, unit, weight| |Encrypted|No| diff --git a/src/decoder.h b/src/decoder.h index da30ec55..df0ec1c4 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -62,8 +62,7 @@ class TheengsDecoder { IBT4XS, IBT6XS, MIBAND, - XMTZC04HM_v2, - XMTZC04HM_va, + XMTZC04HM, XMTZC05HM, TPMS, LYWSD03MMC_ATC, diff --git a/src/devices.h b/src/devices.h index f8d6524e..26586a92 100644 --- a/src/devices.h +++ b/src/devices.h @@ -74,8 +74,7 @@ const char* _devices[][2] = { {_IBT_4XS_json, _IBT_4XS_json_props}, {_IBT_6XS_json, _IBT_6XS_json_props}, {_Miband_json, _Miband_json_props}, - {_XMTZC04HM_json_v2, _XMTZC04HM_json_props}, - {_XMTZC04HM_json_va, _XMTZC04HM_json_props}, + {_XMTZC04HM_json, _XMTZC04HM_json_props}, {_XMTZC05HM_json, _XMTZC05HM_json_props}, {_TPMS_json, _TPMS_json_props}, {_LYWSD03MMC_ATC_json, _LYWSD03MMC_ATC_props}, diff --git a/src/devices/XMTZC04HM_json.h b/src/devices/XMTZC04HM_json.h index 766d6729..d9a47f25 100644 --- a/src/devices/XMTZC04HM_json.h +++ b/src/devices/XMTZC04HM_json.h @@ -1,28 +1,32 @@ -#include "common_props.h" - -// A condition is done on the first character = 2 so as to verify if the weight is stabilized, the decoder doesn't decode weights that are not stabilized - -const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_2\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"2\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Smart_Scale_2\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"servicedata\",\"index\",0,\"2\",\"|\",\"servicedata\",\"index\",0,\"a\",\"|\",\"servicedata\",\"index\",0,\"6\",\"|\",\"servicedata\",\"index\",0,\"e\",\"&\",\"uuid\",\"contain\",\"181d\"],\"properties\":{\"weighing_mode\":{\"condition\":[\"servicedata\",0,\"2\",\"|\",\"servicedata\",0,\"a\"],\"decoder\":[\"static_value\",\"person\"]},\"_weighing_mode\":{\"condition\":[\"servicedata\",0,\"6\",\"|\",\"servicedata\",0,\"e\"],\"decoder\":[\"static_value\",\"object\"]},\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; /*R""""( { "brand":"Xiaomi", - "model":"Miscale_v1_2", + "model":"Mi_Smart_Scale_2", "model_id":"XMTZC04HM", - "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "2"], + "condition":["servicedata", "index", 0, "2", "|", "servicedata", "index", 0, "a", "|", "servicedata", "index", 0, "6", "|", "servicedata", "index", 0, "e", "&", "uuid", "contain", "181d"], "properties":{ + "weighing_mode":{ + "condition":["servicedata", 0, "2", "|", "servicedata", 0, "a"], + "decoder":["static_value", "person"] + }, + "_weighing_mode":{ + "condition":["servicedata", 0, "6", "|", "servicedata", 0, "e"], + "decoder":["static_value", "object"] + }, "unit":{ "condition":["servicedata", 1, "2"], "decoder":["static_value", "kg"] }, + "_unit":{ + "condition":["servicedata", 1, "3"], + "decoder":["static_value", "lbs"] + }, "weight":{ "condition":["servicedata", 1, "2"], "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], "post_proc":["/", 200] }, - "_unit":{ - "condition":["servicedata", 1, "3"], - "decoder":["static_value", "lbs"] - }, "_weight":{ "condition":["servicedata", 1, "3"], "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], @@ -31,33 +35,17 @@ const char* _XMTZC04HM_json_v2 = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_2 } })"""";*/ -const char* _XMTZC04HM_json_va = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1_a\",\"model_id\":\"XMTZC04HM\",\"condition\":[\"uuid\",\"contain\",\"181d\",\"&\",\"servicedata\",\"index\",0,\"a\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",2,4,true,false],\"post_proc\":[\"/\",100]}}}"; +const char* _XMTZC04HM_json_props = "{\"properties\":{\"weighing_mode\":{\"unit\":\"string\",\"name\":\"weighing_mode\"},\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"}}}"; /*R""""( { - "brand":"Xiaomi", - "model":"Miscale_v1_a", - "model_id":"XMTZC04HM", - "condition":["uuid", "contain", "181d", "&", "servicedata", "index", 0, "a"], "properties":{ - "unit":{ - "condition":["servicedata", 1, "2"], - "decoder":["static_value", "kg"] + "weighing_mode":{ + "unit":"string", + "name":"weighing_mode" }, "weight":{ - "condition":["servicedata", 1, "2"], - "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], - "post_proc":["/", 200] - }, - "_unit":{ - "condition":["servicedata", 1, "3"], - "decoder":["static_value", "lbs"] - }, - "_weight":{ - "condition":["servicedata", 1, "3"], - "decoder":["value_from_hex_data", "servicedata", 2, 4, true, false], - "post_proc":["/", 100] + "unit":"kg", + "name":"weight" } } })"""";*/ - -const char* _XMTZC04HM_json_props = _common_weight_props; diff --git a/src/devices/common_props.h b/src/devices/common_props.h index 24789694..ad818304 100644 --- a/src/devices/common_props.h +++ b/src/devices/common_props.h @@ -59,15 +59,4 @@ const char* _common_BVTH_props = "{\"properties\":{\"batt\":{\"unit\":\"%\",\"na } })"""";*/ -const char* _common_weight_props = "{\"properties\":{\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"}}}"; -/*R""""( -{ - "properties":{ - "weight":{ - "unit":"kg", - "name":"weight" - } - } -})"""";*/ - #endif diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 203879cc..466ac90a 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -68,7 +68,10 @@ const char* expected_mfg[] = { const char* expected_uuid[] = { "{\"brand\":\"Xiaomi\",\"model\":\"Miband\",\"model_id\":\"MiBand\",\"steps\":7842}", - "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v1\",\"model_id\":\"XMTZC04HM\",\"unit\":\"kg\",\"weight\":61.75}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Smart_Scale_2\",\"model_id\":\"XMTZC04HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":61.75}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Smart_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"object\",\"unit\":\"kg\",\"weight\":9.55}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Smart_Scale_2\",\"model_id\":\"XMTZC04HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":61.75}", + "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Smart_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"object\",\"unit\":\"kg\",\"weight\":9.55}", "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":72.45,\"impedance\":503}", "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"person\",\"unit\":\"kg\",\"weight\":72.45}", "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"weighing_mode\":\"object\",\"unit\":\"kg\",\"weight\":5.1}", @@ -215,7 +218,10 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ // uuid test input [test name] [uuid] [data source] [data] const char* test_uuid[][4] = { {"MiBand", "fee0", "servicedata", "a21e0000"}, - {"Miscale", "0x181d", "servicedata", "223e30b207010708031f"}, + {"Mi_Smart_Scale_2", "0x181d", "servicedata", "223e30e607020e10293a"}, + {"Mi_Smart_Scale_2", "0x181d", "servicedata", "627607e607020e10293a"}, + {"Mi_Smart_Scale_2", "0x181d", "servicedata", "a23e30e607020e10293a"}, + {"Mi_Smart_Scale_2", "0x181d", "servicedata", "e27607e607020e10293a"}, {"Mi_Body_Scale_2", "0x181b", "servicedata", "0226e607020e10293af7019a38"}, {"Mi_Body_Scale_2", "0x181b", "servicedata", "0224e607020e10293a00009a38"}, {"Mi_Body_Scale_2", "0x181b", "servicedata", "0624e607020e10293a0000fc03"}, @@ -235,8 +241,10 @@ const char* test_uuid[][4] = { TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{ TheengsDecoder::BLE_ID_NUM::MIBAND, - TheengsDecoder::BLE_ID_NUM::XMTZC04HM_va, - TheengsDecoder::BLE_ID_NUM::XMTZC04HM_v2, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM, + TheengsDecoder::BLE_ID_NUM::XMTZC04HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, TheengsDecoder::BLE_ID_NUM::XMTZC05HM, From ca8d93fc8a0188b9a6e30db33d321f20a72a7383 Mon Sep 17 00:00:00 2001 From: DigiH Date: Tue, 22 Feb 2022 02:18:24 +0100 Subject: [PATCH 23/23] decoder & devices revert --- src/decoder.h | 3 +-- src/devices.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/decoder.h b/src/decoder.h index da30ec55..df0ec1c4 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -62,8 +62,7 @@ class TheengsDecoder { IBT4XS, IBT6XS, MIBAND, - XMTZC04HM_v2, - XMTZC04HM_va, + XMTZC04HM, XMTZC05HM, TPMS, LYWSD03MMC_ATC, diff --git a/src/devices.h b/src/devices.h index f8d6524e..26586a92 100644 --- a/src/devices.h +++ b/src/devices.h @@ -74,8 +74,7 @@ const char* _devices[][2] = { {_IBT_4XS_json, _IBT_4XS_json_props}, {_IBT_6XS_json, _IBT_6XS_json_props}, {_Miband_json, _Miband_json_props}, - {_XMTZC04HM_json_v2, _XMTZC04HM_json_props}, - {_XMTZC04HM_json_va, _XMTZC04HM_json_props}, + {_XMTZC04HM_json, _XMTZC04HM_json_props}, {_XMTZC05HM_json, _XMTZC05HM_json_props}, {_TPMS_json, _TPMS_json_props}, {_LYWSD03MMC_ATC_json, _LYWSD03MMC_ATC_props},