Skip to content

Commit

Permalink
Add SE sensors (#458)
Browse files Browse the repository at this point in the history
Temperature, temperature/humidity, magnetic decoding

Co-authored-by: Florian <[email protected]>
  • Loading branch information
1technophile and 1technophile authored Nov 30, 2023
1 parent 0c9dc6f commit fca4da8
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/devices/SE_MAG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sensor Easy Door/Window sensor

|Model Id|[SE_MAG](https://github.com/theengs/decoder/blob/development/src/devices/SE_MAG_json.h)|
|-|-|
|Brand|Sensor Easy|
|Model|Sensor Easy Door/Window Pro|
|Short Description|Indoor/Outdoor Magnetic sensor|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|embedded|
|Exchanged Data|open, battery, volt|
|Encrypted|No|
12 changes: 12 additions & 0 deletions docs/devices/SE_RHT_PRO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sensor Easy Thermometer and Hygrometer Pro

|Model Id|[SE_RHT](https://github.com/theengs/decoder/blob/development/src/devices/SE_RHT_json.h)|
|-|-|
|Brand|Sensor Easy|
|Model|Sensor Easy Temperature and Humidity Pro|
|Short Description|Indoor/Outdoor Thermometer|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|embedded|
|Exchanged Data|temperature, humidity, battery, volt|
|Encrypted|No|
12 changes: 12 additions & 0 deletions docs/devices/SE_TEMP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sensor Easy Thermometer

|Model Id|[SE_TEMP](https://github.com/theengs/decoder/blob/development/src/devices/SE_TEMP_json.h)|
|-|-|
|Brand|Sensor Easy|
|Model|Sensor Easy Temperature|
|Short Description|Indoor/Outdoor Thermometer|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|embedded|
|Exchanged Data|temperature, battery, volt|
|Encrypted|No|
12 changes: 12 additions & 0 deletions docs/devices/SE_TEMP_PRO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sensor Easy Thermometer Pro

|Model Id|[SE_TEMP](https://github.com/theengs/decoder/blob/development/src/devices/SE_TEMP_json.h)|
|-|-|
|Brand|Sensor Easy|
|Model|Sensor Easy Temperature Pro|
|Short Description|Indoor/Outdoor Thermometer|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|embedded|
|Exchanged Data|temperature, battery, volt|
|Encrypted|No|
12 changes: 12 additions & 0 deletions docs/devices/SE_TPROBE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sensor Easy Thermometer External Probe Pro

|Model Id|[SE_TPROBE](https://github.com/theengs/decoder/blob/development/src/devices/SE_TPROBE_json.h)|
|-|-|
|Brand|Sensor Easy|
|Model|Sensor Easy Temperature External Probe Pro|
|Short Description|Indoor/Outdoor Thermometer|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|embedded|
|Exchanged Data|temperature, battery, volt|
|Encrypted|No|
4 changes: 4 additions & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ class TheengsDecoder {
APPLE_CONT,
APPLE_CONTAT,
SERVICE_DATA,
SE_RHT,
SE_TEMP,
SE_TPROBE,
SE_MAG,
SBBT_002C,
SBBT_002C_ENCR,
SBDW_002C,
Expand Down
8 changes: 8 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
#include "devices/iBeacon_json.h"
#include "devices/APPLE_json.h"
#include "devices/ServiceData_json.h"
#include "devices/SE_RHT_json.h"
#include "devices/SE_TEMP_json.h"
#include "devices/SE_TPROBE_json.h"
#include "devices/SE_MAG_json.h"
#include "devices/SBBT_002C_json.h"
#include "devices/SBBT_002C_ENCR_json.h"
#include "devices/SBDW_002C_json.h"
Expand Down Expand Up @@ -194,6 +198,10 @@ const char* _devices[][2] = {
{_APPLE_json, _APPLE_json_props},
{_APPLE_json_at, _APPLE_json_props},
{_ServiceData_json, _ServiceData_json_props},
{_SE_RHT_json, _SE_RHT_json_props},
{_SE_TEMP_json, _SE_TEMP_json_props},
{_SE_TPROBE_json, _SE_TPROBE_json_props},
{_SE_MAG_json, _SE_MAG_json_props},
{_SBBT_002C_json, _SBBT_002C_json_props},
{_SBBT_002C_ENCR_json, _SBBT_002C_ENCR_json_props},
{_SBDW_002C_json, _SBDW_002C_json_props},
Expand Down
40 changes: 40 additions & 0 deletions src/devices/SE_MAG_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const char* _SE_MAG_json = "{\"brand\":\"Sensor Easy\",\"model\":\"SE MAG\",\"model_id\":\"SE_MAG\",\"tag\":\"0404\",\"condition\":[\"servicedata\",\"=\",4,\"&\",\"uuid\",\"index\",0,\"2a06\",\"&\",\"name\",\"index\",1,\" MAG\"],\"properties\":{\"open\":{\"decoder\":[\"bit_static_value\",\"servicedata\",1,0,true,false]},\"volt\":{\"condition\":[\"manufacturerdata\",\"=\",10,\"index\",4,\"f2\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",6,4,true,false],\"post_proc\":[\"/\",1000]}}}";

/*
R""""(
{
"brand":"Sensor Easy",
"model":"SE MAG",
"model_id":"SE_MAG",
"tag":"0404",
"condition":["servicedata", "=", 4, "&", "uuid", "index", 0, "2a06","&", "name", "index", 1, " MAG"],
"properties":{
"open":{
"decoder":["bit_static_value", "servicedata", 1, 0, true, false]
},
"volt":{
"condition":["manufacturerdata", "=", 10,"index", 4, "f2"],
"decoder":["value_from_hex_data", "manufacturerdata", 6, 4, true, false],
"post_proc":["/", 1000]
}
}
})"""";
*/

const char* _SE_MAG_json_props = "{\"properties\":{\"open\":{\"unit\":\"status\",\"name\":\"door\"},\"volt\":{\"unit\":\"V\",\"name\":\"voltage\"}}}";

/*
R""""(
{
"properties": {
"open":{
"unit":"status",
"name":"door"
},
"volt": {
"unit": "V",
"name": "voltage"
}
}
})"""";
*/
30 changes: 30 additions & 0 deletions src/devices/SE_RHT_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "common_props.h"

const char* _SE_RHT_json = "{\"brand\":\"Sensor Easy\",\"model\":\"SE RHT\",\"model_id\":\"SE_RHT\",\"tag\":\"01\",\"condition\":[\"name\",\"index\",1,\" RHT \",\"&\",\"uuid\",\"index\",0,\"2a6e\",\"|\",\"uuid\",\"index\",0,\"2a6f\"],\"properties\":{\"tempc\":{\"condition\":[\"servicedata\",\"=\",4],\"decoder\":[\"value_from_hex_data\",\"servicedata\",0,4,true,true],\"post_proc\":[\"/\",100]},\"hum\":{\"condition\":[\"servicedata\",\"=\",2],\"decoder\":[\"value_from_hex_data\",\"servicedata\",0,2,true,true]},\"volt\":{\"condition\":[\"manufacturerdata\",\"=\",10,\"index\",4,\"f2\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",6,4,true,false],\"post_proc\":[\"/\",1000]}}}";

/*R""""(
{
"brand":"Sensor Easy",
"model":"SE RHT",
"model_id":"SE_RHT",
"tag":"01",
"condition":["name", "index", 1, " RHT ","&", "uuid", "index", 0, "2a6e","|", "uuid", "index", 0, "2a6f"],
"properties":{
"tempc":{
"condition":["servicedata", "=", 4],
"decoder":["value_from_hex_data", "servicedata", 0, 4, true, true],
"post_proc":["/", 100]
},
"hum":{
"condition":["servicedata", "=", 2],
"decoder":["value_from_hex_data", "servicedata", 0, 2, true, true]
},
"volt":{
"condition":["manufacturerdata", "=", 10,"index", 4, "f2"],
"decoder":["value_from_hex_data", "manufacturerdata", 6, 4, true, false],
"post_proc":["/", 1000]
}
}
})"""";*/

const char* _SE_RHT_json_props = _common_BVTH_props;
37 changes: 37 additions & 0 deletions src/devices/SE_TEMP_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const char* _SE_TEMP_json = "{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP\",\"model_id\":\"SE_TEMP\",\"tag\":\"01\",\"condition\":[\"servicedata\",\"=\",4,\"&\",\"uuid\",\"index\",0,\"2a6e\",\"&\",\"name\",\"index\",1,\" T \"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",0,4,true,true],\"post_proc\":[\"/\",100]},\"volt\":{\"condition\":[\"manufacturerdata\",\"=\",10,\"index\",4,\"f2\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",6,4,true,false],\"post_proc\":[\"/\",1000]}}}";

/*R""""(
{
"brand":"Sensor Easy",
"model":"SE TEMP",
"model_id":"SE_TEMP",
"tag":"01",
"condition":["servicedata", "=", 4, "&", "uuid", "index", 0, "2a6e","&", "name", "index", 1, " T "],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "servicedata", 0, 4, true, true],
"post_proc":["/", 100]
},
"volt":{
"condition":["manufacturerdata", "=", 10,"index", 4, "f2"],
"decoder":["value_from_hex_data", "manufacturerdata", 6, 4, true, false],
"post_proc":["/", 1000]
}
}
})"""";
*/
const char* _SE_TEMP_json_props = "{\"properties\":{\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"volt\":{\"unit\":\"V\",\"name\":\"voltage\"}}}";

/*R""""(
{
"properties": {
"tempc": {
"unit": "°C",
"name": "temperature"
},
"volt": {
"unit": "V",
"name": "voltage"
}
}
})"""";*/
37 changes: 37 additions & 0 deletions src/devices/SE_TPROBE_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const char* _SE_TPROBE_json = "{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP PROBE\",\"model_id\":\"SE_TPROBE\",\"tag\":\"01\",\"condition\":[\"servicedata\",\"=\",4,\"&\",\"uuid\",\"index\",0,\"2a6e\",\"&\",\"name\",\"index\",1,\" TPROBE\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",0,4,true,true],\"post_proc\":[\"/\",100]},\"volt\":{\"condition\":[\"manufacturerdata\",\"=\",10,\"index\",4,\"f2\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",6,4,true,false],\"post_proc\":[\"/\",1000]}}}";

/*R""""(
{
"brand":"Sensor Easy",
"model":"SE TEMP PROBE",
"model_id":"SE_TPROBE",
"tag":"01",
"condition":["servicedata", "=", 4, "&", "uuid", "index", 0, "2a6e","&", "name", "index", 1, " TPROBE"],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "servicedata", 0, 4, true, true],
"post_proc":["/", 100]
},
"volt":{
"condition":["manufacturerdata", "=", 10,"index", 4, "f2"],
"decoder":["value_from_hex_data", "manufacturerdata", 6, 4, true, false],
"post_proc":["/", 1000]
}
}
})"""";
*/
const char* _SE_TPROBE_json_props = "{\"properties\":{\"tempc\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"volt\":{\"unit\":\"V\",\"name\":\"voltage\"}}}";

/*R""""(
{
"properties": {
"tempc": {
"unit": "°C",
"name": "temperature"
},
"volt": {
"unit": "V",
"name": "voltage"
}
}
})"""";*/
39 changes: 39 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ const char* expected_name_uuid_mfgsvcdata[] = {
"{\"brand\":\"SwitchBot\",\"model\":\"Outdoor Meter\",\"model_id\":\"W340001X\",\"type\":\"THB\",\"acts\":true,\"tempc\":25.5,\"tempf\":77.9,\"hum\":50,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"SwitchBot\",\"model\":\"Outdoor Meter\",\"model_id\":\"W340001X\",\"type\":\"THB\",\"acts\":true,\"tempc\":26.3,\"tempf\":79.34,\"hum\":80,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"SwitchBot\",\"model\":\"Outdoor Meter\",\"model_id\":\"W340001X\",\"type\":\"THB\",\"acts\":true,\"tempc\":-15.9,\"tempf\":3.38,\"hum\":42,\"batt\":65,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP\",\"model_id\":\"SE_TEMP\",\"type\":\"THB\",\"tempc\":21.79,\"tempf\":71.222,\"volt\":3.09}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE RHT\",\"model_id\":\"SE_RHT\",\"type\":\"THB\",\"hum\":47,\"volt\":3.097}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP PROBE\",\"model_id\":\"SE_TPROBE\",\"type\":\"THB\",\"tempc\":20.6,\"tempf\":69.08,\"volt\":3.044}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE MAG\",\"model_id\":\"SE_MAG\",\"type\":\"CTMO\",\"cont\":true,\"open\":false,\"volt\":3.079}",
};

const char* expected_name_mac_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -189,6 +193,15 @@ const char* expected_uuid_name_svcdata[] = {
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_PVVX_DECR\",\"type\":\"THB\",\"tempc\":24.60,\"tempf\":76.28,\"hum\":43.54,\"batt\":100}",
"{\"brand\":\"April Brother\",\"model\":\"N07\",\"model_id\":\"ABN07\",\"type\":\"THB\",\"acts\":true,\"track\":true,\"batt\":100,\"tempc\":24.51,\"tempf\":76.118,\"hum\":47.42,\"packet\":16}",
"{\"brand\":\"nut\",\"model\":\"Smart Tracker\",\"model_id\":\"NUTALE\",\"type\":\"TRACK\",\"cidc\":false,\"acts\":true,\"cont\":true,\"track\":true,\"device\":\"nutale Tracker\"}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP\",\"model_id\":\"SE_TEMP\",\"type\":\"THB\",\"tempc\":2.75,\"tempf\":36.95}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP\",\"model_id\":\"SE_TEMP\",\"type\":\"THB\",\"tempc\":-9.18,\"tempf\":15.476}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE RHT\",\"model_id\":\"SE_RHT\",\"type\":\"THB\",\"hum\":70}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE RHT\",\"model_id\":\"SE_RHT\",\"type\":\"THB\",\"tempc\":-19.96,\"tempf\":-3.928}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP\",\"model_id\":\"SE_TEMP\",\"type\":\"THB\",\"tempc\":21.6,\"tempf\":70.88}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE RHT\",\"model_id\":\"SE_RHT\",\"type\":\"THB\",\"tempc\":5.22,\"tempf\":41.396}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE TEMP PROBE\",\"model_id\":\"SE_TPROBE\",\"type\":\"THB\",\"tempc\":20.7,\"tempf\":69.26}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE MAG\",\"model_id\":\"SE_MAG\",\"type\":\"CTMO\",\"open\":true,\"cont\":true}",
"{\"brand\":\"Sensor Easy\",\"model\":\"SE MAG\",\"model_id\":\"SE_MAG\",\"type\":\"CTMO\",\"open\":false,\"cont\":true}",
};

const char* expected_uuid[] = {
Expand Down Expand Up @@ -621,6 +634,10 @@ const char* test_name_uuid_mfgsvcdata[][5] = {
{"SwitchBot Outdoor Meter", "Outdoor Meter", "0xfd3d", "6909aabbccddeeff8b0305993200", "770064"},
{"SwitchBot Outdoor Meter", "Outdoor Meter", "0xfd3d", "6909aabbccddeeff940b039a5000", "770064"},
{"SwitchBot Outdoor Meter", "Outdoor Meter", "0xfd3d", "6909aabbccddeeffe30f090f2a00", "770041"},
{"SE TEMP volt","P T EN 888444","0x2a6e","5707f2120c","8308"},
{"SE RHT volt","P RHT 88888B","0x2a6f","5707f2190c","2f"},
{"SE TEMP PROBE","P TPROBE 000000","0x2a6e","5707f2e40b","0c08"},
{"SE MAG","P MAG CCCCCC","0x2a06","5707f2070c","3b00"},
};

TheengsDecoder::BLE_ID_NUM test_name_uuid_mfgsvcdata_id_num[]{
Expand All @@ -633,6 +650,10 @@ TheengsDecoder::BLE_ID_NUM test_name_uuid_mfgsvcdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::SBOT,
TheengsDecoder::BLE_ID_NUM::SBOT,
TheengsDecoder::BLE_ID_NUM::SBOT,
TheengsDecoder::BLE_ID_NUM::SE_TEMP,
TheengsDecoder::BLE_ID_NUM::SE_RHT,
TheengsDecoder::BLE_ID_NUM::SE_TPROBE,
TheengsDecoder::BLE_ID_NUM::SE_MAG,
};

// uuid test input [test name] [mac] [device name] [uuid] [manufacturer data] [service data]
Expand Down Expand Up @@ -690,6 +711,15 @@ const char* test_uuid_name_svcdata[][4] = {
{"LYWSD03MMC_PVVX_DECR", "0x181a", "ATC_89DF88", "9c0902116404"},
{"ABN07", "0xfcd2", "asensor_7F7F", "4000100164029309038612"},
{"Nutale", "0x0900", "nutale", "aabbccddeeff160100010100"},
{"SE TEMP", "0x2a6e", "C T 999999", "1301"},
{"SE TEMP negative","0x2a6e","C T 88888E","6afc"},
{"SE RHT hum","0x2a6f","P RHT 99999A","46"},
{"SE RHT temp neg","0x2a6e","P RHT 33399T","34f8"},
{"SE TEMP temp positive","0x2a6e","P T EN 888444","7008"},
{"SE RHT temp pos","0x2a6e","P RHT 99999Z","0a02"},
{"SE TEMP PROBE temp","0x2a6e","P TPROBE 111999","1608"},
{"SE MAG Open","0x2a06","P MAG CCCCCC","2400"},
{"SE MAG Closed","0x2a06","P MAG CCCCCC","2900"},
};

TheengsDecoder::BLE_ID_NUM test_uuid_name_svcdata_id_num[]{
Expand Down Expand Up @@ -723,6 +753,15 @@ TheengsDecoder::BLE_ID_NUM test_uuid_name_svcdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::LYWSD03MMC_PVVX_DECR,
TheengsDecoder::BLE_ID_NUM::ABN07,
TheengsDecoder::BLE_ID_NUM::NUTALE,
TheengsDecoder::BLE_ID_NUM::SE_TEMP,
TheengsDecoder::BLE_ID_NUM::SE_TEMP,
TheengsDecoder::BLE_ID_NUM::SE_RHT,
TheengsDecoder::BLE_ID_NUM::SE_RHT,
TheengsDecoder::BLE_ID_NUM::SE_TEMP,
TheengsDecoder::BLE_ID_NUM::SE_RHT,
TheengsDecoder::BLE_ID_NUM::SE_TPROBE,
TheengsDecoder::BLE_ID_NUM::SE_MAG,
TheengsDecoder::BLE_ID_NUM::SE_MAG,
};

// uuid test input [test name] [uuid] [data source] [data]
Expand Down

0 comments on commit fca4da8

Please sign in to comment.