Skip to content

Commit

Permalink
Restrict ThermoBeacon condition to = 40 (#62)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
1technophile authored Jan 24, 2022
1 parent 89643ba commit 9691120
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/devices/WS02.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
4 changes: 2 additions & 2 deletions docs/devices/WS08.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
6 changes: 3 additions & 3 deletions src/devices/WS02_json.h
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
6 changes: 3 additions & 3 deletions src/devices/WS08_json.h
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
4 changes: 2 additions & 2 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down

0 comments on commit 9691120

Please sign in to comment.