From 96911202d262af1208ecd82bb276c201fd9ae560 Mon Sep 17 00:00:00 2001 From: Florian <1technophile@users.noreply.github.com> Date: Mon, 24 Jan 2022 16:44:11 -0600 Subject: [PATCH] Restrict ThermoBeacon condition to = 40 (#62) The WS08 advertize also another manufacturerdata with a 44 length but not with the same data, so restrict the scope of the decoder to the known format Update sensor brand also --- docs/devices/WS02.md | 4 ++-- docs/devices/WS08.md | 4 ++-- src/devices/WS02_json.h | 6 +++--- src/devices/WS08_json.h | 6 +++--- tests/BLE/test_ble.cpp | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/devices/WS02.md b/docs/devices/WS02.md index 82e62674..06fba10d 100644 --- a/docs/devices/WS02.md +++ b/docs/devices/WS02.md @@ -2,9 +2,9 @@ |Model Id|[WS02](https://github.com/theengs/decoder/blob/development/src/devices/WS02_json.h)| |-|-| -|Brand|ThermoBeacon| +|Brand|SensorBlue| |Model|WS02| -|Short Description|Beacon, temperature and humidity sensor| +|Short Description|Beacon, temperature and humidity sensor, also known as ThermoBeacon| |Communication|BLE broadcast| |Frequency|2.4Ghz| |Power source|CR2032| diff --git a/docs/devices/WS08.md b/docs/devices/WS08.md index 52c4ce51..6cca6181 100644 --- a/docs/devices/WS08.md +++ b/docs/devices/WS08.md @@ -2,9 +2,9 @@ |Model Id|[WS08](https://github.com/theengs/decoder/blob/development/src/devices/WS08_json.h)| |-|-| -|Brand|ThermoBeacon| +|Brand|SensorBlue| |Model|WS08| -|Short Description|Beacon, temperature and humidity sensor with LCD and magnet| +|Short Description|Beacon, temperature and humidity sensor with LCD and magnet, also known as ThermoBeacon| |Communication|BLE broadcast| |Frequency|2.4Ghz| |Power source|CR2477| diff --git a/src/devices/WS02_json.h b/src/devices/WS02_json.h index e2c46783..975adf24 100644 --- a/src/devices/WS02_json.h +++ b/src/devices/WS02_json.h @@ -1,11 +1,11 @@ -const char* _WS02_json = "{\"brand\":\"ThermoBeacon\",\"model\":\"WS02\",\"model_id\":\"WS02\",\"condition\":[\"manufacturerdata\",\">=\",40,\"index\",0,\"10000000\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true],\"post_proc\":[\"/\",16]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true],\"post_proc\":[\"/\",16]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,4,true],\"post_proc\":[\"/\",1000]}}}"; +const char* _WS02_json = "{\"brand\":\"SensorBlue\",\"model\":\"WS02\",\"model_id\":\"WS02\",\"condition\":[\"manufacturerdata\",\"=\",40,\"index\",0,\"10000000\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true],\"post_proc\":[\"/\",16]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true],\"post_proc\":[\"/\",16]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,4,true],\"post_proc\":[\"/\",1000]}}}"; /*R""""( { - "brand":"ThermoBeacon", + "brand":"SensorBlue", "model":"WS02", "model_id":"WS02", - "condition":["manufacturerdata", ">=", 40, "index", 0, "10000000"], + "condition":["manufacturerdata", "=", 40, "index", 0, "10000000"], "properties":{ "tempc":{ "decoder":["value_from_hex_data", "manufacturerdata", 24, 4, true], diff --git a/src/devices/WS08_json.h b/src/devices/WS08_json.h index bdf2aba8..d165c85a 100644 --- a/src/devices/WS08_json.h +++ b/src/devices/WS08_json.h @@ -1,11 +1,11 @@ -const char* _WS08_json = "{\"brand\":\"ThermoBeacon\",\"model\":\"WS08\",\"model_id\":\"WS08\",\"condition\":[\"manufacturerdata\",\">=\",40,\"index\",0,\"11000000\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true],\"post_proc\":[\"/\",16]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true],\"post_proc\":[\"/\",16]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,4,true],\"post_proc\":[\"/\",1000]}}}"; +const char* _WS08_json = "{\"brand\":\"SensorBlue\",\"model\":\"WS08\",\"model_id\":\"WS08\",\"condition\":[\"manufacturerdata\",\"=\",40,\"index\",0,\"11000000\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true],\"post_proc\":[\"/\",16]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true],\"post_proc\":[\"/\",16]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,4,true],\"post_proc\":[\"/\",1000]}}}"; /*R""""( { - "brand":"ThermoBeacon", + "brand":"SensorBlue", "model":"WS08", "model_id":"WS08", - "condition":["manufacturerdata", ">=", 40, "index", 0, "11000000"], + "condition":["manufacturerdata", "=", 40, "index", 0, "11000000"], "properties":{ "tempc":{ "decoder":["value_from_hex_data", "manufacturerdata", 24, 4, true], diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 6110cfce..2f1e10a2 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -43,8 +43,8 @@ const char* expected_mfg[] = { "{\"brand\":\"GENERIC\",\"model\":\"TPMS\",\"model_id\":\"TPMS\",\"count\":1,\"pres\":222.708,\"tempc\":31.96,\"tempf\":89.528,\"batt\":51,\"alarm\":false}", "{\"brand\":\"GENERIC\",\"model\":\"IBEACON\",\"model_id\":\"IBEACON\",\"mfid\":\"4c00\",\"uuid\":\"426c7565436861726d426561636f6e73\",\"major\":3838,\"minor\":4949,\"power\":-59}", "{\"brand\":\"GENERIC\",\"model\":\"IBEACON\",\"model_id\":\"IBEACON\",\"mfid\":\"4c00\",\"uuid\":\"fda50693a4e24fb1afcfc6eb07647825\",\"major\":1,\"minor\":2,\"battery\":2.6}", - "{\"brand\":\"ThermoBeacon\",\"model\":\"WS02\",\"model_id\":\"WS02\",\"tempc\":31.3125,\"tempf\":88.3625,\"hum\":70.75,\"volt\":3.160}", - "{\"brand\":\"ThermoBeacon\",\"model\":\"WS08\",\"model_id\":\"WS08\",\"tempc\":31.3125,\"tempf\":88.3625,\"hum\":70.75,\"volt\":3.160}", + "{\"brand\":\"SensorBlue\",\"model\":\"WS02\",\"model_id\":\"WS02\",\"tempc\":31.3125,\"tempf\":88.3625,\"hum\":70.75,\"volt\":3.160}", + "{\"brand\":\"SensorBlue\",\"model\":\"WS08\",\"model_id\":\"WS08\",\"tempc\":31.3125,\"tempf\":88.3625,\"hum\":70.75,\"volt\":3.160}", "{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrometer\",\"model_id\":\"H5075\",\"tempc\":26.8,\"tempf\":80.24,\"hum\":52.6,\"batt\":100}", "{\"brand\":\"Govee\",\"model\":\"Thermo Hygrometer\",\"model_id\":\"H5072\",\"tempc\":27.5,\"tempf\":81.5,\"hum\":53.1,\"batt\":100}", "{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrometer\",\"model_id\":\"H5102\",\"tempc\":21.9,\"tempf\":71.42,\"hum\":40.6,\"batt\":100}",