iobroker.bydhvs 1.4.2 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG_OLD.md +17 -0
- package/LICENSE +21 -21
- package/README-German.md +21 -0
- package/README.md +21 -43
- package/admin/jsonConfig.json +108 -0
- package/docs/byd-hexstructure.md +78 -0
- package/eslint.config.mjs +33 -0
- package/io-package.json +234 -307
- package/lib/constants.js +127 -0
- package/lib/methods.js +56 -0
- package/main.js +1461 -965
- package/package.json +39 -25
- package/prettier.config.mjs +8 -0
- package/PSD_Battery_Icons.psd +0 -0
- package/admin/admin.d.ts +0 -93
- package/admin/index_m.html +0 -113
- package/admin/style.css +0 -32
- package/admin/words.js +0 -81
- package/lib/tools.js +0 -99
package/lib/constants.js
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const myRequests = [
|
4
|
+
Buffer.from('010300000066c5e0', 'hex'), //0
|
5
|
+
Buffer.from('01030500001984cc', 'hex'), //1
|
6
|
+
Buffer.from('010300100003040e', 'hex'), //2
|
7
|
+
Buffer.from('0110055000020400018100f853', 'hex'), //3 start measuring
|
8
|
+
Buffer.from('010305510001d517', 'hex'), //4
|
9
|
+
Buffer.from('01030558004104e5', 'hex'), //5
|
10
|
+
Buffer.from('01030558004104e5', 'hex'), //6
|
11
|
+
Buffer.from('01030558004104e5', 'hex'), //7
|
12
|
+
Buffer.from('01030558004104e5', 'hex'), //8
|
13
|
+
// to read the 5th module, the box must first be reconfigured
|
14
|
+
Buffer.from('01100100000306444542554700176f', 'hex'), //9 switch to second turn for the last few cells
|
15
|
+
Buffer.from('0110055000020400018100f853', 'hex'), //10 start measuring remaining cells (like 3)
|
16
|
+
Buffer.from('010305510001d517', 'hex'), //11 (like 4)
|
17
|
+
Buffer.from('01030558004104e5', 'hex'), //12 (like 5)
|
18
|
+
Buffer.from('01030558004104e5', 'hex'), //13 (like 6)
|
19
|
+
// The BYD tool also issues two more requests, probably to gather even more cells in some larger setups
|
20
|
+
Buffer.from('01030558004104e5', 'hex'), //14 (like 7)
|
21
|
+
Buffer.from('01030558004104e5', 'hex'), //15 (like 8)
|
22
|
+
//
|
23
|
+
// ONLY if two towers in parallel
|
24
|
+
Buffer.from('01100550000204000281000853', 'hex'), // 16 - Switch to Box 2 -> 281
|
25
|
+
];
|
26
|
+
|
27
|
+
/* Während des Updates des BMS funktioniert das Auslesen offensichtlich nicht, hier die Antworten des Speichers (Seriennummer verfälscht und CRC des ersten Paketes nicht neu berechnet)
|
28
|
+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 7 8 9 0 1 2 3 4 5 6 7 8 9 0
|
29
|
+
01 03 cc 50 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 78 78 78 78 78 03 0d 03 0f 03 14 01 00 03 12 02 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 15 04 0c 12 38 2b 82 b2
|
30
|
+
01 03 32 00 43 01 4a 01 4a 00 63 ff f8 52 a8 00 15 00 14 00 14 00 00 03 0f 00 00 00 00 00 00 09 02 00 02 52 76 17 03 00 00 13 84 00 00 00 02 09 02 00 00 04 2c 92 5b
|
31
|
+
01 03 06 03 12 02 01 01 00 c8 ad
|
32
|
+
01 90 04 4d c3 <- Das scheint eine Fehlercondition zu sein.
|
33
|
+
5 min. später klappte es wieder und dann war auch die neue F/W-Version in der Antwort enthalten
|
34
|
+
*/
|
35
|
+
|
36
|
+
const byd_stat_tower = [
|
37
|
+
'Battery Over Voltage', // Bit 0
|
38
|
+
'Battery Under Voltage', // Bit 1
|
39
|
+
'Cells OverVoltage', // Bit 2
|
40
|
+
'Cells UnderVoltage', // Bit 3
|
41
|
+
'Cells Imbalance', // Bit 4
|
42
|
+
'Charging High Temperature(Cells)', // Bit 5
|
43
|
+
'Charging Low Temperature(Cells)', // Bit 6
|
44
|
+
'DisCharging High Temperature(Cells)', // Bit 7
|
45
|
+
'DisCharging Low Temperature(Cells)', // Bit 8
|
46
|
+
'Charging OverCurrent(Cells)', // Bit 9
|
47
|
+
'DisCharging OverCurrent(Cells)', // Bit 10
|
48
|
+
'Charging OverCurrent(Hardware)', // Bit 11
|
49
|
+
'Short Circuit', // Bit 12
|
50
|
+
'Inversly Connection', // Bit 13
|
51
|
+
'Interlock switch Abnormal', // Bit 14
|
52
|
+
'AirSwitch Abnormal', // Bit 15
|
53
|
+
];
|
54
|
+
|
55
|
+
const myINVs = [
|
56
|
+
'Fronius HV', //0
|
57
|
+
'Goodwe HV', //1
|
58
|
+
'Fronius HV', //2
|
59
|
+
'Kostal HV', //3
|
60
|
+
'Goodwe HV', //4
|
61
|
+
'SMA SBS3.7/5.0', //5
|
62
|
+
'Kostal HV', //6
|
63
|
+
'SMA SBS3.7/5.0', //7
|
64
|
+
'Sungrow HV', //8
|
65
|
+
'Sungrow HV', //9
|
66
|
+
'Kaco HV', //10
|
67
|
+
'Kaco HV', //11
|
68
|
+
'Ingeteam HV', //12
|
69
|
+
'Ingeteam HV', //13
|
70
|
+
'SMA SBS 2.5 HV', //14
|
71
|
+
'undefined', //15
|
72
|
+
'SMA SBS 2.5 HV', //16
|
73
|
+
'Fronius HV', //17
|
74
|
+
'undefined', //18
|
75
|
+
'SMA STP', //19
|
76
|
+
];
|
77
|
+
|
78
|
+
const myINVsLVS = [
|
79
|
+
'Fronius HV',
|
80
|
+
'Goodwe HV',
|
81
|
+
'Goodwe HV',
|
82
|
+
'Kostal HV',
|
83
|
+
'Selectronic LV',
|
84
|
+
'SMA SBS3.7/5.0',
|
85
|
+
'SMA LV',
|
86
|
+
'Victron LV',
|
87
|
+
'Suntech LV',
|
88
|
+
'Sungrow HV',
|
89
|
+
'Kaco HV',
|
90
|
+
'Studer LV',
|
91
|
+
'Solar Edge LV',
|
92
|
+
'Ingeteam HV',
|
93
|
+
'Sungrow LV',
|
94
|
+
'Schneider LV',
|
95
|
+
'SMA SBS2.5 HV',
|
96
|
+
'Solar Edge LV',
|
97
|
+
'Solar Edge LV',
|
98
|
+
'Solar Edge LV',
|
99
|
+
'unknown',
|
100
|
+
];
|
101
|
+
|
102
|
+
const myErrors = [
|
103
|
+
'High Temperature Charging (Cells)',
|
104
|
+
'Low Temperature Charging (Cells)',
|
105
|
+
'Over Current Discharging',
|
106
|
+
'Over Current Charging',
|
107
|
+
'Main circuit Failure',
|
108
|
+
'Short Current Alarm',
|
109
|
+
'Cells Imbalance',
|
110
|
+
'Current Sensor Failure',
|
111
|
+
'Battery Over Voltage',
|
112
|
+
'Battery Under Voltage',
|
113
|
+
'Cell Over Voltage',
|
114
|
+
'Cell Under Voltage',
|
115
|
+
'Voltage Sensor Failure',
|
116
|
+
'Temperature Sensor Failure',
|
117
|
+
'High Temperature Discharging (Cells)',
|
118
|
+
'Low Temperature Discharging (Cells)',
|
119
|
+
];
|
120
|
+
|
121
|
+
module.exports = {
|
122
|
+
myRequests,
|
123
|
+
byd_stat_tower,
|
124
|
+
myINVs,
|
125
|
+
myINVsLVS,
|
126
|
+
myErrors,
|
127
|
+
};
|
package/lib/methods.js
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
function buf2int16SI(byteArray, pos) {
|
4
|
+
//signed
|
5
|
+
let result = 0;
|
6
|
+
result = byteArray[pos] * 256 + byteArray[pos + 1];
|
7
|
+
if (result > 32768) {
|
8
|
+
result -= 65536;
|
9
|
+
}
|
10
|
+
return result;
|
11
|
+
}
|
12
|
+
|
13
|
+
function buf2int16US(byteArray, pos) {
|
14
|
+
//unsigned
|
15
|
+
let result = 0;
|
16
|
+
result = byteArray[pos] * 256 + byteArray[pos + 1];
|
17
|
+
return result;
|
18
|
+
}
|
19
|
+
|
20
|
+
function buf2int32US(byteArray, pos) {
|
21
|
+
//unsigned
|
22
|
+
let result = 0;
|
23
|
+
result = byteArray[pos + 2] * 16777216 + byteArray[pos + 3] * 65536 + byteArray[pos] * 256 + byteArray[pos + 1];
|
24
|
+
return result;
|
25
|
+
}
|
26
|
+
|
27
|
+
function decodePacketNOP(_data) {
|
28
|
+
this.log.silly('Packet NOP');
|
29
|
+
}
|
30
|
+
|
31
|
+
function countSetBits(hexString) {
|
32
|
+
// Hexadezimale Zeichen in einen Binärstring umwandeln
|
33
|
+
let binaryString = '';
|
34
|
+
for (let i = 0; i < hexString.length; i++) {
|
35
|
+
// Jeder Hex-Char in einen Binär-String umwandeln und auf 4 Stellen auffüllen
|
36
|
+
binaryString += parseInt(hexString[i], 16).toString(2).padStart(4, '0');
|
37
|
+
}
|
38
|
+
|
39
|
+
// Anzahl der '1' Bits im Binärstring zählen
|
40
|
+
let setBitsCount = 0;
|
41
|
+
for (let i = 0; i < binaryString.length; i++) {
|
42
|
+
if (binaryString[i] === '1') {
|
43
|
+
setBitsCount++;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
return setBitsCount;
|
48
|
+
}
|
49
|
+
|
50
|
+
module.exports = {
|
51
|
+
buf2int16SI,
|
52
|
+
buf2int16US,
|
53
|
+
buf2int32US,
|
54
|
+
decodePacketNOP,
|
55
|
+
countSetBits,
|
56
|
+
};
|