Skip to content

Commit

Permalink
SwitchBot Blind Tilt new firmware version adjustments (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Apr 18, 2024
1 parent 55bc186 commit 55e1a4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
days-before-issue-stale: 60
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 90 days with no activity."
stale-issue-message: "This issue is stale because it has been open for 60 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: 60
days-before-pr-close: 14
Expand Down
4 changes: 2 additions & 2 deletions src/devices/SBBT_json.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const char* _SBBT_json = "{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"tag\":\"0d02\",\"condition\":[\"uuid\",\"index\",0,\"0d00\",\"|\",\"uuid\",\"index\",0,\"fd3d\",\"&\",\"servicedata\",\"=\",6,\"index\",0,\"78\",\"&\",\"manufacturerdata\",\"=\",24,\"index\",0,\"6909\"],\"properties\":{\"open\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,2,false,false],\"post_proc\":[\"&\",127,\"-\",50,\"*\",2,\"±\",100,\"abs\"]},\"direction\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,2,false,false],\"post_proc\":[\"&\",127,\"-\",50,\"*\",2,\"SBBT-dir\"]},\"motion\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",20,3,false,true]},\"calibrated\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",19,0,false,true]},\"lightlevel\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",18,1,false,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false],\"post_proc\":[\"&\",127]},\"mac\":{\"decoder\":[\"mac_from_hex_data\",\"manufacturerdata\",4]}}}";
const char* _SBBT_json = "{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"tag\":\"0d02\",\"condition\":[\"uuid\",\"index\",0,\"0d00\",\"|\",\"uuid\",\"index\",0,\"fd3d\",\"&\",\"servicedata\",\"=\",6,\"index\",0,\"78\",\"&\",\"manufacturerdata\",\">=\",24,\"index\",0,\"6909\"],\"properties\":{\"open\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,2,false,false],\"post_proc\":[\"&\",127,\"-\",50,\"*\",2,\"±\",100,\"abs\"]},\"direction\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,2,false,false],\"post_proc\":[\"&\",127,\"-\",50,\"*\",2,\"SBBT-dir\"]},\"motion\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",20,3,false,true]},\"calibrated\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",19,0,false,true]},\"lightlevel\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",18,1,false,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false],\"post_proc\":[\"&\",127]},\"mac\":{\"decoder\":[\"mac_from_hex_data\",\"manufacturerdata\",4]}}}";
/*R""""(
{
"brand":"SwitchBot",
"model":"Blind Tilt",
"model_id":"W270160X",
"tag":"0d02",
"condition":["uuid", "index", 0, "0d00", "|", "uuid", "index", 0, "fd3d", "&", "servicedata", "=", 6, "index", 0, "78", "&", "manufacturerdata", "=", 24, "index", 0, "6909"],
"condition":["uuid", "index", 0, "0d00", "|", "uuid", "index", 0, "fd3d", "&", "servicedata", "=", 6, "index", 0, "78", "&", "manufacturerdata", ">=", 24, "index", 0, "6909"],
"properties":{
"open":{
"decoder":["value_from_hex_data", "manufacturerdata", 20, 2, false, false],
Expand Down
9 changes: 9 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ const char* expected_name_uuid_mfgsvcdata[] = {
"{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"type\":\"WCVR\",\"acts\":true,\"open\":54,\"direction\":\"up\",\"motion\":false,\"calibrated\":true,\"lightlevel\":2,\"batt\":54,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"type\":\"WCVR\",\"acts\":true,\"open\":80,\"direction\":\"down\",\"motion\":false,\"calibrated\":true,\"lightlevel\":2,\"batt\":96,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"type\":\"WCVR\",\"acts\":true,\"open\":80,\"direction\":\"up\",\"motion\":false,\"calibrated\":true,\"lightlevel\":2,\"batt\":96,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"type\":\"WCVR\",\"acts\":true,\"open\":40,\"direction\":\"up\",\"motion\":false,\"calibrated\":true,\"lightlevel\":2,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"type\":\"WCVR\",\"acts\":true,\"open\":70,\"direction\":\"up\",\"motion\":false,\"calibrated\":true,\"lightlevel\":2,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"type\":\"WCVR\",\"acts\":true,\"open\":50,\"direction\":\"up\",\"motion\":false,\"calibrated\":true,\"lightlevel\":2,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
};

const char* expected_name_mac_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -734,6 +737,9 @@ const char* test_name_uuid_mfgsvcdata[][5] = {
{"Switchbot_BlindTilt", "WoBlindTilt", "0xfd3d", "6909aabbccddeeffd3274914", "780036"},
{"Switchbot_BlindTilt", "WoBlindTilt", "0xfd3d", "6909aabbccddeeffd3272814", "780060"},
{"Switchbot_BlindTilt", "WoBlindTilt", "0xfd3d", "6909aabbccddeeffd3273c14", "780060"},
{"Switchbot_BlindTilt NEW", "WoBlindTilt", "0xfd3d", "6909aabbccddeeff4427504184", "780064"},
{"Switchbot_BlindTilt NEW", "WoBlindTilt", "0xfd3d", "6909aabbccddeeff2427412184", "780064"},
{"Switchbot_BlindTilt NEW", "WoBlindTilt", "0xfd3d", "6909aabbccddeeff39274b4184", "780064"},
};

TheengsDecoder::BLE_ID_NUM test_name_uuid_mfgsvcdata_id_num[]{
Expand All @@ -759,6 +765,9 @@ TheengsDecoder::BLE_ID_NUM test_name_uuid_mfgsvcdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::SBBT,
TheengsDecoder::BLE_ID_NUM::SBBT,
TheengsDecoder::BLE_ID_NUM::SBBT,
TheengsDecoder::BLE_ID_NUM::SBBT,
TheengsDecoder::BLE_ID_NUM::SBBT,
TheengsDecoder::BLE_ID_NUM::SBBT,
};

// uuid test input [test name] [mac] [device name] [uuid] [manufacturer data] [service data]
Expand Down

0 comments on commit 55e1a4f

Please sign in to comment.