Skip to content

Commit

Permalink
Nutale BLE tracker (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Nov 27, 2023
1 parent 9d96daf commit 0c9dc6f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class TheengsDecoder {
T201,
T301,
NUT,
NUTALE,
ITAG,
TAGIT,
TILE,
Expand Down
1 change: 1 addition & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ const char* _devices[][2] = {
{_T201_json, _T201_json_props},
{_T301_json, _T301_json_props},
{_tracker_json_nut, _tracker_json_props},
{_tracker_json_nutale, _tracker_json_props},
{_tracker_json_itag, _tracker_json_props},
{_tracker_json_tagit, _tracker_json_props},
{_tracker_json_tile, _tracker_json_props},
Expand Down
15 changes: 15 additions & 0 deletions src/devices/tracker_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ const char* _tracker_json_nut = "{\"brand\":\"nut\",\"model\":\"Smart Tracker\",
}
})"""";*/

const char* _tracker_json_nutale = "{\"brand\":\"nut\",\"model\":\"Smart Tracker\",\"model_id\":\"NUTALE\",\"tag\":\"100f\",\"condition\":[\"name\",\"index\",0,\"nutale\",\"&\",\"servicedata\",\"=\",24,\"&\",\"uuid\",\"index\",0,\"0900\"],\"properties\":{\"device\":{\"decoder\":[\"static_value\",\"nutale Tracker\"]}}}";
/*R""""(
{
"brand":"nut",
"model":"Smart Tracker",
"model_id":"NUTALE",
"tag":"100f",
"condition":["name", "index", 0, "nutale", "&", "servicedata", "=", 24, "&", "uuid", "index", 0, "0900"],
"properties":{
"device":{
"decoder":["static_value", "nutale Tracker"]
}
}
})"""";*/

const char* _tracker_json_itag = "{\"brand\":\"iTAG\",\"model\":\"Smart Tracker\",\"model_id\":\"ITAG\",\"tag\":\"100f\",\"condition\":[\"name\",\"index\",0,\"iTAG\",\"&\",\"manufacturerdata\",\"=\",8],\"properties\":{\"device\":{\"decoder\":[\"static_value\",\"iTAG Tracker\"]}}}";
/*R""""(
{
Expand Down
4 changes: 3 additions & 1 deletion tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const char* expected_uuid_name_svcdata[] = {
"{\"brand\":\"Xiaomi\",\"model\":\"TH Sensor\",\"model_id\":\"LYWSD03MMC/MJWSD05MMC_PVVX_ENCR\",\"type\":\"THB\",\"encr\":1,\"cipher\":\"ef56583dd420\",\"ctr\":\"23\",\"mic\":\"50fe8e4d\"}",
"{\"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\"}",
};

const char* expected_uuid[] = {
Expand Down Expand Up @@ -688,6 +689,7 @@ const char* test_uuid_name_svcdata[][4] = {
{"LYWSD03MMC_PVVX_ENCR", "0x181a", "ATC_9C58AB", "23ef56583dd42050fe8e4d"},
{"LYWSD03MMC_PVVX_DECR", "0x181a", "ATC_89DF88", "9c0902116404"},
{"ABN07", "0xfcd2", "asensor_7F7F", "4000100164029309038612"},
{"Nutale", "0x0900", "nutale", "aabbccddeeff160100010100"},
};

TheengsDecoder::BLE_ID_NUM test_uuid_name_svcdata_id_num[]{
Expand Down Expand Up @@ -720,6 +722,7 @@ TheengsDecoder::BLE_ID_NUM test_uuid_name_svcdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::LYWSD03MMC_PVVX_ENCR,
TheengsDecoder::BLE_ID_NUM::LYWSD03MMC_PVVX_DECR,
TheengsDecoder::BLE_ID_NUM::ABN07,
TheengsDecoder::BLE_ID_NUM::NUTALE,
};

// uuid test input [test name] [uuid] [data source] [data]
Expand Down Expand Up @@ -839,7 +842,6 @@ const char* test_uuid[][4] = {
{"KKM K9", "0xfeaa", "servicedata", "21010f0e07ff8e224ffffcffec03eb"},
{"KKM K9", "0xfeaa", "servicedata", "21010f0e58f4362bd8000ffff103f7"},
{"KKM K9", "0xfeaa", "servicedata", "21010f0e5bf51b4addffc200000416"},

};

TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{
Expand Down

0 comments on commit 0c9dc6f

Please sign in to comment.