Skip to content

Commit 5ca3287

Browse files
authored
Victron encrypted decoder consolidation (#677)
Consolidated the Victron encrypted decoders into one single decoder
1 parent 45ea5aa commit 5ca3287

File tree

9 files changed

+65
-182
lines changed

9 files changed

+65
-182
lines changed

src/decoder.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,10 @@ class TheengsDecoder {
174174
SPHT,
175175
SERVICE_DATA,
176176
UT363BT,
177-
VICTBSC_ENCR,
177+
VICTRON_ENCR,
178178
VICTBSC,
179-
VICTORIONXS_ENCR,
180179
VICTORIONXS,
181-
VICTSBP_ENCR,
182180
VICTSBP,
183-
VICTSBSBMSS_ENCR,
184181
VICTSBS,
185182
SE_RHT,
186183
SE_TEMP,

src/devices.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,10 @@
120120
#include "devices/SensorP_HT_json.h"
121121
#include "devices/ServiceData_json.h"
122122
#include "devices/UT363BT_json.h"
123-
#include "devices/VICTRON_BSC_ENCR_json.h"
123+
#include "devices/VICTRON__ENCR_json.h"
124124
#include "devices/VICTRON_BSC_json.h"
125-
#include "devices/VICTRON_ORIONXS_ENCR_json.h"
126125
#include "devices/VICTRON_ORIONXS_json.h"
127-
#include "devices/VICTRON_SBP_ENCR_json.h"
128126
#include "devices/VICTRON_SBP_json.h"
129-
#include "devices/VICTRON_SBSBMSS_ENCR_json.h"
130127
#include "devices/VICTRON_SBS_json.h"
131128
#include "devices/SE_RHT_json.h"
132129
#include "devices/SE_TEMP_json.h"
@@ -273,13 +270,10 @@ const char* _devices[][2] = {
273270
{_SensorPush_HT_json, _SensorPush_HT_json_props},
274271
{_ServiceData_json, _ServiceData_json_props},
275272
{_UT363BT_json, _UT363BT_json_props},
276-
{_VICTBSC_ENCR_json, _VICTBSC_ENCR_json_props},
273+
{_VICTRON_ENCR_json, _VICTRON_ENCR_json_props},
277274
{_VICTBSC_json, _VICTBSC_json_props},
278-
{_VICTORIONXS_ENCR_json, _VICTORIONXS_ENCR_json_props},
279275
{_VICTORIONXS_json, _VICTORIONXS_json_props},
280-
{_VICTSBP_ENCR_json, _VICTSBP_ENCR_json_props},
281276
{_VICTSBP_json, _VICTSBP_json_props},
282-
{_VICTSBSBMSS_ENCR_json, _VICTSBSBMSS_ENCR_json_props},
283277
{_VICTSBS_json, _VICTSBS_json_props},
284278
{_SE_RHT_json, _SE_RHT_json_props},
285279
{_SE_TEMP_json, _SE_TEMP_json_props},

src/devices/VICTRON_BSC_ENCR_json.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/devices/VICTRON_ORIONXS_ENCR_json.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/devices/VICTRON_SBP_ENCR_json.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/devices/VICTRON_SBSBMSS_ENCR_json.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/devices/VICTRON_SBS_json.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const char* _VICTSBS_json = "{\"brand\":\"Victron Energy\",\"model\":\"Smart Battery Sense\",\"model_id\":\"VICTSBS\",\"tag\":\"1408\",\"condition\":[\"manufacturerdata\",\"index\",8,\"a5a3\",\"|\",\"manufacturerdata\",\"index\",8,\"a4a3\",\"&\",\"manufacturerdata\",\"=\",50,\"index\",0,\"e10211\",\"&\",\"manufacturerdata\",\"index\",12,\"02ffff\"],\"properties\":{\"volt\":{\"condition\":[\"manufacturerdata\",24,\"!\",\"ffff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true,true],\"post_proc\":[\"/\",100]},\"tempc\":{\"condition\":[\"manufacturerdata\",37,\"bit\",0,0,\"&\",\"manufacturerdata\",37,\"bit\",1,1],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",32,4,true,false],\"post_proc\":[\"-\",27315,\"/\",100]},\"alarm_reason\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4]}}}";
1+
const char* _VICTSBS_json = "{\"brand\":\"Victron Energy\",\"model\":\"Smart Battery Sense\",\"model_id\":\"VICTSBS\",\"tag\":\"1408\",\"condition\":[\"manufacturerdata\",\"index\",8,\"a5a3\",\"|\",\"manufacturerdata\",\"index\",8,\"a4a3\",\"&\",\"manufacturerdata\",\"=\",50,\"index\",0,\"e10211\",\"&\",\"manufacturerdata\",\"index\",12,\"02ffff\"],\"properties\":{\"volt\":{\"condition\":[\"manufacturerdata\",24,\"!\",\"ffff\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",24,4,true,false],\"post_proc\":[\"/\",100]},\"tempc\":{\"condition\":[\"manufacturerdata\",37,\"bit\",0,0,\"&\",\"manufacturerdata\",37,\"bit\",1,1],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",32,4,true,false],\"post_proc\":[\"-\",27315,\"/\",100]},\"alarm_reason\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",28,4]}}}";
22
/*R""""(
33
{
44
"brand":"Victron Energy",
@@ -9,7 +9,7 @@ const char* _VICTSBS_json = "{\"brand\":\"Victron Energy\",\"model\":\"Smart Bat
99
"properties":{
1010
"volt":{
1111
"condition":["manufacturerdata", 24, "!", "ffff"],
12-
"decoder":["value_from_hex_data", "manufacturerdata", 24, 4, true, true],
12+
"decoder":["value_from_hex_data", "manufacturerdata", 24, 4, true, false],
1313
"post_proc":["/", 100]
1414
},
1515
"tempc":{

src/devices/VICTRON__ENCR_json.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
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]}}}";
2+
/*R""""(
3+
{
4+
"brand":"Victron Energy",
5+
"model":"Victron encrypted",
6+
"model_id":"VICTRON_ENCR",
7+
"tag":"140003",
8+
"condition":["manufacturerdata", ">=", 46, "index", 0, "e10210"],
9+
"properties":{
10+
"cipher":{
11+
"condition":["manufacturerdata", "=", 46],
12+
"decoder":["string_from_hex_data", "manufacturerdata", 20, 26]
13+
},
14+
"_cipher":{
15+
"condition":["manufacturerdata", "=", 48],
16+
"decoder":["string_from_hex_data", "manufacturerdata", 20, 28]
17+
},
18+
"__cipher":{
19+
"condition":["manufacturerdata", "=", 50],
20+
"decoder":["string_from_hex_data", "manufacturerdata", 20, 30]
21+
},
22+
"ctr":{
23+
"decoder":["string_from_hex_data", "manufacturerdata", 14, 4, true]
24+
},
25+
"mic":{
26+
"decoder":["string_from_hex_data", "manufacturerdata", 18, 2]
27+
}
28+
}
29+
})"""";*/
30+
31+
const char* _VICTRON_ENCR_json_props = "{\"properties\":{\"cipher\":{\"unit\":\"hex\",\"name\":\"ciphertext\"},\"ctr\":{\"unit\":\"hex\",\"name\":\"counter\"},\"mic\":{\"unit\":\"hex\",\"name\":\"message integrity check\"}}}";
32+
/*R""""(
33+
{
34+
"properties":{
35+
"cipher":{
36+
"unit":"hex",
37+
"name":"ciphertext"
38+
},
39+
"ctr":{
40+
"unit":"hex",
41+
"name":"counter"
42+
},
43+
"mic":{
44+
"unit":"hex",
45+
"name":"message integrity check"
46+
}
47+
}
48+
})"""";*/

0 commit comments

Comments
 (0)