From 8d1d6fc96ab01fe2b82fad1c078fd863e11aa107 Mon Sep 17 00:00:00 2001 From: DigiH <17110652+DigiH@users.noreply.github.com> Date: Sun, 5 Jul 2026 22:14:30 +0200 Subject: [PATCH] SwitchBot Meter Pro without CO2 added --- docs/devices/SBMP.md | 4 ++-- src/devices/SBMP_json.h | 13 +++++++------ tests/BLE/test_ble.cpp | 9 ++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/devices/SBMP.md b/docs/devices/SBMP.md index 2fd86814..a83e8fe2 100644 --- a/docs/devices/SBMP.md +++ b/docs/devices/SBMP.md @@ -4,9 +4,9 @@ |-|-| |Brand|SwitchBot| |Model|Meter Pro (CO2)| -|Short Description|Thermo-Hygrometer and CO2 Monitor| +|Short Description|Thermo-Hygrometer with optional CO2 Monitor| |Communication|BLE broadcast| |Frequency|2.4Ghz| |Power Source|2 AA| -|Exchanged Data|temperature, humidity, carbon dioxide, battery| +|Exchanged Data|temperature, humidity, battery, carbon dioxide (CO2 version only)| |Encrypted|No| diff --git a/src/devices/SBMP_json.h b/src/devices/SBMP_json.h index 778a5e8f..5a102ef5 100644 --- a/src/devices/SBMP_json.h +++ b/src/devices/SBMP_json.h @@ -1,13 +1,13 @@ #include "common_props.h" -const char* _SBMP_json = "{\"brand\":\"SwitchBot\",\"model\":\"Meter Pro (CO2)\",\"model_id\":\"W490001X\",\"tag\":\"0f02\",\"condition\":[\"uuid\",\"index\",0,\"fd3d\",\"&\",\"servicedata\",\"=\",6,\"index\",0,\"35\",\"&\",\"manufacturerdata\",\"=\",36,\"index\",0,\"6909\"],\"properties\":{\".cal\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",21,1,false,false],\"post_proc\":[\"/\",10]},\"tempc\":{\"condition\":[\"manufacturerdata\",22,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",22,2,true,false],\"post_proc\":[\"+\",\".cal\",\"*\",-1]},\"_tempc\":{\"condition\":[\"manufacturerdata\",22,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",22,2,true,false],\"post_proc\":[\"+\",\".cal\",\"-\",128]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,2,false,false],\"post_proc\":[\"&\",127]},\"co2\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",30,4,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* _SBMP_json = "{\"brand\":\"SwitchBot\",\"model\":\"Meter Pro (CO2)\",\"model_id\":\"W490001X\",\"tag\":\"0202\",\"condition\":[\"servicedata\",\"=\",6,\"index\",0,\"35\",\"|\",\"servicedata\",\"=\",6,\"index\",0,\"34\",\"&\",\"uuid\",\"index\",0,\"fd3d\",\"&\",\"manufacturerdata\",\">=\",30,\"index\",0,\"6909\"],\"properties\":{\".cal\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",21,1,false,false],\"post_proc\":[\"/\",10]},\"tempc\":{\"condition\":[\"manufacturerdata\",22,\"bit\",3,0],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",22,2,true,false],\"post_proc\":[\"+\",\".cal\",\"*\",-1]},\"_tempc\":{\"condition\":[\"manufacturerdata\",22,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",22,2,true,false],\"post_proc\":[\"+\",\".cal\",\"-\",128]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,2,false,false],\"post_proc\":[\"&\",127]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false],\"post_proc\":[\"&\",127]},\"mac\":{\"decoder\":[\"mac_from_hex_data\",\"manufacturerdata\",4]},\"co2\":{\"condition\":[\"manufacturerdata\",\"=\",36],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",30,4,false,false]}}}"; /*R""""( { "brand":"SwitchBot", "model":"Meter Pro (CO2)", "model_id":"W490001X", - "tag":"0f02", - "condition":["uuid", "index", 0, "fd3d", "&", "servicedata", "=", 6, "index", 0, "35", "&", "manufacturerdata", "=", 36, "index", 0, "6909"], + "tag":"0202", + "condition":["servicedata", "=", 6, "index", 0, "35", "|", "servicedata", "=", 6, "index", 0, "34", "&", "uuid", "index", 0, "fd3d", "&", "manufacturerdata", ">=", 30, "index", 0, "6909"], "properties":{ ".cal":{ "decoder":["value_from_hex_data", "manufacturerdata", 21, 1, false, false], @@ -27,15 +27,16 @@ const char* _SBMP_json = "{\"brand\":\"SwitchBot\",\"model\":\"Meter Pro (CO2)\" "decoder":["value_from_hex_data", "manufacturerdata", 24, 2, false, false], "post_proc":["&", 127] }, - "co2":{ - "decoder":["value_from_hex_data", "manufacturerdata", 30, 4, false, false] - }, "batt":{ "decoder":["value_from_hex_data", "servicedata", 4, 2, false, false], "post_proc":["&", 127] }, "mac":{ "decoder":["mac_from_hex_data", "manufacturerdata", 4] + }, + "co2":{ + "condition":["manufacturerdata", "=", 36], + "decoder":["value_from_hex_data", "manufacturerdata", 30, 4, false, false] } } })"""";*/ diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 0ae67353..24755c3c 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -273,9 +273,10 @@ const char* expected_name_uuid_mfgsvcdata[] = { "{\"brand\":\"SwitchBot\",\"model\":\"Blind Tilt\",\"model_id\":\"W270160X\",\"type\":\"WCVR\",\"acts\":true,\"ctrl\":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,\"ctrl\":true,\"open\":50,\"direction\":\"up\",\"motion\":false,\"calibrated\":true,\"lightlevel\":2,\"batt\":100,\"mac\":\"AA:BB:CC:DD:EE:FF\"}", "{\"brand\":\"nut\",\"model\":\"Smart Tracker\",\"model_id\":\"NUT\",\"type\":\"TRACK\",\"cidc\":false,\"acts\":true,\"track\":true,\"device\":\"nut Tracker\"}", - "{\"brand\":\"SwitchBot\",\"model\":\"Meter Pro (CO2)\",\"model_id\":\"W490001X\",\"type\":\"AIR\",\"acts\":true,\"tempc\":22.8,\"tempf\":73.04,\"hum\":40,\"co2\":893,\"batt\":100,\"mac\":\"B0:E9:FE:DD:EE:FF\"}", "{\"brand\":\"nut\",\"model\":\"Smart Tracker\",\"model_id\":\"NUT\",\"type\":\"TRACK\",\"cidc\":false,\"acts\":true,\"track\":true,\"device\":\"nut Tracker\"}", "{\"brand\":\"HolyIoT\",\"model\":\"Beacon\",\"model_id\":\"HOLYIOT\",\"type\":\"TRACK\",\"cidc\":false,\"track\":true,\"batt\":100,\"device\":\"HolyIoT Beacon Tracker\"}", + "{\"brand\":\"SwitchBot\",\"model\":\"Meter Pro (CO2)\",\"model_id\":\"W490001X\",\"type\":\"THBX\",\"acts\":true,\"tempc\":22.8,\"tempf\":73.04,\"hum\":40,\"co2\":893,\"batt\":100,\"mac\":\"B0:E9:FE:DD:EE:FF\"}", + "{\"brand\":\"SwitchBot\",\"model\":\"Meter Pro (CO2)\",\"model_id\":\"W490001X\",\"type\":\"THBX\",\"acts\":true,\"tempc\":21.8,\"tempf\":71.24,\"hum\":61,\"batt\":100,\"mac\":\"B0:E9:FE:9A:01:66\"}", }; const char* expected_name_mac_uuid_mfgsvcdata[] = { @@ -1099,9 +1100,10 @@ const char* test_name_uuid_mfgsvcdata[][5] = { {"Switchbot_BlindTilt NEW", "WoBlindTilt", "0xfd3d", "6909aabbccddeeff2427412184", "780064"}, {"Switchbot_BlindTilt NEW", "WoBlindTilt", "0xfd3d", "6909aabbccddeeff39274b4184", "780064"}, {"Nut","nut","0x180a","12345678",""}, - {"SwitchBot Meter Pro (CO2)", "Outdoor Meter", "0xfd3d", "6909b0e9feddeeff0ce40896280004037d00", "350064"}, {"Nut","nut","0x180a","","aabbccddeeff"}, {"Holyiot", "Holy-IOT", "0x5242", "4c000215cde0598cbc284b89b3786039a1da9efc271b000ec9", "4164aabbccddeeff0405040000"}, + {"SwitchBot Meter Pro (CO2)", "Meter Pro CO2", "0xfd3d", "6909b0e9feddeeff0ce40896280004037d00", "350064"}, + {"SwitchBot Meter Pro (NO CO2)", "Meter Pro", "0xfd3d", "6909b0e9fe9a0166886408953d001a", "340064"}, }; TheengsDecoder::BLE_ID_NUM test_name_uuid_mfgsvcdata_id_num[]{ @@ -1131,9 +1133,10 @@ TheengsDecoder::BLE_ID_NUM test_name_uuid_mfgsvcdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::SBBT, TheengsDecoder::BLE_ID_NUM::SBBT, TheengsDecoder::BLE_ID_NUM::NUT, - TheengsDecoder::BLE_ID_NUM::SBMP, TheengsDecoder::BLE_ID_NUM::NUT, TheengsDecoder::BLE_ID_NUM::HOLYIOT, + TheengsDecoder::BLE_ID_NUM::SBMP, + TheengsDecoder::BLE_ID_NUM::SBMP, }; // uuid test input [test name] [mac] [device name] [uuid] [manufacturer data] [service data]