diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index d0f588dd..1b4f25d7 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -50,6 +50,7 @@ module.exports = { 'devices/TPMS', 'devices/VEGTRUG', 'devices/WS02', + 'devices/WS08', 'devices/HHCCJCY01HHCC', 'devices/XMTZC04HM', 'devices/XMTZC05HM', diff --git a/docs/devices/WS08.md b/docs/devices/WS08.md new file mode 100644 index 00000000..52c4ce51 --- /dev/null +++ b/docs/devices/WS08.md @@ -0,0 +1,12 @@ +# WS08 ThermoBeacon + +|Model Id|[WS08](https://github.com/theengs/decoder/blob/development/src/devices/WS08_json.h)| +|-|-| +|Brand|ThermoBeacon| +|Model|WS08| +|Short Description|Beacon, temperature and humidity sensor with LCD and magnet| +|Communication|BLE broadcast| +|Frequency|2.4Ghz| +|Power source|CR2477| +|Exchanged data|temperature, humidity, volt| +|Encrypted|No| diff --git a/src/decoder.h b/src/decoder.h index f8211b0a..5204090f 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -69,6 +69,7 @@ class TheengsDecoder { CGPR1, IBEACON, WS02, + WS08, H5075, H5072, H5102, diff --git a/src/devices.h b/src/devices.h index 9b22470e..c2f93ca2 100644 --- a/src/devices.h +++ b/src/devices.h @@ -48,6 +48,7 @@ #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" #include "devices/XMTZC05HM_json.h" #include "devices/iBeacon_json.h" @@ -77,6 +78,7 @@ const char* _devices[][2] = { {_CGPR1_json, _CGPR1_json_props}, {_ibeacon_json, _ibeacon_json_props}, {_WS02_json, _WS02_json_props}, + {_WS08_json, _WS08_json_props}, {_H5075_json, _H5075_json_props}, {_H5072_json, _H5072_json_props}, {_H5102_json, _H5102_json_props}, diff --git a/src/devices/WS02_json.h b/src/devices/WS02_json.h index ea652e5a..e2c46783 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,\"contain\",\"100000001a11\"],\"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\":\"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]}}}"; /*R""""( { "brand":"ThermoBeacon", "model":"WS02", "model_id":"WS02", - "condition":["manufacturerdata", ">=", 40, "contain", "100000001a11"], + "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 new file mode 100644 index 00000000..bdf2aba8 --- /dev/null +++ b/src/devices/WS08_json.h @@ -0,0 +1,42 @@ +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]}}}"; + +/*R""""( +{ + "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_props = "{\"properties\":{\"volt\":{\"unit\":\"V\",\"name\":\"voltage\"},\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"hum\":{\"unit\":\"%\",\"name\":\"humidity\"}}}"; +/*R""""( +{ + "properties":{ + "volt":{ + "unit":"V", + "name":"voltage" + }, + "tempc":{ + "unit":"°C", + "name":"temperature" + }, + "hum":{ + "unit":"%", + "name":"humidity" + } + } +})"""";*/ \ No newline at end of file diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index b5550124..6110cfce 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -44,6 +44,7 @@ const char* expected_mfg[] = { "{\"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\":\"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}", @@ -146,6 +147,7 @@ const char* test_mfgdata[][3] = { {"iBeacon", "BlueCharm_135727", "4c000215426c7565436861726d426561636f6e730efe1355c5"}, {"iBeacon", "NRF51822", "4c000215fda50693a4e24fb1afcfc6eb07647825000100021a"}, {"WS02", "ThermoBeacon", "100000001a110000f770580cf5016c0443090000"}, + {"WS08", "ThermoBeacon", "110000001a110000f770580cf5016c0443090000"}, {"H5075", "GVH5075_1234", "88ec000418ee6400"}, {"H5072", "GVH5072_1234", "88ec0004344b6400"}, {"H5102", "GVH5102_1234", "0100010103590e64"}, @@ -170,6 +172,7 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::IBEACON, TheengsDecoder::BLE_ID_NUM::IBEACON, TheengsDecoder::BLE_ID_NUM::WS02, + TheengsDecoder::BLE_ID_NUM::WS08, TheengsDecoder::BLE_ID_NUM::H5075, TheengsDecoder::BLE_ID_NUM::H5072, TheengsDecoder::BLE_ID_NUM::H5102,