Skip to content

Commit

Permalink
SwitchBot Meter alters bits fix (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Jul 23, 2022
1 parent 41638ea commit 54155a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/devices/SBMT_json.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "common_props.h"

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,\"0d00\",\"|\",\"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,\"0d00\",\"|\",\"uuid\",\"index\",0,\"fd3d\"],\"properties\":{\".cal\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",7,1,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",
Expand All @@ -9,7 +9,7 @@ const char* _SBMT_json = "{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"
"condition":["servicedata", "=", 12, "index", 0, "54", "|", "servicedata", "=", 12, "index", 0, "69", "&", "uuid", "index", 0, "0d00", "|", "uuid", "index", 0, "fd3d"],
"properties":{
".cal":{
"decoder":["value_from_hex_data", "servicedata", 6, 2, false, false],
"decoder":["value_from_hex_data", "servicedata", 7, 1, false, false],
"post_proc":["/", 10]
},
"tempc":{
Expand Down
14 changes: 7 additions & 7 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ const char* expected_uuid[] = {
"{\"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}",
"{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":25,\"tempf\":77,\"hum\":56,\"batt\":84}",
"{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":25,\"tempf\":77,\"hum\":56,\"batt\":84}",
"{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":26.7,\"tempf\":80.06,\"hum\":56,\"batt\":58}",
"{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":25.5,\"tempf\":77.9,\"hum\":56,\"batt\":84}",
"{\"brand\":\"SwitchBot\",\"model\":\"Meter (Plus)\",\"model_id\":\"THX1/W230150X\",\"tempc\":25.2,\"tempf\":77.36,\"hum\":56,\"batt\":84}",
"{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"tempc\":25.6,\"tempf\":78.08,\"hum\":90.00076295,\"moi\":49.99923705,\"volt\":3.1}",
"{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"tempc\":22.7,\"tempf\":72.86,\"hum\":65.00038148,\"moi\":42.00045777,\"lux\":12500,\"volt\":2.95}",
"{\"brand\":\"rbaron\",\"model\":\"b-parasite\",\"model_id\":\"BPv1.0-1.2\",\"tempc\":25.6,\"tempf\":78.08,\"hum\":90.00076295,\"moi\":49.99923705,\"volt\":3.1}",
Expand Down Expand Up @@ -361,11 +361,11 @@ const char* test_uuid[][4] = {
{"Switchbot_S1", "0d00", "servicedata", "48d0db"},
{"Switchbot_S1", "0d00", "servicedata", "4890cc"},
{"Switchbot_S1", "0d00", "servicedata", "48005b"},
{"Switchbot_Meter_Plus", "fd3d", "servicedata", "6900ba08993b"},
{"Switchbot_Meter_Plus", "fd3d", "servicedata", "6900ba18993b"},
{"Switchbot_Meter_Plus", "fd3d", "servicedata", "6900ba031938"},
{"Switchbot_Meter_Plus", "fd3d", "servicedata", "6900ba009ab8"},
{"Switchbot_Meter", "0d00", "servicedata", "540054009938"},
{"Switchbot_Meter", "0d00", "servicedata", "5400d40099b8"},
{"Switchbot_Meter_Plus", "fd3d", "servicedata", "6900ba379ab8"},
{"Switchbot_Meter", "0d00", "servicedata", "540054459938"},
{"Switchbot_Meter", "0d00", "servicedata", "5400d40299b8"},
{"bParasite", "181a", "servicedata", "10c30c1c6400e6667fffaabbccddeeff"},
{"bParasite", "181a", "servicedata", "11c30b8658aca6666b85aabbccddeeff30d4"},
{"bParasite", "181a", "servicedata", "20c30c1c0a00e6667fffaabbccddeeff"},
Expand Down

0 comments on commit 54155a1

Please sign in to comment.