Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/devices/BTH01.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tuya BTH01


|Model Id|[BTH01](https://github.com/theengs/decoder/blob/development/src/devices/BTH01_json.h)|
|Model Id|[BTH01](https://github.com/theengs/decoder/blob/development/src/devices/THB1_json.h)|
|-|-|
|Brand|Tuya|
|Model|BTH01 Thermo-Hygrometer|
Expand Down
12 changes: 12 additions & 0 deletions docs/devices/TH05F.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Tuya TH05

|Model Id|[TH05F](https://github.com/theengs/decoder/blob/development/src/devices/THB1_json.h)|
|-|-|
|Brand|Tuya|
|Model|TH05F Thermo-Hygrometer|
|Short Description|Temperature and humidity sensor with PVVX firmware|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|CR2032|
|Exchanged Data|temperature, humidity, battery, voltage|
|Encrypted|No|
1 change: 0 additions & 1 deletion src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ class TheengsDecoder {
T201,
T301,
THB1,
BTH01,
NUT,
NUTALE,
ITAG,
Expand Down
2 changes: 0 additions & 2 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
#include "devices/T201_json.h"
#include "devices/T301_json.h"
#include "devices/THB1_json.h"
#include "devices/BTH01_json.h"
#include "devices/tracker_json.h"
#include "devices/iNodeEM_json.h"
#include "devices/ARANET4_json.h"
Expand Down Expand Up @@ -247,7 +246,6 @@ const char* _devices[][2] = {
{_T201_json, _T201_json_props},
{_T301_json, _T301_json_props},
{_THB1_json, _THB1_json_props},
{_BTH01_json, _BTH01_json_props},
{_tracker_json_nut, _tracker_json_props},
{_tracker_json_nutale, _tracker_json_props},
{_tracker_json_itag, _tracker_json_props},
Expand Down
61 changes: 0 additions & 61 deletions src/devices/BTH01_json.h

This file was deleted.

8 changes: 4 additions & 4 deletions src/devices/THB1_json.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const char* _THB1_json = "{\"brand\":\"Tuya\",\"model\":\"THB1 Thermo-Hygrometer\",\"model_id\":\"THB1\",\"tag\":\"0102\",\"condition\":[\"servicedata\",\"=\",28,\"index\",0,\"40\",\"&\",\"uuid\",\"index\",0,\"fcd2\",\"&\",\"name\",\"index\",0,\"THB1\"],\"properties\":{\"packet\":{\"condition\":[\"servicedata\",2,\"00\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false]},\"tempc\":{\"condition\":[\"servicedata\",10,\"02\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",12,4,true,true],\"post_proc\":[\"/\",100]},\"hum\":{\"condition\":[\"servicedata\",16,\"03\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false],\"post_proc\":[\"/\",100]},\"batt\":{\"condition\":[\"servicedata\",6,\"01\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,false,false]},\"volt\":{\"condition\":[\"servicedata\",22,\"0c\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",24,4,true,false],\"post_proc\":[\"/\",1000]}}}";
const char* _THB1_json = "{\"brand\":\"Tuya\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"THB1/BTH01/TH05F\",\"tag\":\"0102\",\"condition\":[\"name\",\"index\",0,\"THB1\",\"|\",\"name\",\"index\",0,\"BTH01\",\"|\",\"name\",\"index\",0,\"TH05F\",\"&\",\"servicedata\",\"=\",28,\"index\",0,\"40\",\"&\",\"uuid\",\"index\",0,\"fcd2\"],\"properties\":{\"packet\":{\"condition\":[\"servicedata\",2,\"00\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false]},\"tempc\":{\"condition\":[\"servicedata\",10,\"02\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",12,4,true,true],\"post_proc\":[\"/\",100]},\"hum\":{\"condition\":[\"servicedata\",16,\"03\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false],\"post_proc\":[\"/\",100]},\"batt\":{\"condition\":[\"servicedata\",6,\"01\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,false,false]},\"volt\":{\"condition\":[\"servicedata\",22,\"0c\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",24,4,true,false],\"post_proc\":[\"/\",1000]}}}";
/* R""""(
{
"brand":"Tuya",
"model":"THB1 Thermo-Hygrometer",
"model_id":"THB1",
"model":"Thermo-Hygrometer",
"model_id":"THB1/BTH01/TH05F",
"tag":"0102",
"condition":["servicedata", "=", 28, "index", 0, "40", "&", "uuid", "index", 0, "fcd2", "&", "name", "index", 0, "THB1"],
"condition":["name", "index", 0, "THB1", "|", "name", "index", 0, "BTH01", "|", "name", "index", 0, "TH05F", "&", "servicedata", "=", 28, "index", 0, "40", "&", "uuid", "index", 0, "fcd2" ],
"properties":{
"packet":{
"condition":["servicedata", 2, "00"],
Expand Down
17 changes: 10 additions & 7 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,18 @@ const char* expected_uuid_name_svcdata[] = {
"{\"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}",
"{\"brand\":\"SwitchBot\",\"model\":\"Outdoor Meter\",\"model_id\":\"W340001X\",\"type\":\"THB\",\"batt\":65}",
"{\"brand\":\"Tuya\",\"model\":\"THB1 Thermo-Hygrometer\",\"model_id\":\"THB1\",\"type\":\"THB\",\"acts\":true,\"packet\":239,\"tempc\":17.94,\"tempf\":64.292,\"hum\":60.72,\"batt\":74,\"volt\":2.748}",
"{\"brand\":\"Tuya\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"THB1/BTH01/TH05F\",\"type\":\"THB\",\"acts\":true,\"packet\":239,\"tempc\":17.94,\"tempf\":64.292,\"hum\":60.72,\"batt\":74,\"volt\":2.748}",
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_PVVX_BTHOME\",\"type\":\"THB\",\"acts\":true,\"packet_1\":132,\"tempc\":20.79,\"tempf\":69.422,\"hum\":71.88,\"batt\":100}",
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_PVVX_BTHOME\",\"type\":\"THB\",\"acts\":true,\"packet_2\":129,\"volt\":3.034,\"power\":1,\"open\":1}",
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_PVVX_BTHOME_ENCR\",\"type\":\"THB\",\"acts\":true,\"encr\":2,\"cipher\":\"be07860de133b342\",\"ctr\":\"23020000\",\"mic\":\"50dea27d\"}",
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_PVVX_BTHOME_ENCR\",\"type\":\"THB\",\"acts\":true,\"encr\":2,\"cipher\":\"613c80e969f052\",\"ctr\":\"a9000000\",\"mic\":\"77b39384\"}",
"{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv2.0\",\"type\":\"PLANT\",\"acts\":true,\"tempc\":26.55,\"tempf\":79.79,\"hum\":51,\"moi\":0,\"lux\":0,\"batt\":100,\"volt\":3.016}",
"{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv2.0\",\"type\":\"PLANT\",\"acts\":true,\"tempc\":27.68,\"tempf\":81.824,\"hum\":73,\"moi\":66,\"lux\":0,\"batt\":100,\"volt\":3.016}",
"{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv2.0\",\"type\":\"PLANT\",\"acts\":true,\"tempc\":30.36,\"tempf\":86.648,\"hum\":85,\"moi\":74,\"lux\":8392,\"batt\":100,\"volt\":3.005}",
"{\"brand\":\"Tuya\",\"model\":\"BTH01 Thermo-Hygrometer\",\"model_id\":\"BTH01\",\"type\":\"THB\",\"acts\":true,\"packet\":21,\"tempc\":25.42,\"tempf\":77.756,\"hum\":38.42,\"batt\":100,\"volt\":3.112}",
"{\"brand\":\"Tuya\",\"model\":\"BTH01 Thermo-Hygrometer\",\"model_id\":\"BTH01\",\"type\":\"THB\",\"acts\":true,\"packet\":28,\"tempc\":25.34,\"tempf\":77.612,\"hum\":38.26,\"batt\":100,\"volt\":3.12}",
"{\"brand\":\"Tuya\",\"model\":\"BTH01 Thermo-Hygrometer\",\"model_id\":\"BTH01\",\"type\":\"THB\",\"acts\":true,\"packet\":97,\"tempc\":28.01,\"tempf\":82.418,\"hum\":85.48,\"batt\":100,\"volt\":3.13}",
"{\"brand\":\"Tuya\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"THB1/BTH01/TH05F\",\"type\":\"THB\",\"acts\":true,\"packet\":21,\"tempc\":25.42,\"tempf\":77.756,\"hum\":38.42,\"batt\":100,\"volt\":3.112}",
"{\"brand\":\"Tuya\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"THB1/BTH01/TH05F\",\"type\":\"THB\",\"acts\":true,\"packet\":28,\"tempc\":25.34,\"tempf\":77.612,\"hum\":38.26,\"batt\":100,\"volt\":3.12}",
"{\"brand\":\"Tuya\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"THB1/BTH01/TH05F\",\"type\":\"THB\",\"acts\":true,\"packet\":97,\"tempc\":28.01,\"tempf\":82.418,\"hum\":85.48,\"batt\":100,\"volt\":3.13}",
"{\"brand\":\"Tuya\",\"model\":\"Thermo-Hygrometer\",\"model_id\":\"THB1/BTH01/TH05F\",\"type\":\"THB\",\"acts\":true,\"packet\":163,\"tempc\":26.92,\"tempf\":80.456,\"hum\":67.06,\"batt\":81,\"volt\":2.814}",
};

const char* expected_uuid[] = {
Expand Down Expand Up @@ -1262,6 +1263,7 @@ const char* test_uuid_name_svcdata[][4] = {
{"BTH01 PVVX", "0xfcd2", "BTH01-DDEEFF", "400015016402ee0903020f0c280c"},
{"BTH01 PVVX", "0xfcd2", "BTH01-DDEEFF", "40001c016402e60903f20e0c300c"},
{"BTH01 PVVX", "0xfcd2", "BTH01-DDEEFF", "400061016402f10a0364210c3a0c"},
{"TH05F PVVX", "0xfcd2", "TH05F-C451CC", "4000a3015102840a03321a0cfe0a"},
};

TheengsDecoder::BLE_ID_NUM test_uuid_name_svcdata_id_num[]{
Expand Down Expand Up @@ -1365,9 +1367,10 @@ TheengsDecoder::BLE_ID_NUM test_uuid_name_svcdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::BPARASITEV2,
TheengsDecoder::BLE_ID_NUM::BPARASITEV2,
TheengsDecoder::BLE_ID_NUM::BPARASITEV2,
TheengsDecoder::BLE_ID_NUM::BTH01,
TheengsDecoder::BLE_ID_NUM::BTH01,
TheengsDecoder::BLE_ID_NUM::BTH01,
TheengsDecoder::BLE_ID_NUM::THB1,
TheengsDecoder::BLE_ID_NUM::THB1,
TheengsDecoder::BLE_ID_NUM::THB1,
TheengsDecoder::BLE_ID_NUM::THB1,
};

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