diff --git a/docs/devices/SBMT.md b/docs/devices/SBMT.md index a65f68f0..748562da 100644 --- a/docs/devices/SBMT.md +++ b/docs/devices/SBMT.md @@ -1,6 +1,6 @@ # SwitchBot Meter (Plus) -|Model Id|[TH *1 (W230150*)](https://github.com/theengs/decoder/blob/development/src/devices/SBMT_json.h)| +|Model Id|[THX1(W230150X)](https://github.com/theengs/decoder/blob/development/src/devices/SBMT_json.h)| |-|-| |Brand|SwitchBot| |Model|Meter (Plus)| diff --git a/docs/devices/SBS1.md b/docs/devices/SBS1.md index 34146afd..c12cbc3b 100644 --- a/docs/devices/SBS1.md +++ b/docs/devices/SBS1.md @@ -1,6 +1,6 @@ # SwitchBot Bot -|Model Id|[*1](https://github.com/theengs/decoder/blob/development/src/devices/SBS1_json.h)| +|Model Id|[X1](https://github.com/theengs/decoder/blob/development/src/devices/SBS1_json.h)| |-|-| |Brand|SwitchBot| |Model|Bot| diff --git a/src/devices/SBMT_json.h b/src/devices/SBMT_json.h index f6bec978..4ada1ec9 100644 --- a/src/devices/SBMT_json.h +++ b/src/devices/SBMT_json.h @@ -1,11 +1,11 @@ #include "common_props.h" -const char* _SBMT_json = "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"SWITCHBOT-METER\",\"condition\":[\"servicedata\",\"=\",12,\"index\",0,\"54\",\"|\",\"servicedata\",\"=\",12,\"index\",0,\"69\",\"&\",\"uuid\",\"index\",0,\"fd3d\"],\"properties\":{\".cal\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",6,2,false,false],\"post_proc\":[\"/\",10]},\"tempc\":{\"condition\":[\"servicedata\",8,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,true,false],\"post_proc\":[\"+\",\".cal\",\"*\",-1]},\"_tempc\":{\"condition\":[\"servicedata\",8,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,true,false],\"post_proc\":[\"+\",\".cal\",\"-\",128]},\"hum\":{\"condition\":[\"servicedata\",10,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",10,2,false,false]},\"_hum\":{\"condition\":[\"servicedata\",10,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",10,2,false,false],\"post_proc\":[\"-\",128]},\"batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false]},\"_batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false],\"post_proc\":[\"-\",128]}}}"; +const char* _SBMT_json = "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"condition\":[\"servicedata\",\"=\",12,\"index\",0,\"54\",\"|\",\"servicedata\",\"=\",12,\"index\",0,\"69\",\"&\",\"uuid\",\"index\",0,\"fd3d\"],\"properties\":{\".cal\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",6,2,false,false],\"post_proc\":[\"/\",10]},\"tempc\":{\"condition\":[\"servicedata\",8,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,true,false],\"post_proc\":[\"+\",\".cal\",\"*\",-1]},\"_tempc\":{\"condition\":[\"servicedata\",8,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,true,false],\"post_proc\":[\"+\",\".cal\",\"-\",128]},\"hum\":{\"condition\":[\"servicedata\",10,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",10,2,false,false]},\"_hum\":{\"condition\":[\"servicedata\",10,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",10,2,false,false],\"post_proc\":[\"-\",128]},\"batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false]},\"_batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false],\"post_proc\":[\"-\",128]}}}"; /*R""""( { "brand":"SwitchBot", "model":"Meter (Plus)", - "model_id":"SWITCHBOT-METER", + "model_id":"THX1/W230150X", "condition":["servicedata", "=", 12, "index", 0, "54", "|", "servicedata", "=", 12, "index", 0, "69", "&", "uuid", "index", 0, "fd3d"], "properties":{ ".cal":{ diff --git a/src/devices/SBS1_json.h b/src/devices/SBS1_json.h index 449603b5..b6548d1b 100644 --- a/src/devices/SBS1_json.h +++ b/src/devices/SBS1_json.h @@ -1,9 +1,9 @@ -const char* _SBS1_json = "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"SWITCHBOT-BOT\",\"condition\":[\"uuid\",\"index\",0,\"0d00\",\"&\",\"servicedata\",\"=\",6,\"index\",0,\"48\"],\"properties\":{\"mode\":{\"condition\":[\"servicedata\",2,\"bit\",3,1],\"decoder\":[\"static_value\",\"on/off\"]},\"_mode\":{\"condition\":[\"servicedata\",2,\"bit\",3,0],\"decoder\":[\"static_value\",\"onestate\"]},\"state\":{\"condition\":[\"servicedata\",2,\"bit\",2,0],\"decoder\":[\"static_value\",\"on\"]},\"_state\":{\"condition\":[\"servicedata\",2,\"bit\",2,1],\"decoder\":[\"static_value\",\"off\"]},\"batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false]},\"_batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false],\"post_proc\":[\"-\",128]}}}"; +const char* _SBS1_json = "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"X1\",\"condition\":[\"uuid\",\"index\",0,\"0d00\",\"&\",\"servicedata\",\"=\",6,\"index\",0,\"48\"],\"properties\":{\"mode\":{\"condition\":[\"servicedata\",2,\"bit\",3,1],\"decoder\":[\"static_value\",\"on/off\"]},\"_mode\":{\"condition\":[\"servicedata\",2,\"bit\",3,0],\"decoder\":[\"static_value\",\"onestate\"]},\"state\":{\"condition\":[\"servicedata\",2,\"bit\",2,0],\"decoder\":[\"static_value\",\"on\"]},\"_state\":{\"condition\":[\"servicedata\",2,\"bit\",2,1],\"decoder\":[\"static_value\",\"off\"]},\"batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false]},\"_batt\":{\"condition\":[\"servicedata\",4,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false],\"post_proc\":[\"-\",128]}}}"; /*R""""( { "brand":"SwitchBot", "model":"Bot", - "model_id":"SWITCHBOT-BOT", + "model_id":"X1", "condition":["uuid", "index",0, "0d00","&", "servicedata", "=", 6, "index", 0, "48"], "properties":{ "mode":{ diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 578694b4..8683d8bf 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -115,12 +115,12 @@ const char* expected_uuid[] = { "{\"brand\":\"Mokosmart\",\"model\":\"Beacon\",\"model_id\":\"Mokobeacon\",\"batt\":100,\"x_axis\":-24576,\"y_axis\":-3841,\"z_axis\":-8189}", "{\"brand\":\"Mokosmart\",\"model\":\"BeaconX Pro\",\"model_id\":\"MBXPRO\",\"tempc\":27.4,\"tempf\":81.32,\"hum\":49.4,\"volt\":3.247}", "{\"brand\":\"GENERIC\",\"model\":\"GAEN\",\"model_id\":\"GAEN\",\"rpi\":\"e7c6d34c71e48baf278bd99be74685bc\",\"aem\":\"a78126ab\"}", - "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"SWITCHBOT-BOT\",\"mode\":\"on/off\",\"state\":\"off\",\"batt\":91}", - "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"SWITCHBOT-BOT\",\"mode\":\"on/off\",\"state\":\"on\",\"batt\":76}", - "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"SWITCHBOT-BOT\",\"mode\":\"onestate\",\"state\":\"on\",\"batt\":91}", - "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"SWITCHBOT-METER\",\"tempc\":25.8,\"tempf\":78.44,\"hum\":59,\"batt\":58}", - "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"SWITCHBOT-METER\",\"tempc\":-25.3,\"tempf\":-13.54,\"hum\":56,\"batt\":58}", - "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"SWITCHBOT-METER\",\"tempc\":26,\"tempf\":78.8,\"hum\":56,\"batt\":58}", + "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"X1\",\"mode\":\"on/off\",\"state\":\"off\",\"batt\":91}", + "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"X1\",\"mode\":\"on/off\",\"state\":\"on\",\"batt\":76}", + "{\"brand\":\"SwitchBot\",\"model\":\"Bot\",\"model_id\":\"X1\",\"mode\":\"onestate\",\"state\":\"on\",\"batt\":91}", + "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":25.8,\"tempf\":78.44,\"hum\":59,\"batt\":58}", + "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":-25.3,\"tempf\":-13.54,\"hum\":56,\"batt\":58}", + "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":26,\"tempf\":78.8,\"hum\":56,\"batt\":58}", }; // Service data test input [test name] [data]