diff --git a/docs/devices/VICTRON_SCC.md b/docs/devices/VICTRON_SCC.md new file mode 100644 index 00000000..4e4ebafc --- /dev/null +++ b/docs/devices/VICTRON_SCC.md @@ -0,0 +1,13 @@ +# Victron Energy SmartSolar MPPT + +|Model Id|[VICTSCC](https://github.com/theengs/decoder/blob/development/src/devices/VICTRON_SCC_json.h)| +|-|-| +|Brand|Victron Energy| +|Model|SmartSolar MPPT| +|Short Description|Various Solar Charge Controller models| +|Communication|BLE broadcast| +|Frequency|2.4Ghz| +|Power Source|From connected battery| +|Exchanged Data|device state, voltage battery, current battery, yield today, pv power, current load, error code| +|Encrypted|Yes| +|Device Tracker|✅| diff --git a/src/decoder.h b/src/decoder.h index 3b895551..c454bca7 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -180,6 +180,7 @@ class TheengsDecoder { VICTORIONXS, VICTSBP, VICTSBS, + VICTSCC, SE_RHT, SE_TEMP, SE_TPROBE, diff --git a/src/devices.h b/src/devices.h index 869b6c7f..bae0491b 100644 --- a/src/devices.h +++ b/src/devices.h @@ -126,6 +126,7 @@ #include "devices/VICTRON_ORIONXS_json.h" #include "devices/VICTRON_SBP_json.h" #include "devices/VICTRON_SBS_json.h" +#include "devices/VICTRON_SCC_json.h" #include "devices/SE_RHT_json.h" #include "devices/SE_TEMP_json.h" #include "devices/SE_TPROBE_json.h" @@ -277,6 +278,7 @@ const char* _devices[][2] = { {_VICTORIONXS_json, _VICTORIONXS_json_props}, {_VICTSBP_json, _VICTSBP_json_props}, {_VICTSBS_json, _VICTSBS_json_props}, + {_VICTSCC_json, _VICTSCC_json_props}, {_SE_RHT_json, _SE_RHT_json_props}, {_SE_TEMP_json, _SE_TEMP_json_props}, {_SE_TPROBE_json, _SE_TPROBE_json_props}, diff --git a/src/devices/VICTRON_SCC_json.h b/src/devices/VICTRON_SCC_json.h new file mode 100644 index 00000000..72e4ed9e --- /dev/null +++ b/src/devices/VICTRON_SCC_json.h @@ -0,0 +1,97 @@ +const char* _VICTSCC_json = "{\"brand\":\"Victron Energy\",\"model\":\"Solar Charge Controller\",\"model_id\":\"VICTSCC\",\"tag\":\"1408\",\"condition\":[\"manufacturerdata\",\"=\",44,\"index\",0,\"e10211\",\"&\",\"manufacturerdata\",\"index\",12,\"01ffff\"],\"properties\":{\"device_state\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,2]},\"_device_state\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,2],\"lookup\":[\"00\",\"off\",\"01\",\"low power\",\"02\",\"fault\",\"03\",\"bulk\",\"04\",\"absorption\",\"05\",\"float\",\"06\",\"storage\",\"07\",\"equalize manual\",\"09\",\"inverting\",\"0b\",\"power supply\",\"f5\",\"starting up\",\"f6\",\"repeated absorption\",\"f7\",\"recondition\",\"f8\",\"battery safe\",\"f9\",\"active\",\"fc\",\"external control\",\"ff\",\"N/A\"]},\"volt_batt\":{\"condition\":[\"manufacturerdata\",24,\"!\",\"7fff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true,true],\"post_proc\":[\"&\",32767,\"/\",100]},\"current_batt\":{\"condition\":[\"manufacturerdata\",28,\"!\",\"7fff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4,true,true],\"post_proc\":[\"&\",32767,\"/\",10]},\"yield_today\":{\"condition\":[\"manufacturerdata\",32,\"!\",\"ffff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",32,4,true,false],\"post_proc\":[\"/\",100]},\"pv_power\":{\"condition\":[\"manufacturerdata\",36,\"!\",\"ffff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",36,4,true,false]},\"current_load\":{\"condition\":[\"manufacturerdata\",40,\"!\",\"01ff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",40,4,true,false],\"post_proc\":[\"&\",511,\"/\",10]},\"error_code\":{\"condition\":[\"manufacturerdata\",22,\"!\",\"ff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",22,2]}}}"; +/*R""""( +{ + "brand":"Victron Energy", + "model":"Solar Charge Controller", + "model_id":"VICTSCC", + "tag":"1408", + "condition":["manufacturerdata", "=", 44, "index", 0, "e10211", "&", "manufacturerdata", "index", 12, "01ffff"], + "properties":{ + "device_state":{ + "decoder":["value_from_hex_data", "manufacturerdata", 20, 2] + }, + "_device_state":{ + "decoder":["string_from_hex_data", "manufacturerdata", 20, 2], + "lookup":["00", "off", + "01", "low power", + "02", "fault", + "03", "bulk", + "04", "absorption", + "05", "float", + "06", "storage", + "07", "equalize manual", + "09", "inverting", + "0b", "power supply", + "f5", "starting up", + "f6", "repeated absorption", + "f7", "recondition", + "f8", "battery safe", + "f9", "active", + "fc", "external control", + "ff", "N/A"] + }, + "volt_batt":{ + "condition":["manufacturerdata", 24, "!", "7fff"], + "decoder":["value_from_hex_data", "manufacturerdata", 24, 4, true, true], + "post_proc":["&", 32767, "/", 100] + }, + "current_batt":{ + "condition":["manufacturerdata", 28, "!", "7fff"], + "decoder":["value_from_hex_data", "manufacturerdata", 28, 4, true, true], + "post_proc":["&", 32767, "/", 10] + }, + "yield_today":{ + "condition":["manufacturerdata", 32, "!", "ffff"], + "decoder":["value_from_hex_data", "manufacturerdata", 32, 4, true, false], + "post_proc":["/", 100] + }, + "pv_power":{ + "condition":["manufacturerdata", 36, "!", "ffff"], + "decoder":["value_from_hex_data", "manufacturerdata", 36, 4, true, false] + }, + "current_load":{ + "condition":["manufacturerdata", 40, "!", "01ff"], + "decoder":["value_from_hex_data", "manufacturerdata", 40, 4, true, false], + "post_proc":["&", 511,"/", 10] + }, + "error_code":{ + "condition":["manufacturerdata", 22, "!", "ff"], + "decoder":["value_from_hex_data", "manufacturerdata", 22, 2] + } + } +})"""";*/ + +const char* _VICTSCC_json_props = "{\"properties\":{\"device_state\":{\"unit\":\"string\",\"name\":\"device state\"},\"volt_batt\":{\"unit\":\"V\",\"name\":\"voltage\"},\"current_batt\":{\"unit\":\"A\",\"name\":\"current\"},\"yield_today\":{\"unit\":\"kWh\",\"name\":\"energy\"},\"pv_power\":{\"unit\":\"W\",\"name\":\"power\"},\"current_load\":{\"unit\":\"A\",\"name\":\"current\"},\"error_code\":{\"unit\":\"int\",\"name\":\"error code\"}}}"; +/*R""""( +{ + "properties":{ + "device_state":{ + "unit":"string", + "name":"device state" + }, + "volt_batt": { + "unit": "V", + "name": "voltage" + }, + "current_batt": { + "unit": "A", + "name": "current" + }, + "yield_today": { + "unit": "kWh", + "name": "energy" + }, + "pv_power": { + "unit": "W", + "name": "power" + }, + "current_load": { + "unit": "A", + "name": "current" + }, + "error_code":{ + "unit":"int", + "name":"error code" + } + } +})"""";*/ diff --git a/src/devices/VICTRON__ENCR_json.h b/src/devices/VICTRON__ENCR_json.h index 3035e93e..6995ffeb 100644 --- a/src/devices/VICTRON__ENCR_json.h +++ b/src/devices/VICTRON__ENCR_json.h @@ -1,21 +1,25 @@ -const char* _VICTRON_ENCR_json = "{\"brand\":\"Victron Energy\",\"model\":\"Victron encrypted\",\"model_id\":\"VICTRON_ENCR\",\"tag\":\"140003\",\"condition\":[\"manufacturerdata\",\">=\",46,\"index\",0,\"e10210\"],\"properties\":{\"cipher\":{\"condition\":[\"manufacturerdata\",\"=\",46],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,26]},\"_cipher\":{\"condition\":[\"manufacturerdata\",\"=\",48],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,28]},\"__cipher\":{\"condition\":[\"manufacturerdata\",\"=\",50],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,30]},\"ctr\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",14,4,true]},\"mic\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",18,2]}}}"; +const char* _VICTRON_ENCR_json = "{\"brand\":\"Victron Energy\",\"model\":\"Victron encrypted\",\"model_id\":\"VICTRON_ENCR\",\"tag\":\"140003\",\"condition\":[\"manufacturerdata\",\">=\",44,\"index\",0,\"e10210\"],\"properties\":{\"cipher\":{\"condition\":[\"manufacturerdata\",\"=\",44],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,24]},\"_cipher\":{\"condition\":[\"manufacturerdata\",\"=\",46],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,26]},\"__cipher\":{\"condition\":[\"manufacturerdata\",\"=\",48],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,28]},\"___cipher\":{\"condition\":[\"manufacturerdata\",\"=\",50],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",20,30]},\"ctr\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",14,4,true]},\"mic\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",18,2]}}}"; /*R""""( { "brand":"Victron Energy", "model":"Victron encrypted", "model_id":"VICTRON_ENCR", "tag":"140003", - "condition":["manufacturerdata", ">=", 46, "index", 0, "e10210"], + "condition":["manufacturerdata", ">=", 44, "index", 0, "e10210"], "properties":{ "cipher":{ + "condition":["manufacturerdata", "=", 44], + "decoder":["string_from_hex_data", "manufacturerdata", 20, 24] + }, + "_cipher":{ "condition":["manufacturerdata", "=", 46], "decoder":["string_from_hex_data", "manufacturerdata", 20, 26] }, - "_cipher":{ + "__cipher":{ "condition":["manufacturerdata", "=", 48], "decoder":["string_from_hex_data", "manufacturerdata", 20, 28] }, - "__cipher":{ + "___cipher":{ "condition":["manufacturerdata", "=", 50], "decoder":["string_from_hex_data", "manufacturerdata", 20, 30] }, diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index 5b80428b..0ae67353 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -240,6 +240,10 @@ const char* expected_mfg[] = { "{\"brand\":\"Govee\",\"model\":\"Smart CO2 Monitor\",\"model_id\":\"H5140\",\"type\":\"AIR\",\"cidc\":false,\"acts\":true,\"tempc\":26.1311,\"tempf\":79.03598,\"hum\":31.1,\"co2\":1100}", "{\"brand\":\"Govee\",\"model\":\"Smart CO2 Monitor\",\"model_id\":\"H5140\",\"type\":\"AIR\",\"cidc\":false,\"acts\":true,\"tempc\":15.56,\"tempf\":60.008,\"hum\":60,\"co2\":500}", "{\"brand\":\"Govee\",\"model\":\"Smart CO2 Monitor\",\"model_id\":\"H5140\",\"type\":\"AIR\",\"cidc\":false,\"acts\":true,\"tempc\":23.8048,\"tempf\":74.84864,\"hum\":4.8,\"co2\":1700}", + "{\"brand\":\"Victron Energy\",\"model\":\"Victron encrypted\",\"model_id\":\"VICTRON_ENCR\",\"type\":\"ENRG\",\"encr\":3,\"cipher\":\"a8874c8374ab762a302ee3fc\",\"ctr\":\"0535\",\"mic\":\"13\"}", + "{\"brand\":\"Victron Energy\",\"model\":\"Victron encrypted\",\"model_id\":\"VICTRON_ENCR\",\"type\":\"ENRG\",\"encr\":3,\"cipher\":\"9b17c12f82e66b50ccc629e5\",\"ctr\":\"66a7\",\"mic\":\"13\"}", + "{\"brand\":\"Victron Energy\",\"model\":\"Solar Charge Controller\",\"model_id\":\"VICTSCC\",\"type\":\"ENRG\",\"track\":true,\"device_state\":\"off\",\"volt_batt\":13.28,\"current_batt\":0,\"yield_today\":0.01,\"pv_power\":0,\"current_load\":0,\"error_code\":0}", + "{\"brand\":\"Victron Energy\",\"model\":\"Solar Charge Controller\",\"model_id\":\"VICTSCC\",\"type\":\"ENRG\",\"track\":true,\"device_state\":\"absorption\",\"volt_batt\":14.18,\"current_batt\":0,\"yield_today\":0.01,\"pv_power\":1,\"current_load\":0.1,\"error_code\":0}", }; const char* expected_name_uuid_mfgsvcdata[] = { @@ -834,6 +838,10 @@ const char* test_mfgdata[][3] = { {"H5140", "GV5140_1234", "0100010103fcbf044c00"}, {"H5140", "GV5140_1234", "01000101025fd001f400"}, {"H5140", "GV5140_1234", "0100010103a1e006a400"}, + {"Victron MPPT 75/15 ENCR", "", "e102108275a001053513a8874c8374ab762a302ee3fc"}, + {"Victron MPPT 75/15 ENCR", "", "e102108275a00166a7139b17c12f82e66b50ccc629e5"}, + {"Victron MPPT 75/15", "", "e102118275a001ffff130000300500000100000000fe"}, + {"Victron MPPT 75/15", "", "e102118275a001ffff1304008a0500000100010001fe"}, }; TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ @@ -1057,6 +1065,10 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::H5140, TheengsDecoder::BLE_ID_NUM::H5140, TheengsDecoder::BLE_ID_NUM::H5140, + TheengsDecoder::BLE_ID_NUM::VICTRON_ENCR, + TheengsDecoder::BLE_ID_NUM::VICTRON_ENCR, + TheengsDecoder::BLE_ID_NUM::VICTSCC, + TheengsDecoder::BLE_ID_NUM::VICTSCC, }; // uuid test input [test name] [device name] [uuid] [manufacturer data] [service data]