Compare commits
623 Commits
master
...
2024.01.04
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa5a762d2a | ||
|
|
e9def28f3e | ||
|
|
e7a005839b | ||
|
|
65319ed07e | ||
|
|
4548fc2a00 | ||
|
|
7946dfc0c2 | ||
|
|
2c1e145575 | ||
|
|
bbf0003d1c | ||
|
|
5bd3ce5a8f | ||
|
|
cbf7680836 | ||
|
|
8f5c4878c5 | ||
|
|
ef1aec3b26 | ||
|
|
463226082f | ||
|
|
fe2f82e303 | ||
|
|
08bc181a5e | ||
|
|
7928f2f8cf | ||
|
|
bb34fa74fd | ||
|
|
c7098b6c42 | ||
|
|
f89f9da67a | ||
|
|
d769cdd30a | ||
|
|
3bf4d35db8 | ||
|
|
6ab706c87d | ||
|
|
367e0f9b6e | ||
|
|
d494810975 | ||
|
|
9ff39fde26 | ||
|
|
fb2ca28692 | ||
|
|
6e78c5bd1c | ||
|
|
0c829a5947 | ||
|
|
dd8446df0a | ||
|
|
e44328bb13 | ||
|
|
0085970567 | ||
|
|
a1d0dad128 | ||
|
|
8cccce5875 | ||
|
|
6f7470feb4 | ||
|
|
28f46471bf | ||
|
|
a004e94e57 | ||
|
|
6e336f1117 | ||
|
|
7637dc591b | ||
|
|
3dceddfe49 | ||
|
|
d4d42167ec | ||
|
|
3af0437857 | ||
|
|
eb578f08c5 | ||
|
|
49a10305e2 | ||
|
|
9ca3655de6 | ||
|
|
254b95cb0f | ||
|
|
0fa2745ace | ||
|
|
8ba9048f99 | ||
|
|
c5427dedce | ||
|
|
b159c31258 | ||
|
|
b833d5ab52 | ||
|
|
4d4aadf8de | ||
|
|
d23b991f5c | ||
|
|
917242909b | ||
|
|
5bbbe6bfcb | ||
|
|
b461aff622 | ||
|
|
116da05114 | ||
|
|
4324ae3081 | ||
|
|
f7abbdbe06 | ||
|
|
7fb26e1e81 | ||
|
|
b1164d6c69 | ||
|
|
f0a55ea32b | ||
|
|
4ee49a6ecb | ||
|
|
933345d659 | ||
|
|
e937fd1cb8 | ||
|
|
7142921021 | ||
|
|
160d3f23bd | ||
|
|
ae392329ea | ||
|
|
b081845b95 | ||
|
|
ed2a189a61 | ||
|
|
f2893220a5 | ||
|
|
4d0f958943 | ||
|
|
9d6b459dc6 | ||
|
|
b501d25ab6 | ||
|
|
954a98dbc8 | ||
|
|
2f9539e4b3 | ||
|
|
f7bd4a40d8 | ||
|
|
4e489febfe | ||
|
|
24018a1432 | ||
|
|
88a5117007 | ||
|
|
2eeb5f1d19 | ||
|
|
a7ea15cde9 | ||
|
|
eb1c2dbd8c | ||
|
|
0cb42a6424 | ||
|
|
d984912d7c | ||
|
|
8dd96c450b | ||
|
|
3df47d1fee | ||
|
|
68783b450f | ||
|
|
ba303da742 | ||
|
|
a7a38e74a1 | ||
|
|
8c36532cea | ||
|
|
f744629b0b | ||
|
|
2ba7ea2744 | ||
|
|
d5308b1029 | ||
|
|
929b477275 | ||
|
|
d4afc5940a | ||
|
|
88744bfa38 | ||
|
|
96ee78156d | ||
|
|
ca308d0895 | ||
|
|
84647d80e2 | ||
|
|
026bca9fe3 | ||
|
|
be2846a07a | ||
|
|
487304125c | ||
|
|
7c7a15e016 | ||
|
|
b7214161b8 | ||
|
|
1100f10c99 | ||
|
|
8e4f234517 | ||
|
|
6601e9a44b | ||
|
|
801fe5d027 | ||
|
|
c8a561dbd7 | ||
|
|
cc3ab9b14b | ||
|
|
3702fb3eef | ||
|
|
bbc1319090 | ||
|
|
9475a78211 | ||
|
|
5a72d74982 | ||
|
|
40c720aa57 | ||
|
|
c06299878b | ||
|
|
940d1a6145 | ||
|
|
401a3b86a8 | ||
|
|
21bbed9b8e | ||
|
|
ec67fe1ff7 | ||
|
|
3db237c109 | ||
|
|
c950eb7245 | ||
|
|
3cb30b14cd | ||
|
|
e6eaa001e7 | ||
|
|
aff7924411 | ||
|
|
5335ec1bde | ||
|
|
69456affce | ||
|
|
81864b3420 | ||
|
|
587b2dc553 | ||
|
|
2bce8311a7 | ||
|
|
6b425d96b0 | ||
|
|
9bc334e368 | ||
|
|
43e836ac41 | ||
|
|
2440028d38 | ||
|
|
18c464e524 | ||
|
|
8b01fa07cc | ||
|
|
e06740fbb8 | ||
|
|
cea1f94b5e | ||
|
|
f0def2ae89 | ||
|
|
a7da000345 | ||
|
|
0dd1566dc6 | ||
|
|
c393e52185 | ||
|
|
cbc99d715f | ||
|
|
f68f68be77 | ||
|
|
633ef88296 | ||
|
|
f3297930b5 | ||
|
|
95d7ac7adf | ||
|
|
1d559c1c40 | ||
|
|
475aab1e9a | ||
|
|
cdf5c85510 | ||
|
|
23ff4ef22a | ||
|
|
2a858e096b | ||
|
|
3fb062b5cc | ||
|
|
ffa9be0835 | ||
|
|
344498d440 | ||
|
|
d3adc65d11 | ||
|
|
107182f948 | ||
|
|
e457ab73f9 | ||
|
|
006f63ed02 | ||
|
|
9a4eb75160 | ||
|
|
1f39ed7b9b | ||
|
|
afd8790c3c | ||
|
|
99876d7c6b | ||
|
|
97f58eeba7 | ||
|
|
097d464bbb | ||
|
|
e279ce08c4 | ||
|
|
9aeb1583b5 | ||
|
|
461fce8ff4 | ||
|
|
9bab740c43 | ||
|
|
b2d58af5e8 | ||
|
|
71079fa0cc | ||
|
|
2970e84193 | ||
|
|
18b1076660 | ||
|
|
0b0bcf1dfb | ||
|
|
fd208cf6bb | ||
|
|
8b23324693 | ||
|
|
8433820529 | ||
|
|
0caffe9411 | ||
|
|
6ffb5bb897 | ||
|
|
2223afac62 | ||
|
|
acbf80d196 | ||
|
|
6ed3ce7417 | ||
|
|
d6163ddb7d | ||
|
|
07bb0b03f7 | ||
|
|
7d73ae3c20 | ||
|
|
4d05035661 | ||
|
|
9995c1172e | ||
|
|
016e30ec00 | ||
|
|
cd1db49a98 | ||
|
|
f018a0136e | ||
|
|
fd58ad2003 | ||
|
|
080a3eb29e | ||
|
|
da7628dafc | ||
|
|
ceb28030a4 | ||
|
|
ded5ceec58 | ||
|
|
86ee7e1a64 | ||
|
|
8dac88e7b9 | ||
|
|
0fd7b75e83 | ||
|
|
51a21de189 | ||
|
|
e68baa3086 | ||
|
|
e0a8da84d7 | ||
|
|
a6f5e8a3a2 | ||
|
|
8298a0c36f | ||
|
|
c727e21a49 | ||
|
|
91ce844b36 | ||
|
|
e7c8a89bd3 | ||
|
|
2e811b7ab1 | ||
|
|
52af52eb3a | ||
|
|
a3e7439181 | ||
|
|
9f511fb985 | ||
|
|
8b64671151 | ||
|
|
13b318690d | ||
|
|
47f81f2579 | ||
|
|
3a991708d0 | ||
|
|
b7ac70b1ca | ||
|
|
1c7b7d3cdf | ||
|
|
556f3e0abf | ||
|
|
40a65198fe | ||
|
|
065c169b20 | ||
|
|
178d40d5b4 | ||
|
|
569edbe69e | ||
|
|
33423dfc2f | ||
|
|
6fe19f00a7 | ||
|
|
d1885b6177 | ||
|
|
8021052cfd | ||
|
|
e5af5be70a | ||
|
|
db4125ae7a | ||
|
|
dae4c6fbf5 | ||
|
|
2d14d9f69e | ||
|
|
3f0291dce0 | ||
|
|
5d4c6866da | ||
|
|
c621f2d3e3 | ||
|
|
80f1af32f8 | ||
|
|
46c733ca31 | ||
|
|
32913c2b2e | ||
|
|
dfa0a1c98b | ||
|
|
cc32e3973e | ||
|
|
23b35d9b00 | ||
|
|
4abc89d43c | ||
|
|
70060559da | ||
|
|
6b437b5ea1 | ||
|
|
9ff9a8a6d6 | ||
|
|
00490b80af | ||
|
|
89209b6bf7 | ||
|
|
83b42a36b9 | ||
|
|
e65b2196bf | ||
|
|
d4a5570806 | ||
|
|
c337df605c | ||
|
|
e91935ab38 | ||
|
|
37b5edb010 | ||
|
|
71dda4b89c | ||
|
|
c7505eaae6 | ||
|
|
0a0488f73a | ||
|
|
a8554f97b0 | ||
|
|
322f532ac0 | ||
|
|
8f386c8611 | ||
|
|
e2a6468304 | ||
|
|
8764809259 | ||
|
|
3861ab89f1 | ||
|
|
75a59f5d1d | ||
|
|
8c9afbcdc0 | ||
|
|
422ad3f909 | ||
|
|
71da704d38 | ||
|
|
1e30323915 | ||
|
|
38b990fbbc | ||
|
|
41cc5ff4f9 | ||
|
|
84a6ed540d | ||
|
|
943a0eb58e | ||
|
|
6a9585cd1e | ||
|
|
545a18db6f | ||
|
|
a1b3bdfee8 | ||
|
|
8cc548d13e | ||
|
|
b8e06bf824 | ||
|
|
1e16eca16e | ||
|
|
40cee1f9ca | ||
|
|
3504924bb0 | ||
|
|
82699b1c88 | ||
|
|
4ddaa7643b | ||
|
|
0d0a624fe2 | ||
|
|
a306bc1351 | ||
|
|
b00ca02aac | ||
|
|
1a0f44dac4 | ||
|
|
1dc73f91ee | ||
|
|
3c5082287e | ||
|
|
690025e5fd | ||
|
|
be7a43fbfb | ||
|
|
01849dc90a | ||
|
|
ee376827fd | ||
|
|
9999fa28e8 | ||
|
|
ee82c8c9b8 | ||
|
|
9efe076cc2 | ||
|
|
fc5089e70b | ||
|
|
9ff1885d5a | ||
|
|
b79619bf8b | ||
|
|
1970b939e0 | ||
|
|
1d62e36303 | ||
|
|
03ce71519d | ||
|
|
74dcddaa1a | ||
|
|
616d0425db | ||
|
|
43f7553cdd | ||
|
|
72289cda1a | ||
|
|
d2fc00b7d6 | ||
|
|
f99f80159d | ||
|
|
c430b69322 | ||
|
|
79834e4d47 | ||
|
|
1b29133ee0 | ||
|
|
1d29781804 | ||
|
|
d28c9dbc4b | ||
|
|
515bb1c7ce | ||
|
|
1e4337e900 | ||
|
|
a893260de0 | ||
|
|
97a8545d78 | ||
|
|
b6edc11eb2 | ||
|
|
4bff31e3b1 | ||
|
|
06f6a4da8b | ||
|
|
2d7115e1e8 | ||
|
|
f6d0b0997f | ||
|
|
9da5be7fd8 | ||
|
|
71128e5a55 | ||
|
|
406332f6cd | ||
|
|
a1252c5701 | ||
|
|
28e204fd80 | ||
|
|
86ecc62b33 | ||
|
|
e3964f8bbe | ||
|
|
869d8e6d8b | ||
|
|
19b2dd4c7a | ||
|
|
00def1d8d1 | ||
|
|
734d34b7a8 | ||
|
|
f84bdf7287 | ||
|
|
cb6b98499a | ||
|
|
9521deea25 | ||
|
|
fd94a69ff8 | ||
|
|
e4822f00ec | ||
|
|
e29708f871 | ||
|
|
724f1cf713 | ||
|
|
4eec055f84 | ||
|
|
ef51d75f2c | ||
|
|
d6ff90260e | ||
|
|
7f17176462 | ||
|
|
0ff9ebfac9 | ||
|
|
09fb0618b4 | ||
|
|
2a5f9776a3 | ||
|
|
52deea3033 | ||
|
|
ede572f6e3 | ||
|
|
ca8c9b55ae | ||
|
|
ca0b8e9afc | ||
|
|
dab5b4d723 | ||
|
|
9eb15274a2 | ||
|
|
e0150a8962 | ||
|
|
f37b23b706 | ||
|
|
53b965651d | ||
|
|
d501c4b836 | ||
|
|
7d50fa373e | ||
|
|
f45de7ba36 | ||
|
|
3e208219b6 | ||
|
|
edaa223856 | ||
|
|
d8a15c39cb | ||
|
|
a1b63b61d7 | ||
|
|
801ad469c5 | ||
|
|
8ca664a8fe | ||
|
|
c0dff1e7df | ||
|
|
459f9ffc2c | ||
|
|
2950f55879 | ||
|
|
169ea3d5d5 | ||
|
|
abffc38c11 | ||
|
|
0c34554b9c | ||
|
|
160b5b5b01 | ||
|
|
cd4a327671 | ||
|
|
98faffc3ca | ||
|
|
e35254c8f2 | ||
|
|
bd57d0f19a | ||
|
|
a1da3f9842 | ||
|
|
20bb7fc372 | ||
|
|
90f5ed4251 | ||
|
|
4a664a7b3d | ||
|
|
6b85b8d4a2 | ||
|
|
a4053dcf19 | ||
|
|
7dee289b5b | ||
|
|
78838585f7 | ||
|
|
fa5b52210a | ||
|
|
59c84bcb85 | ||
|
|
4de043f3d4 | ||
|
|
c86c5133f0 | ||
|
|
c7ef661db7 | ||
|
|
a0bbf61db2 | ||
|
|
ebaf5c4565 | ||
|
|
e514ef744b | ||
|
|
d1e43c11b9 | ||
|
|
1f6301c2c0 | ||
|
|
f4455ccb93 | ||
|
|
a091e80ed0 | ||
|
|
a968f09d73 | ||
|
|
5f42f66c02 | ||
|
|
ece131995a | ||
|
|
b3c17c8ee8 | ||
|
|
6f2901b324 | ||
|
|
e0a80734f3 | ||
|
|
2aad13dc72 | ||
|
|
7ba2058625 | ||
|
|
07ea03d12b | ||
|
|
06d5da50a2 | ||
|
|
d80f62d1b9 | ||
|
|
26eedc9701 | ||
|
|
89be653a51 | ||
|
|
a4767827b4 | ||
|
|
0be574809b | ||
|
|
56e52156e5 | ||
|
|
0e2b7767c7 | ||
|
|
3b57550ead | ||
|
|
bbf3d44d69 | ||
|
|
0b5c47cd2e | ||
|
|
7d48e426dc | ||
|
|
db7ad52a4d | ||
|
|
1aab888bf2 | ||
|
|
8576034b77 | ||
|
|
3f8226c36c | ||
|
|
0832ef86e4 | ||
|
|
55dc4dbdfc | ||
|
|
5d5124dd5b | ||
|
|
a441a6eaf7 | ||
|
|
aaa9f5cd98 | ||
|
|
cf7f815eba | ||
|
|
d96be997ac | ||
|
|
080ef03eec | ||
|
|
41da6d489d | ||
|
|
c06be1c56c | ||
|
|
e6963822e9 | ||
|
|
effd4e89ab | ||
|
|
05a5b2367b | ||
|
|
dbb548e731 | ||
|
|
caeff77dae | ||
|
|
a4c8e85be5 | ||
|
|
19252629cb | ||
|
|
a6c852a82c | ||
|
|
2dc7089aa6 | ||
|
|
b9acbe6f2c | ||
|
|
06370baa0e | ||
|
|
c95468f972 | ||
|
|
46ce6ad50f | ||
|
|
32a96bbd06 | ||
|
|
04c7e4fa01 | ||
|
|
9214897245 | ||
|
|
e95acbec46 | ||
|
|
c7f6aea763 | ||
|
|
63c956af15 | ||
|
|
6bc6796c23 | ||
|
|
01a2ffaed5 | ||
|
|
7952becd17 | ||
|
|
fe9959cc97 | ||
|
|
a043d55b01 | ||
|
|
1b2d1afb9b | ||
|
|
43dc10b868 | ||
|
|
26dc262641 | ||
|
|
a79f7b2026 | ||
|
|
a3f35f2491 | ||
|
|
4cf4594945 | ||
|
|
87794e0793 | ||
|
|
8df2c16cce | ||
|
|
418fea2cfc | ||
|
|
6f3e33c0b1 | ||
|
|
5b0e627f6d | ||
|
|
a66f818e75 | ||
|
|
1e6e40a3ab | ||
|
|
83d61b1b80 | ||
|
|
08cf6a523d | ||
|
|
6a89ae986e | ||
|
|
6dd34a8401 | ||
|
|
716fc867a1 | ||
|
|
44a770be0e | ||
|
|
06a0f76fed | ||
|
|
06fbdf1f12 | ||
|
|
43436e19b7 | ||
|
|
304d90062d | ||
|
|
a6e720f154 | ||
|
|
804f225908 | ||
|
|
b70407d7fe | ||
|
|
3ffc1c947d | ||
|
|
9391b11403 | ||
|
|
b7dda83545 | ||
|
|
cf4a35e148 | ||
|
|
9f2d79f2dc | ||
|
|
6709338dbd | ||
|
|
67a5217482 | ||
|
|
260f4ccdb8 | ||
|
|
c36e4cc3da | ||
|
|
028b43f4d1 | ||
|
|
c0735c5b1f | ||
|
|
3e38941b57 | ||
|
|
6241a31e8c | ||
|
|
4a51ae5038 | ||
|
|
26a8809121 | ||
|
|
4a49f48969 | ||
|
|
4feaa1db98 | ||
|
|
3b62d5708a | ||
|
|
d146adcc3b | ||
|
|
e9fce49fee | ||
|
|
32342dcd5d | ||
|
|
17dd9db946 | ||
|
|
3ed61319ad | ||
|
|
43815f6711 | ||
|
|
c2ba4a334e | ||
|
|
1e968a1713 | ||
|
|
3f3540bd33 | ||
|
|
28b24d01ad | ||
|
|
cd7ece7caf | ||
|
|
10f907477d | ||
|
|
56151b0d12 | ||
|
|
73fe3bfb96 | ||
|
|
a2473645a5 | ||
|
|
1caeb1d88b | ||
|
|
a758d894f6 | ||
|
|
0f80a25937 | ||
|
|
9e1df83a87 | ||
|
|
1e7f6b8f0f | ||
|
|
30440472f7 | ||
|
|
f973de4ab6 | ||
|
|
f560f25302 | ||
|
|
09942e8e18 | ||
|
|
cb7874ac8d | ||
|
|
ce752f0d75 | ||
|
|
6e0ae6d152 | ||
|
|
27f20a76f0 | ||
|
|
1a4a8cc921 | ||
|
|
dc44cc8e1f | ||
|
|
0ac529146e | ||
|
|
a529c91254 | ||
|
|
7022ed95b6 | ||
|
|
43bfee4d55 | ||
|
|
957bc91828 | ||
|
|
17e564a094 | ||
|
|
f89ccdd2ee | ||
|
|
e5fa0050cd | ||
|
|
ed12f814dd | ||
|
|
997023e52f | ||
|
|
4f0a45c902 | ||
|
|
82ecf6cd6d | ||
|
|
37d3bb0eb0 | ||
|
|
1c01e927f9 | ||
|
|
9e79f02787 | ||
|
|
9e70d2dfc6 | ||
|
|
bec6c20531 | ||
|
|
9a7a0d293e | ||
|
|
ddb6346087 | ||
|
|
035251c04c | ||
|
|
e49bbe0faf | ||
|
|
df5cde2e82 | ||
|
|
a213082c4d | ||
|
|
f740dceb78 | ||
|
|
0a0cb9905e | ||
|
|
ae414c42c1 | ||
|
|
2109520bde | ||
|
|
1fc0e76c41 | ||
|
|
2c6dff3714 | ||
|
|
f35395e76f | ||
|
|
407e0ee8c1 | ||
|
|
b3295f5f33 | ||
|
|
6b4129c400 | ||
|
|
a6d734018a | ||
|
|
61fd54b026 | ||
|
|
38e159d5e6 | ||
|
|
cbc64936e6 | ||
|
|
8a5d027374 | ||
|
|
596f1f1183 | ||
|
|
a9336968c7 | ||
|
|
48ef4c6c04 | ||
|
|
cd219e4fa8 | ||
|
|
3617e9a260 | ||
|
|
732ab3e5c6 | ||
|
|
c3df1e7328 | ||
|
|
905dc359a5 | ||
|
|
d5740e4851 | ||
|
|
9f2bbe3c03 | ||
|
|
5de35ee353 | ||
|
|
c8b9288f1c | ||
|
|
3febc28c78 | ||
|
|
366e7dc409 | ||
|
|
25285b10ee | ||
|
|
ba3183e10b | ||
|
|
9c71652b2c | ||
|
|
fb638cba43 | ||
|
|
df7c821bd4 | ||
|
|
6587282ac2 | ||
|
|
4b02426ab2 | ||
|
|
3843a46de9 | ||
|
|
e6b2be6fdf | ||
|
|
bee600bfd8 | ||
|
|
5a25ce50db | ||
|
|
41eb94e5d9 | ||
|
|
f8e7db1ba7 | ||
|
|
b21990e1d1 | ||
|
|
12fc34d4de | ||
|
|
723fc96ec5 | ||
|
|
3e4e1bcea4 | ||
|
|
ece592287c | ||
|
|
63ddbed359 | ||
|
|
044931c08e | ||
|
|
48e5b567cb | ||
|
|
7140574c37 | ||
|
|
b8ffa37e97 | ||
|
|
17abb57ed6 | ||
|
|
f78561cef7 | ||
|
|
82c5fbcf46 | ||
|
|
0d08c6a136 | ||
|
|
6bdc1c5d3f | ||
|
|
865c9cdac5 | ||
|
|
25094ae5b6 | ||
|
|
d9bf0ab2e9 | ||
|
|
72c0e8579a | ||
|
|
2ff8f84387 | ||
|
|
70136e20aa | ||
|
|
47dda553d9 | ||
|
|
0eeafe69d9 | ||
|
|
e43a45b979 | ||
|
|
c889efef7c | ||
|
|
c7c1506e42 | ||
|
|
9142dd9930 | ||
|
|
6a802d607c | ||
|
|
5aa27a8dc8 | ||
|
|
a4752e1379 | ||
|
|
15c1717290 | ||
|
|
0793856259 | ||
|
|
6ca3fb61ce | ||
|
|
0e4edc9571 |
@ -1,9 +0,0 @@
|
|||||||
# http://editorconfig.org
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
39
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -5,18 +5,11 @@ body:
|
|||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: >
|
value: >
|
||||||
### ⚠️ Please remember: issues are for *bugs*
|
### ✋ **This is bug tracker, not a support forum**
|
||||||
That is, something you believe affects every single user of OpenDTU, not just you. If you're not sure, start with one of the other options below.
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
#### Have a question? 👉 [Start a new discussion](https://github.com/tbnobody/OpenDTU/discussions/new) or [ask in chat](https://discord.gg/WzhxEY62mB).
|
|
||||||
|
|
||||||
#### Before opening an issue, please double check:
|
If something isn't working right, you have questions or need help, [**get in touch on the Discussions**](https://github.com/tbnobody/OpenDTU/discussions).
|
||||||
|
|
||||||
- [Documentation](https://www.opendtu.solar).
|
Please quickly search existing issues first before submitting a bug.
|
||||||
- [The FAQs](https://www.opendtu.solar/firmware/faq/).
|
|
||||||
- [Existing issues and discussions](https://github.com/tbnobody/OpenDTU/search?q=&type=issues).
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: what-happened
|
id: what-happened
|
||||||
attributes:
|
attributes:
|
||||||
@ -47,8 +40,7 @@ body:
|
|||||||
label: Install Method
|
label: Install Method
|
||||||
description: How did you install OpenDTU?
|
description: How did you install OpenDTU?
|
||||||
options:
|
options:
|
||||||
- Pre-Compiled binary from GitHub releases
|
- Pre-Compiled binary from GitHub
|
||||||
- Pre-Compiled binary from GitHub actions/pull-request
|
|
||||||
- Self-Compiled
|
- Self-Compiled
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
@ -60,14 +52,6 @@ body:
|
|||||||
placeholder: "e.g. 359d513"
|
placeholder: "e.g. 359d513"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
|
||||||
id: environment
|
|
||||||
attributes:
|
|
||||||
label: What firmware variant (PIO Environment) are you using?
|
|
||||||
description: You can find this in by going to Info -> System
|
|
||||||
placeholder: "generic_esp32s3_usb"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: logs
|
id: logs
|
||||||
attributes:
|
attributes:
|
||||||
@ -81,17 +65,4 @@ body:
|
|||||||
Links? References? Anything that will give us more context about the issue you are encountering!
|
Links? References? Anything that will give us more context about the issue you are encountering!
|
||||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: checkboxes
|
|
||||||
id: required-checks
|
|
||||||
attributes:
|
|
||||||
label: Please confirm the following
|
|
||||||
options:
|
|
||||||
- label: I believe this issue is a bug that affects all users of OpenDTU, not something specific to my installation.
|
|
||||||
required: true
|
|
||||||
- label: I have already searched for relevant existing issues and discussions before opening this report.
|
|
||||||
required: true
|
|
||||||
- label: I have updated the title field above with a concise description.
|
|
||||||
required: true
|
|
||||||
- label: I have double checked that my inverter does not contain a W in the model name (like HMS-xxxW) as they are not supported.
|
|
||||||
required: true
|
|
||||||
71
.github/workflows/build.yml
vendored
@ -1,10 +1,15 @@
|
|||||||
name: OpenDTU Build
|
name: OpenDTU-onBattery Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- docs/**
|
- docs/**
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- development
|
||||||
|
tags-ignore:
|
||||||
|
- v*
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- docs/**
|
- docs/**
|
||||||
@ -18,14 +23,14 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Cache pip
|
- name: Cache pip
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
|
|
||||||
@ -43,7 +48,7 @@ jobs:
|
|||||||
environments: ${{ steps.envs.outputs.environments }}
|
environments: ${{ steps.envs.outputs.environments }}
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build Environments
|
name: Build Enviornments
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: get_default_envs
|
needs: get_default_envs
|
||||||
strategy:
|
strategy:
|
||||||
@ -56,7 +61,7 @@ jobs:
|
|||||||
run: git fetch --force --tags origin
|
run: git fetch --force --tags origin
|
||||||
|
|
||||||
- name: Cache pip
|
- name: Cache pip
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
@ -64,13 +69,13 @@ jobs:
|
|||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Cache PlatformIO
|
- name: Cache PlatformIO
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.platformio
|
path: ~/.platformio
|
||||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
|
|
||||||
@ -79,56 +84,64 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install --upgrade platformio setuptools
|
pip install --upgrade platformio setuptools
|
||||||
|
|
||||||
- name: Enable Corepack
|
|
||||||
run: |
|
|
||||||
cd webapp
|
|
||||||
corepack enable
|
|
||||||
|
|
||||||
- name: Setup Node.js and yarn
|
- name: Setup Node.js and yarn
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "20"
|
||||||
cache: "yarn"
|
cache: "yarn"
|
||||||
cache-dependency-path: "webapp/yarn.lock"
|
cache-dependency-path: "webapp/yarn.lock"
|
||||||
|
|
||||||
- name: Install WebApp dependencies
|
- name: Install WebApp dependencies
|
||||||
run: |
|
run: yarn --cwd webapp install --frozen-lockfile
|
||||||
cd webapp
|
|
||||||
yarn install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Build WebApp
|
- name: Build WebApp
|
||||||
run: |
|
run: yarn --cwd webapp build
|
||||||
cd webapp
|
|
||||||
yarn build
|
|
||||||
|
|
||||||
- name: Build firmware
|
- name: Build firmware
|
||||||
run: pio run -e ${{ matrix.environment }}
|
run: pio run -e ${{ matrix.environment }}
|
||||||
|
|
||||||
- name: Rename Firmware
|
- name: Rename Firmware
|
||||||
run: mv .pio/build/${{ matrix.environment }}/firmware.bin .pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.bin
|
run: mv .pio/build/${{ matrix.environment }}/firmware.bin .pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.bin
|
||||||
|
|
||||||
- name: Rename Factory Firmware
|
- name: Rename Factory Firmware
|
||||||
run: mv .pio/build/${{ matrix.environment }}/firmware.factory.bin .pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.factory.bin
|
run: mv .pio/build/${{ matrix.environment }}/firmware.factory.bin .pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.factory.bin
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: opendtu-${{ matrix.environment }}
|
name: opendtu-onbattery-${{ matrix.environment }}
|
||||||
path: |
|
path: |
|
||||||
.pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.bin
|
.pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.bin
|
||||||
.pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.factory.bin
|
.pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.factory.bin
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create Release
|
name: Create Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [get_default_envs, build]
|
needs: [get_default_envs, build]
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/2')
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get tags
|
||||||
|
run: git fetch --force --tags origin
|
||||||
|
|
||||||
|
- name: Get openDTU core release
|
||||||
|
run: |
|
||||||
|
echo "OPEN_DTU_CORE_RELEASE=$(git for-each-ref --sort=creatordate --format '%(refname) %(creatordate)' refs/tags | grep 'refs/tags/v' | tail -1 | sed 's#.*/##' | sed 's/ .*//')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create openDTU-core-release-Badge
|
||||||
|
uses: schneegans/dynamic-badges-action@v1.6.0
|
||||||
|
with:
|
||||||
|
auth: ${{ secrets.GIST_SECRET }}
|
||||||
|
gistID: 68b47cc8c8994d04ab3a4fa9d8aee5e6
|
||||||
|
filename: openDTUcoreRelease.json
|
||||||
|
label: based on original OpenDTU
|
||||||
|
message: ${{ env.OPEN_DTU_CORE_RELEASE }}
|
||||||
|
color: lightblue
|
||||||
|
|
||||||
- name: Build Changelog
|
- name: Build Changelog
|
||||||
id: github_release
|
id: github_release
|
||||||
uses: mikepenz/release-changelog-builder-action@v4
|
uses: mikepenz/release-changelog-builder-action@v3
|
||||||
with:
|
with:
|
||||||
failOnError: true
|
failOnError: true
|
||||||
commitMode: true
|
commitMode: true
|
||||||
@ -144,10 +157,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ls -R
|
ls -R
|
||||||
cd artifacts
|
cd artifacts
|
||||||
for i in */; do cp ${i}opendtu-*.bin ./; done
|
for i in */; do cp ${i}opendtu-onbattery-*.bin ./; done
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
body: ${{steps.github_release.outputs.changelog}}
|
body: ${{steps.github_release.outputs.changelog}}
|
||||||
draft: False
|
draft: False
|
||||||
|
|||||||
@ -18,12 +18,6 @@
|
|||||||
"fix"
|
"fix"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"title": "## 🌎 Web Application",
|
|
||||||
"labels": [
|
|
||||||
"webapp"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"title": "## 📚 Documentation",
|
"title": "## 📚 Documentation",
|
||||||
"labels": [
|
"labels": [
|
||||||
@ -36,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"template": "${{CHANGELOG}}",
|
"template": "${{CHANGELOG}}",
|
||||||
"pr_template": "- [${{TITLE}}](https://github.com/tbnobody/OpenDTU/commit/${{MERGE_SHA}})",
|
"pr_template": "- [${{TITLE}}](https://github.com/helgeerbe/OpenDTU-OnBattery/commit/${{MERGE_SHA}})",
|
||||||
"empty_template": "- no changes",
|
"empty_template": "- no changes",
|
||||||
"label_extractor": [
|
"label_extractor": [
|
||||||
{
|
{
|
||||||
|
|||||||
4
.github/workflows/cpplint.yml
vendored
@ -7,9 +7,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
54
.github/workflows/repo-maintenance.yml
vendored
@ -1,54 +0,0 @@
|
|||||||
name: 'Repository Maintenance'
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 4 * * *'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
discussions: write
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: lock
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
name: 'Stale'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/stale@v9
|
|
||||||
with:
|
|
||||||
days-before-stale: 14
|
|
||||||
days-before-close: 60
|
|
||||||
any-of-labels: 'cant-reproduce,not a bug'
|
|
||||||
stale-issue-label: stale
|
|
||||||
stale-pr-label: stale
|
|
||||||
stale-issue-message: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
|
|
||||||
lock-threads:
|
|
||||||
name: 'Lock Old Threads'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: dessant/lock-threads@v5
|
|
||||||
with:
|
|
||||||
issue-inactive-days: '30'
|
|
||||||
pr-inactive-days: '30'
|
|
||||||
discussion-inactive-days: '30'
|
|
||||||
log-output: true
|
|
||||||
issue-comment: >
|
|
||||||
This issue has been automatically locked since there
|
|
||||||
has not been any recent activity after it was closed.
|
|
||||||
Please open a new discussion or issue for related concerns.
|
|
||||||
pr-comment: >
|
|
||||||
This pull request has been automatically locked since there
|
|
||||||
has not been any recent activity after it was closed.
|
|
||||||
Please open a new discussion or issue for related concerns.
|
|
||||||
discussion-comment: >
|
|
||||||
This discussion has been automatically locked since there
|
|
||||||
has not been any recent activity after it was closed.
|
|
||||||
Please open a new discussion for related concerns.
|
|
||||||
103
.github/workflows/test_build.yml
vendored
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
name: OpenDTU-onBattery Test Build
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get_default_envs:
|
||||||
|
name: Gather Environments
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.9"
|
||||||
|
|
||||||
|
- name: Install PlatformIO
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade platformio
|
||||||
|
|
||||||
|
- name: Get default environments
|
||||||
|
id: envs
|
||||||
|
run: |
|
||||||
|
echo "environments=$(pio project config --json-output | jq -cr '.[1][1][0][1]|split(",")')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
environments: ${{ steps.envs.outputs.environments }}
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build Enviornments
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: get_default_envs
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get tags
|
||||||
|
run: git fetch --force --tags origin
|
||||||
|
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
|
- name: Cache PlatformIO
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.platformio
|
||||||
|
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.9"
|
||||||
|
|
||||||
|
- name: Install PlatformIO
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade platformio
|
||||||
|
|
||||||
|
- name: Setup Node.js and yarn
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "18"
|
||||||
|
cache: "yarn"
|
||||||
|
cache-dependency-path: "webapp/yarn.lock"
|
||||||
|
|
||||||
|
- name: Install WebApp dependencies
|
||||||
|
run: yarn --cwd webapp install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Build WebApp
|
||||||
|
run: yarn --cwd webapp build
|
||||||
|
|
||||||
|
- name: Build firmware
|
||||||
|
run: pio run -e ${{ matrix.environment }}
|
||||||
|
|
||||||
|
- name: Rename Firmware
|
||||||
|
run: mv .pio/build/${{ matrix.environment }}/firmware.bin .pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.bin
|
||||||
|
|
||||||
|
- name: Rename Factory Firmware
|
||||||
|
run: mv .pio/build/${{ matrix.environment }}/firmware.factory.bin .pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.factory.bin
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: opendtu-onbattery-${{ matrix.environment }}
|
||||||
|
path: |
|
||||||
|
.pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.bin
|
||||||
|
.pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.factory.bin
|
||||||
|
|
||||||
|
|
||||||
16
.github/workflows/yarnlint.yml
vendored
@ -6,23 +6,17 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: webapp
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- name: Enable Corepack
|
|
||||||
run: corepack enable
|
|
||||||
- name: Setup Node.js and yarn
|
- name: Setup Node.js and yarn
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "18"
|
||||||
cache: "yarn"
|
cache: "yarn"
|
||||||
cache-dependency-path: "webapp/yarn.lock"
|
cache-dependency-path: "webapp/yarn.lock"
|
||||||
|
|
||||||
- name: Install WebApp dependencies
|
- name: Install WebApp dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn --cwd webapp install --frozen-lockfile
|
||||||
|
|
||||||
- name: Linting
|
- name: Linting
|
||||||
run: yarn lint
|
run: yarn --cwd webapp lint
|
||||||
28
.github/workflows/yarnprettier.yml
vendored
@ -1,28 +0,0 @@
|
|||||||
name: Yarn Prettier
|
|
||||||
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: webapp
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Enable Corepack
|
|
||||||
run: corepack enable
|
|
||||||
- name: Setup Node.js and yarn
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "22"
|
|
||||||
cache: "yarn"
|
|
||||||
cache-dependency-path: "webapp/yarn.lock"
|
|
||||||
|
|
||||||
- name: Install WebApp dependencies
|
|
||||||
run: yarn install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Check Formatting
|
|
||||||
run: yarn prettier --check src/
|
|
||||||
2
.vscode/extensions.json
vendored
@ -3,8 +3,8 @@
|
|||||||
// for the documentation about the extensions.json format
|
// for the documentation about the extensions.json format
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"DavidAnson.vscode-markdownlint",
|
"DavidAnson.vscode-markdownlint",
|
||||||
"EditorConfig.EditorConfig",
|
|
||||||
"Vue.volar",
|
"Vue.volar",
|
||||||
|
"Vue.vscode-typescript-vue-plugin",
|
||||||
"platformio.platformio-ide"
|
"platformio.platformio-ide"
|
||||||
],
|
],
|
||||||
"unwantedRecommendations": [
|
"unwantedRecommendations": [
|
||||||
|
|||||||
62
.vscode/settings.json
vendored
@ -1,3 +1,63 @@
|
|||||||
{
|
{
|
||||||
"C_Cpp.clang_format_style": "WebKit"
|
"C_Cpp.clang_format_style": "WebKit",
|
||||||
|
"files.associations": {
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"unordered_set": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"regex": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iomanip": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"typeinfo": "cpp",
|
||||||
|
"variant": "cpp"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
77
README.md
@ -1,43 +1,60 @@
|
|||||||
# OpenDTU
|
- [OpenDTU-onBattery](#opendtu-onbattery)
|
||||||
|
- [What is OpenDTU-onBattery](#what-is-opendtu-onbattery)
|
||||||
|
- [History of the project](#history-of-the-project)
|
||||||
|
- [Highlights of OpenDTU-onBattery](#highlights-of-opendtu-onbattery)
|
||||||
|
- [Documentation](#documentation)
|
||||||
|
- [Acknowledgment](#acknowledgment)
|
||||||
|
|
||||||
[](https://github.com/tbnobody/OpenDTU/actions/workflows/build.yml)
|
# OpenDTU-onBattery
|
||||||
[](https://github.com/tbnobody/OpenDTU/actions/workflows/cpplint.yml)
|
|
||||||
[](https://github.com/tbnobody/OpenDTU/actions/workflows/yarnlint.yml)
|
|
||||||
|
|
||||||
## !! IMPORTANT UPGRADE NOTES !!
|
This is a fork from the Hoymiles project [OpenDTU](https://github.com/tbnobody/OpenDTU).
|
||||||
|
|
||||||
If you are upgrading from a version before 15.03.2023 you have to upgrade the partition table of the ESP32. Please follow the [this](docs/UpgradePartition.md) documentation!
|

|
||||||
|
|
||||||
## Background
|
[](https://github.com/helgeerbe/OpenDTU-OnBattery/actions/workflows/build.yml)
|
||||||
|
[](https://github.com/helgeerbe/OpenDTU-OnBattery/actions/workflows/cpplint.yml)
|
||||||
|
[](https://github.com/helgeerbe/OpenDTU-OnBattery/actions/workflows/yarnlint.yml)
|
||||||
|
|
||||||
This project was started from [this](https://www.mikrocontroller.net/topic/525778) discussion (Mikrocontroller.net).
|
## What is OpenDTU-onBattery
|
||||||
It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with their cloud access. With a lot of reverse engineering the Hoymiles protocol was decrypted and analyzed.
|
|
||||||
|
|
||||||
|
OpenDTU-onBattery is an extension of the original OpenDTU to support battery chargers, battery management systems (BMS) and power meters on a single esp32. With the help of a dynamic power limiter, the power production can be adjusted to the actual consumption. In this way, it is possible to come as close as possible to the goal of zero feed-in.
|
||||||
|
|
||||||
|
## History of the project
|
||||||
|
|
||||||
|
The original OpenDTU project was started from [this](https://www.mikrocontroller.net/topic/525778) discussion (Mikrocontroller.net). It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with their cloud access. With a lot of reverse engineering the Hoymiles protocol was decrypted and analyzed.
|
||||||
|
|
||||||
|
Summer 2022 I bought my Victron MPPT battery charger, and didn't like the idea to set up a separate esp32 to recieve the charger data. I decided to fork OpenDTU and extend it with battery charger support and a dynamic power limitter to my own needs. Hoping someone can make use of it.
|
||||||
|
|
||||||
|
## Highlights of OpenDTU-onBattery
|
||||||
|
|
||||||
|
This project is still under development and adds following features:
|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> In contrast to the original openDTU, with release 2023.05.23.post1 openDTU-onBattery supports only 5 inverters. Otherwise, there is not enough memory for the liveData view.
|
||||||
|
|
||||||
|
* Support Victron's Ve.Direct protocol on the same chip (cable based serial interface!). Additional information about Ve.direct can be downloaded directly from [Victron's website](https://www.victronenergy.com/support-and-downloads/technical-information).
|
||||||
|
* Dynamically sets the Hoymiles power limited according to the currently used energy in the household. Needs an HTTP JSON based power meter (e.g. Tasmota), an MQTT based power meter like Shelly 3EM or an SDM power meter.
|
||||||
|
* Battery support: Read the voltage from Victron MPPT charge controller or from the Hoymiles DC inputs and starts/stops the power producing based on configurable voltage thresholds
|
||||||
|
* Voltage correction that takes the voltage drop because of the current output load into account (not 100% reliable calculation)
|
||||||
|
* Can read the current solar panel power from the Victron MPPT and adjust the limiter accordingly to not save energy in the battery (for increased system efficiency). Increases the battery lifespan and reduces energy loses.
|
||||||
|
* Settings can be configured in the UI
|
||||||
|
* Pylontech Battery support (via CAN bus interface). Use the SOC for starting/stopping the power output and provide the battery data via MQTT (autodiscovery for home assistant is currently not supported). Pin Mapping is supported (default RX PIN 27, TX PIN 26). Actual no live view support for Pylontech Battery.
|
||||||
|
* Huawei R4850G2 power supply unit that can act as AC charger. Supports status shown on the web interface and options to set voltage and current limits on the web interface and via MQTT. Connection is done using CAN bus (needs to be separate from Pylontech CAN bus) via SN65HVD230 interface.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
The documentation can be found [here](https://tbnobody.github.io/OpenDTU-docs/).
|
[Full documentation of OpenDTU-onBattery extensions can be found at the project's wiki](https://github.com/helgeerbe/OpenDTU-OnBattery/wiki).
|
||||||
Please feel free to support and create a PR in [this](https://github.com/tbnobody/OpenDTU-docs) repository to make the documentation even better.
|
|
||||||
|
|
||||||
## Breaking changes
|
For documentation of openDTU core functionality I refer to the original [repo](https://github.com/tbnobody/OpenDTU) and its [wiki](https://github.com/tbnobody/OpenDTU/wiki).
|
||||||
|
|
||||||
Generated using: `git log --date=short --pretty=format:"* %h%x09%ad%x09%s" | grep BREAKING`
|
Please note that openDTU-onBattery may change significantly during its development.
|
||||||
|
Bug reports, comments, feature requests and fixes are most welcome!
|
||||||
|
|
||||||
```code
|
To find out what's new or improved have a look at the [changelog](https://github.com/helgeerbe/OpenDTU-OnBattery/releases).
|
||||||
* 1b637f08 2024-01-30 BREAKING CHANGE: Web API Endpoint /api/livedata/status and /api/prometheus/metrics
|
|
||||||
* e1564780 2024-01-30 BREAKING CHANGE: Web API Endpoint /api/livedata/status and /api/prometheus/metrics
|
|
||||||
* f0b5542c 2024-01-30 BREAKING CHANGE: Web API Endpoint /api/livedata/status and /api/prometheus/metrics
|
|
||||||
* c27ecc36 2024-01-29 BREAKING CHANGE: Web API Endpoint /api/livedata/status
|
|
||||||
* 71d1b3b 2023-11-07 BREAKING CHANGE: Home Assistant Auto Discovery to new naming scheme
|
|
||||||
* 04f62e0 2023-04-20 BREAKING CHANGE: Web API Endpoint /api/eventlog/status no nested serial object
|
|
||||||
* 59f43a8 2023-04-17 BREAKING CHANGE: Web API Endpoint /api/devinfo/status requires GET parameter inv=
|
|
||||||
* 318136d 2023-03-15 BREAKING CHANGE: Updated partition table: Make sure you have a configuration backup and completly reflash the device!
|
|
||||||
* 3b7aef6 2023-02-13 BREAKING CHANGE: Web API!
|
|
||||||
* d4c838a 2023-02-06 BREAKING CHANGE: Prometheus API!
|
|
||||||
* daf847e 2022-11-14 BREAKING CHANGE: Removed deprecated config parsing method
|
|
||||||
* 69b675b 2022-11-01 BREAKING CHANGE: Structure WebAPI /api/livedata/status changed
|
|
||||||
* 27ed4e3 2022-10-31 BREAKING: Change power factor from percent value to value between 0 and 1
|
|
||||||
```
|
|
||||||
|
|
||||||
## Currently supported Inverters
|
## Acknowledgment
|
||||||
|
|
||||||
A list of all currently supported inverters can be found [here](https://www.opendtu.solar/hardware/inverter_overview/)
|
A special Thank to Thomas Basler (tbnobody) the author of the original [OpenDTU](https://github.com/tbnobody/OpenDTU) project. You are doing a great job!
|
||||||
|
|
||||||
|
Last but not least, I would like to thank all the contributors. With your ideas and enhancements, you have made OpenDTU-onBattery much more than I originally had in mind.
|
||||||
|
|||||||
186
README_onBattery.md
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
# OpenDTU-OnBattery
|
||||||
|
|
||||||
|
This is a fork from the Hoymiles project [OpenDTU](https://github.com/tbnobody/OpenDTU). This project is still under development but is being used on a day to day basis as well.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> In contrast to the original openDTU, with release 2023.05.23.post1 openDTU-onBattery supports only 5 inverters. Otherwise, there is not enough memory for the liveData view.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Hoymiles inverter support for live data and display of various inverter internal information. (Partial) support for multiple inverters.
|
||||||
|
* MQTT support (with TLS) with partial Home Assistant MQTT Auto Discovery
|
||||||
|
* Automatic inverter power control of a selected Hoymiles inverter to compensate the currently used energy in the household.
|
||||||
|
* Energy meter support with interface options to HTTP JSON based power meters (e.g. Tasmota), MQTT based power meters (e.g. Shelly 3EM) or SDM power meters.
|
||||||
|
* Support for Victron MPPT charge controller using Ve.Direct. cf. Ve.direct: https://www.victronenergy.com/support-and-downloads/technical-information.
|
||||||
|
* Generic voltage based battery support using Victron MPPT charge controller or Hoymiles inverter voltage values to start / stop inverter power output. (with load compensation)
|
||||||
|
* Pylontech battery support via CAN bus interface. State of Charge reported by BMS is used to start / stop inverter power output. Battery data is exported via MQTT (no support for home assistant auto discovery).
|
||||||
|
* Support for Huawei R4850G2 power supply unit that can act as AC charging source. [Overview](https://www.beyondlogic.org/review-huawei-r4850g2-power-supply-53-5vdc-3kw/)
|
||||||
|
* Other features from [OpenDTU](https://github.com/tbnobody/OpenDTU) maintained
|
||||||
|
|
||||||
|
## Hardware
|
||||||
|
|
||||||
|
To get started with this project you will need to assemble a few hardware components that allow interfacing with the desired devices. What is needed depends on the use-case but may consist of:
|
||||||
|
|
||||||
|
* ESP32 board that contains the CPU and WIFI connectivity
|
||||||
|
* NRF24L01+ or CMT2300A radio board to interface with the inverter. Please check the list of the supported inverters below for the board needed.
|
||||||
|
* 3.3V / 5V logic level shifter to interface with the Victron MPPT charge controller
|
||||||
|
* SN65HVD230 CAN bus transceiver to interface with a Pylontech battery
|
||||||
|
* MCP2515 SPI / CAN bus transceiver to interface with the Huawei AC PSU
|
||||||
|
* Relais board + 3.3V / 5 V logic level shifter to switch the slot detect on the Huawei AC PSU
|
||||||
|
* Display [Display](docs/Display.md)
|
||||||
|
|
||||||
|
More detailed information on the hardware can be found in the [Hardware and flashing](docs/hardware_flash.md) document.
|
||||||
|
|
||||||
|
### Currently supported Inverters
|
||||||
|
|
||||||
|
| Model | Required RF Module | DC Inputs | MPP-Tracker | AC Phases |
|
||||||
|
| --------------------| ------------------ | --------- | ----------- | --------- |
|
||||||
|
| Hoymiles HM-300 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HM-350 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HM-400 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HM-600 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HM-700 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HM-800 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HM-1000 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
| Hoymiles HM-1200 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
| Hoymiles HM-1500 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-300 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-350 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-400 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-450 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-500 | CMT2300A | 1 | 1 | 1 |
|
||||||
|
| Hoymiles HMS-600 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-700 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-800 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-900 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-1000 | CMT2300A | 2 | 2 | 1 |
|
||||||
|
| Hoymiles HMS-1600 | CMT2300A | 4 | 4 | 1 |
|
||||||
|
| Hoymiles HMS-1800 | CMT2300A | 4 | 4 | 1 |
|
||||||
|
| Hoymiles HMS-2000 | CMT2300A | 4 | 4 | 1 |
|
||||||
|
| Hoymiles HMT-1800 | CMT2300A | 6 | 3 | 3 |
|
||||||
|
| Hoymiles HMT-2250 | CMT2300A | 6 | 3 | 3 |
|
||||||
|
| Solenso SOL-H350 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Solenso SOL-H400 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| Solenso SOL-H800 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| TSUN TSOL-M350 | NRF24L01+ | 1 | 1 | 1 |
|
||||||
|
| TSUN TSOL-M800 | NRF24L01+ | 2 | 2 | 1 |
|
||||||
|
| TSUN TSOL-M1600 | NRF24L01+ | 4 | 2 | 1 |
|
||||||
|
|
||||||
|
**TSUN compatibility remark:**
|
||||||
|
Compatibility with OpenDTU is most likely related to the serial number of the inverter. Current findings indicate that TSUN inverters with a serial number starting with "11" are supported, whereby inverters with a serial number starting with "10" are not.
|
||||||
|
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
Several screenshots of the frontend can be found here: [Screenshots](docs/screenshots/README.md)
|
||||||
|
|
||||||
|
## Configuration and usage
|
||||||
|
|
||||||
|
### First configuration
|
||||||
|
|
||||||
|
* After the [initial flashing](docs/hardware_flash.md#flashing-and-starting-up) of the microcontroller, an Access Point called "OpenDTU-*" is opened. The default password is "openDTU42".
|
||||||
|
* Use a web browser to open the address [http://192.168.4.1](http://192.168.4.1)
|
||||||
|
* Navigate to Settings --> Network Settings and enter your WiFi credentials. The username to access the config menu is "admin" and the password the same as for accessing the Access Point (default: "openDTU42").
|
||||||
|
* OpenDTU then simultaneously connects to your WiFi AP with these credentials. Navigate to Info --> Network and look into section "Network Interface (Station)" for the IP address received via DHCP.
|
||||||
|
* If your WiFi AP uses an allow-list for MAC-addresses, please be aware that the ESP32 has two different MAC addresses for its AP and client modes, they are also listed at Info --> Network.
|
||||||
|
* When OpenDTU is connected to a configured WiFI AP, the "OpenDTU-*" Access Point is closed after 3 minutes.
|
||||||
|
* OpenDTU needs access to a working NTP server to get the current date & time. Both are sent to the inverter with each request. Default NTP server is pool.ntp.org. If your network has different requirements please change accordingly (Settings --> NTP Settings).
|
||||||
|
* Activate Ve.direct, Battery and the AC Charger according to the available hardware
|
||||||
|
* Configure a Power Meter to provide a data source for the current consumption
|
||||||
|
* Configure the Dynamic Power Limiter according to the used battery. Documentation about the power limiter interface and states can be found below.
|
||||||
|
* If desired connect to a home automation system using MQTT or the Webapi.
|
||||||
|
* A documentation of all available MQTT Topics can be found here: [MQTT Documentation](docs/MQTT_Topics.md)
|
||||||
|
* A documentation of the Web API can be found here: [Web-API Documentation](docs/Web-API.md)
|
||||||
|
* Home Assistant auto discovery is supported. [Example image](https://user-images.githubusercontent.com/59169507/217558862-a83846c5-6070-43cd-9a0b-90a8b2e2e8c6.png)
|
||||||
|
|
||||||
|
### Huawei PSU
|
||||||
|
|
||||||
|
The Huawei PSU can be used to charge a battery. This can be be useful if an external (AC) connected solar system shall be utilized or if variable energy prices should be exploited.
|
||||||
|
|
||||||
|
Some points for consideration are:
|
||||||
|
* Make sure to consider the PSU voltage range when selecting the battery voltage as lower voltages <42V are not supported.
|
||||||
|
* The PSU runs a noisy fan and it is therefore desireable to switch it off when not being used. Some users have found that switching the slot detect pins with a relay accomplishes this. A GPIO pin is made available from the ESP to turn the PSU on/off
|
||||||
|
|
||||||
|
#### Operation modes
|
||||||
|
|
||||||
|
openDTU-onBattery supports three operation modes for the Huawei PSU:
|
||||||
|
1. Fully manual - In this mode the PSU needs to be turned on/off externally using MQTT and voltage and current limits need to be provided. See [MQTT Documentation](docs/MQTT_Topics.md) for details on these commands
|
||||||
|
2. Manual with auto power on / off - In this mode the PSU is turned on when a current limit > 1A is set. If the current limit is < 1A for some time the PSU is turned off. Current and voltage limits need to be provided externally using MQTT. See [MQTT Documentation](docs/MQTT_Topics.md) for details on these commands.
|
||||||
|
3. Automatic - In this mode the PSU power is controlled by the Power Meter and information provided in the web-interface. If excess power is present the PSU is turned on. The voltage limit is set as per web-interface and the current limit is set so that the maximum PSU output power equals the Power Meter value. Minium and maximum PSU power levels as configured in the web-interface are respected in this process. The PSU is turned off if the output current is limited and the output power drops below the minium power level. This will disable automatic mode until the battery is discharged below the start voltage level (set in the web-interface). This mode can be enabled using the web-interface and MQTT. See [MQTT Documentation](docs/MQTT_Topics.md)
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
* First: When there is no light on the solar panels, the inverter completely turns off and does not answer to OpenDTU! So if you assembled your OpenDTU in the evening, wait until tomorrow.
|
||||||
|
* When there is no data received from the inverter(s) - try to reduce the distance between the openDTU and the inverter (e.g. move it to the window towards the roof)
|
||||||
|
* Under Settings -> DTU Settings you can increase the transmit power "PA level". Default is "minimum".
|
||||||
|
* The NRF24L01+ needs relatively much current. With bad power supply (and especially bad cables!) a 10 µF capacitor soldered directly to the NRF24L01+ board connector brings more stability (pin 1+2 are the power supply). Note the polarity of the capacitor…
|
||||||
|
* You can try to use an USB power supply with 1 A or more instead of connecting the ESP32 to the computer.
|
||||||
|
* Try a different USB cable. Once again, a stable power source is important. Some USB cables are made of much plastic and very little copper inside.
|
||||||
|
* Double check that you have a radio module NRF24L01+ with a plus sign at the end. NRF24L01 module without the plus are not compatible with this project.
|
||||||
|
* There is no possibility of auto-discovering the inverters. Double check you have entered the serial numbers of the inverters correctly.
|
||||||
|
* OpenDTU needs access to a working NTP server to get the current date & time.
|
||||||
|
* If your problem persists, check the [Issues on Github](https://github.com/tbnobody/OpenDTU/issues). Please inspect not only the open issues, also the closed issues contain useful information.
|
||||||
|
* Another source of information are the [Discussions](https://github.com/tbnobody/OpenDTU/discussions/)
|
||||||
|
* When flashing with VSCode Plattform.IO fails and also with ESPRESSIF tool a demo bin file cannot be flashed to the ESP32 with error message "A fatal error occurred: MD5 of file does not match data in flash!" than un-wire/unconnect ESP32 from the NRF24L01+ board. Try to flash again and rewire afterwards.
|
||||||
|
|
||||||
|
## Background
|
||||||
|
|
||||||
|
This project was started from [this](https://www.mikrocontroller.net/topic/525778) discussion (Mikrocontroller.net).
|
||||||
|
It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with their cloud access. With a lot of reverse engineering the Hoymiles protocol was decrypted and analyzed.
|
||||||
|
|
||||||
|
## Features for developers
|
||||||
|
|
||||||
|
### Status
|
||||||
|
|
||||||
|
[](https://github.com/helgeerbe/OpenDTU-OnBattery/actions/workflows/build.yml)
|
||||||
|
[](https://github.com/helgeerbe/OpenDTU-OnBattery/actions/workflows/cpplint.yml)
|
||||||
|
[](https://github.com/helgeerbe/OpenDTU-OnBattery/actions/workflows/yarnlint.yml)
|
||||||
|
|
||||||
|
### Core technologies used
|
||||||
|
|
||||||
|
* The microcontroller part
|
||||||
|
* Build with Arduino PlatformIO Framework for the ESP32
|
||||||
|
* Uses a fork of [ESPAsyncWebserver](https://github.com/yubox-node-org/ESPAsyncWebServer) and [espMqttClient](https://github.com/bertmelis/espMqttClient)
|
||||||
|
|
||||||
|
* The WebApp part
|
||||||
|
* Build with [Vue.js](https://vuejs.org)
|
||||||
|
* Source is written in TypeScript
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
Generated using: `git log --date=short --pretty=format:"* %h%x09%ad%x09%s" | grep BREAKING`
|
||||||
|
|
||||||
|
```code
|
||||||
|
* 59f43a8 2023-04-17 BREAKING CHANGE: Web API Endpoint /api/devinfo/status requires GET parameter inv=
|
||||||
|
* 318136d 2023-03-15 BREAKING CHANGE: Updated partition table: Make sure you have a configuration backup and completly reflash the device!
|
||||||
|
* 3b7aef6 2023-02-13 BREAKING CHANGE: Web API!
|
||||||
|
* d4c838a 2023-02-06 BREAKING CHANGE: Prometheus API!
|
||||||
|
* daf847e 2022-11-14 BREAKING CHANGE: Removed deprecated config parsing method
|
||||||
|
* 69b675b 2022-11-01 BREAKING CHANGE: Structure WebAPI /api/livedata/status changed
|
||||||
|
* 27ed4e3 2022-10-31 BREAKING: Change power factor from percent value to value between 0 and 1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
* Building the WebApp
|
||||||
|
* The WebApp can be build using yarn
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd webapp
|
||||||
|
yarn install
|
||||||
|
yarn build
|
||||||
|
```
|
||||||
|
|
||||||
|
* The updated output is placed in the 'webapp_dist' directory
|
||||||
|
* It is only necessary to build the webapp when you made changes to it
|
||||||
|
* Building the microcontroller firmware
|
||||||
|
* Visual Studio Code with the PlatformIO Extension is required for building
|
||||||
|
|
||||||
|
## Related Projects
|
||||||
|
|
||||||
|
* [Ahoy](https://github.com/grindylow/ahoy)
|
||||||
|
* [DTU Simulator](https://github.com/Ziyatoe/DTUsimMI1x00-Hoymiles)
|
||||||
|
* [OpenDTU extended to talk to Victrons MPPT battery chargers (Ve.Direct)](https://github.com/helgeerbe/OpenDTU_VeDirect)
|
||||||
@ -1,3 +1,91 @@
|
|||||||
# Device Profiles
|
# Device Profiles
|
||||||
|
|
||||||
This documentation will has been moved and can be found here: <https://tbnobody.github.io/OpenDTU-docs/firmware/device_profiles/>
|
This documentation will has been moved and can be found here: <https://tbnobody.github.io/OpenDTU-docs/firmware/device_profiles/>
|
||||||
|
|
||||||
|
## Structure of the json file for openDTU-onBattery (outdated example)
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Generic NodeMCU 38 pin",
|
||||||
|
"nrf24": {
|
||||||
|
"miso": 19,
|
||||||
|
"mosi": 23,
|
||||||
|
"clk": 18,
|
||||||
|
"irq": 16,
|
||||||
|
"en": 4,
|
||||||
|
"cs": 5
|
||||||
|
},
|
||||||
|
"victron": {
|
||||||
|
"rx": 22,
|
||||||
|
"tx": 21
|
||||||
|
},
|
||||||
|
"battery": {
|
||||||
|
"rx": 27,
|
||||||
|
"tx": 14
|
||||||
|
},
|
||||||
|
"huawei": {
|
||||||
|
"miso": 12,
|
||||||
|
"mosi": 13,
|
||||||
|
"clk": 26,
|
||||||
|
"irq": 25,
|
||||||
|
"power": 33,
|
||||||
|
"cs": 15
|
||||||
|
},
|
||||||
|
"eth": {
|
||||||
|
"enabled": false,
|
||||||
|
"phy_addr": -1,
|
||||||
|
"power": -1,
|
||||||
|
"mdc": -1,
|
||||||
|
"mdio": -1,
|
||||||
|
"type": -1,
|
||||||
|
"clk_mode": -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Generic NodeMCU 38 pin with SSD1306",
|
||||||
|
"nrf24": {
|
||||||
|
"miso": 19,
|
||||||
|
"mosi": 23,
|
||||||
|
"clk": 18,
|
||||||
|
"irq": 16,
|
||||||
|
"en": 4,
|
||||||
|
"cs": 5
|
||||||
|
},
|
||||||
|
"eth": {
|
||||||
|
"enabled": false,
|
||||||
|
"phy_addr": -1,
|
||||||
|
"power": -1,
|
||||||
|
"mdc": -1,
|
||||||
|
"mdio": -1,
|
||||||
|
"type": -1,
|
||||||
|
"clk_mode": -1
|
||||||
|
},
|
||||||
|
"display": {
|
||||||
|
"type": 2,
|
||||||
|
"data": 21,
|
||||||
|
"clk": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Olimex ESP32-POE",
|
||||||
|
"nrf24": {
|
||||||
|
"miso": 15,
|
||||||
|
"mosi": 2,
|
||||||
|
"clk": 14,
|
||||||
|
"irq": 13,
|
||||||
|
"en": 16,
|
||||||
|
"cs": 5
|
||||||
|
},
|
||||||
|
"eth": {
|
||||||
|
"enabled": true,
|
||||||
|
"phy_addr": 0,
|
||||||
|
"power": 12,
|
||||||
|
"mdc": 23,
|
||||||
|
"mdio": 18,
|
||||||
|
"type": 0,
|
||||||
|
"clk_mode": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
@ -1,76 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"name": "AhoyDTU ESP32 Display LED",
|
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 19,
|
|
||||||
"mosi": 23,
|
|
||||||
"clk": 18,
|
|
||||||
"irq": 16,
|
|
||||||
"en": 4,
|
|
||||||
"cs": 5
|
|
||||||
},
|
|
||||||
"led": {
|
|
||||||
"led0": 25,
|
|
||||||
"led1": 26
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 2,
|
|
||||||
"data": 21,
|
|
||||||
"clk": 22
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "AhoyDTU ESP32 Display",
|
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 19,
|
|
||||||
"mosi": 23,
|
|
||||||
"clk": 18,
|
|
||||||
"irq": 16,
|
|
||||||
"en": 4,
|
|
||||||
"cs": 5
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 2,
|
|
||||||
"data": 21,
|
|
||||||
"clk": 22
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "AhoyDTU ESP32 LED",
|
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 19,
|
|
||||||
"mosi": 23,
|
|
||||||
"clk": 18,
|
|
||||||
"irq": 16,
|
|
||||||
"en": 4,
|
|
||||||
"cs": 5
|
|
||||||
},
|
|
||||||
"led": {
|
|
||||||
"led0": 25,
|
|
||||||
"led1": 26
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "AhoyDTU ESP32",
|
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://ahoydtu.de/getting_started/"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 19,
|
|
||||||
"mosi": 23,
|
|
||||||
"clk": 18,
|
|
||||||
"irq": 16,
|
|
||||||
"en": 4,
|
|
||||||
"cs": 5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"name": "LILYGO T-ETH-Lite-POE CMT",
|
|
||||||
"links": [
|
|
||||||
{"name": "Datasheet", "url": "https://www.lilygo.cc/products/t-eth-lite"}
|
|
||||||
],
|
|
||||||
"eth": {
|
|
||||||
"enabled": true,
|
|
||||||
"phy_addr": 0,
|
|
||||||
"power": 12,
|
|
||||||
"mdc": 23,
|
|
||||||
"mdio": 18,
|
|
||||||
"type": 2,
|
|
||||||
"clk_mode": 0
|
|
||||||
},
|
|
||||||
"cmt": {
|
|
||||||
"clk": 15,
|
|
||||||
"cs": 32,
|
|
||||||
"fcs": 33,
|
|
||||||
"sdio": 4
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "LILYGO T-ETH-Lite-POE NRF24",
|
|
||||||
"links": [
|
|
||||||
{"name": "Datasheet", "url": "https://www.lilygo.cc/products/t-eth-lite"}
|
|
||||||
],
|
|
||||||
"eth": {
|
|
||||||
"enabled": true,
|
|
||||||
"phy_addr": 0,
|
|
||||||
"power": 12,
|
|
||||||
"mdc": 23,
|
|
||||||
"mdio": 18,
|
|
||||||
"type": 2,
|
|
||||||
"clk_mode": 0
|
|
||||||
},
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 34,
|
|
||||||
"mosi": 13,
|
|
||||||
"clk": 14,
|
|
||||||
"irq": 35,
|
|
||||||
"en": 4,
|
|
||||||
"cs": 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "LILYGO T-ETH-Lite-POE NRF24 + Display",
|
|
||||||
"links": [
|
|
||||||
{"name": "Datasheet", "url": "https://www.lilygo.cc/products/t-eth-lite"}
|
|
||||||
],
|
|
||||||
"eth": {
|
|
||||||
"enabled": true,
|
|
||||||
"phy_addr": 0,
|
|
||||||
"power": 12,
|
|
||||||
"mdc": 23,
|
|
||||||
"mdio": 18,
|
|
||||||
"type": 2,
|
|
||||||
"clk_mode": 0
|
|
||||||
},
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 34,
|
|
||||||
"mosi": 13,
|
|
||||||
"clk": 14,
|
|
||||||
"irq": 35,
|
|
||||||
"en": 4,
|
|
||||||
"cs": 2
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 3,
|
|
||||||
"data": 32,
|
|
||||||
"clk": 33
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"name": "Olimex ESP32-Gateway",
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 14,
|
|
||||||
"mosi": 13,
|
|
||||||
"clk": 12,
|
|
||||||
"irq": 15,
|
|
||||||
"en": 2,
|
|
||||||
"cs": 4
|
|
||||||
},
|
|
||||||
"eth": {
|
|
||||||
"enabled": true,
|
|
||||||
"phy_addr": 0,
|
|
||||||
"power": 12,
|
|
||||||
"mdc": 23,
|
|
||||||
"mdio": 18,
|
|
||||||
"type": 0,
|
|
||||||
"clk_mode": 3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Olimex ESP32-Gateway with SSH1106",
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 14,
|
|
||||||
"mosi": 13,
|
|
||||||
"clk": 12,
|
|
||||||
"irq": 15,
|
|
||||||
"en": 2,
|
|
||||||
"cs": 4
|
|
||||||
},
|
|
||||||
"eth": {
|
|
||||||
"enabled": true,
|
|
||||||
"phy_addr": 0,
|
|
||||||
"power": 12,
|
|
||||||
"mdc": 23,
|
|
||||||
"mdio": 18,
|
|
||||||
"type": 0,
|
|
||||||
"clk_mode": 3
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 3,
|
|
||||||
"data": 32,
|
|
||||||
"clk": 16
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@ -1,9 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "OpenDTU Fusion v1",
|
"name": "OpenDTU Fusion v1",
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
"nrf24": {
|
||||||
"miso": 48,
|
"miso": 48,
|
||||||
"mosi": 35,
|
"mosi": 35,
|
||||||
@ -28,9 +25,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OpenDTU Fusion v1 with SSD1306 Display",
|
"name": "OpenDTU Fusion v1 with SSD1306 Display",
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
"nrf24": {
|
||||||
"miso": 48,
|
"miso": 48,
|
||||||
"mosi": 35,
|
"mosi": 35,
|
||||||
@ -60,9 +54,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OpenDTU Fusion v1 with SH1106 Display",
|
"name": "OpenDTU Fusion v1 with SH1106 Display",
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
"nrf24": {
|
||||||
"miso": 48,
|
"miso": 48,
|
||||||
"mosi": 35,
|
"mosi": 35,
|
||||||
@ -92,9 +83,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OpenDTU Fusion v2 with CMT2300A and NRF24",
|
"name": "OpenDTU Fusion v2 with CMT2300A and NRF24",
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
"nrf24": {
|
||||||
"miso": 48,
|
"miso": 48,
|
||||||
"mosi": 35,
|
"mosi": 35,
|
||||||
@ -127,9 +115,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OpenDTU Fusion v2 with CMT2300A, NRF24 and SH1106 Display",
|
"name": "OpenDTU Fusion v2 with CMT2300A, NRF24 and SH1106 Display",
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
"nrf24": {
|
||||||
"miso": 48,
|
"miso": 48,
|
||||||
"mosi": 35,
|
"mosi": 35,
|
||||||
@ -167,9 +152,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OpenDTU Fusion v2 with CMT2300A, NRF24 and SSD1306 Display",
|
"name": "OpenDTU Fusion v2 with CMT2300A, NRF24 and SSD1306 Display",
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
"nrf24": {
|
||||||
"miso": 48,
|
"miso": 48,
|
||||||
"mosi": 35,
|
"mosi": 35,
|
||||||
@ -204,122 +186,5 @@
|
|||||||
"data": 2,
|
"data": 2,
|
||||||
"clk": 1
|
"clk": 1
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "OpenDTU Fusion v2 PoE",
|
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 48,
|
|
||||||
"mosi": 35,
|
|
||||||
"clk": 36,
|
|
||||||
"irq": 47,
|
|
||||||
"en": 38,
|
|
||||||
"cs": 37
|
|
||||||
},
|
|
||||||
"cmt": {
|
|
||||||
"clk": 6,
|
|
||||||
"cs": 4,
|
|
||||||
"fcs": 21,
|
|
||||||
"sdio": 5,
|
|
||||||
"gpio2": 3,
|
|
||||||
"gpio3": 8
|
|
||||||
},
|
|
||||||
"w5500": {
|
|
||||||
"mosi": 40,
|
|
||||||
"miso": 41,
|
|
||||||
"sclk": 39,
|
|
||||||
"cs": 42,
|
|
||||||
"int": 44,
|
|
||||||
"rst": 43
|
|
||||||
},
|
|
||||||
"led": {
|
|
||||||
"led0": 17,
|
|
||||||
"led1": 18
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 0,
|
|
||||||
"data": 2,
|
|
||||||
"clk": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "OpenDTU Fusion v2 PoE with SH1106 Display",
|
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 48,
|
|
||||||
"mosi": 35,
|
|
||||||
"clk": 36,
|
|
||||||
"irq": 47,
|
|
||||||
"en": 38,
|
|
||||||
"cs": 37
|
|
||||||
},
|
|
||||||
"cmt": {
|
|
||||||
"clk": 6,
|
|
||||||
"cs": 4,
|
|
||||||
"fcs": 21,
|
|
||||||
"sdio": 5,
|
|
||||||
"gpio2": 3,
|
|
||||||
"gpio3": 8
|
|
||||||
},
|
|
||||||
"w5500": {
|
|
||||||
"mosi": 40,
|
|
||||||
"miso": 41,
|
|
||||||
"sclk": 39,
|
|
||||||
"cs": 42,
|
|
||||||
"int": 44,
|
|
||||||
"rst": 43
|
|
||||||
},
|
|
||||||
"led": {
|
|
||||||
"led0": 17,
|
|
||||||
"led1": 18
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 3,
|
|
||||||
"data": 2,
|
|
||||||
"clk": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "OpenDTU Fusion v2 PoE with SSD1306 Display",
|
|
||||||
"links": [
|
|
||||||
{"name": "Information", "url": "https://github.com/markusdd/OpenDTUFusionDocs"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 48,
|
|
||||||
"mosi": 35,
|
|
||||||
"clk": 36,
|
|
||||||
"irq": 47,
|
|
||||||
"en": 38,
|
|
||||||
"cs": 37
|
|
||||||
},
|
|
||||||
"cmt": {
|
|
||||||
"clk": 6,
|
|
||||||
"cs": 4,
|
|
||||||
"fcs": 21,
|
|
||||||
"sdio": 5,
|
|
||||||
"gpio2": 3,
|
|
||||||
"gpio3": 8
|
|
||||||
},
|
|
||||||
"w5500": {
|
|
||||||
"mosi": 40,
|
|
||||||
"miso": 41,
|
|
||||||
"sclk": 39,
|
|
||||||
"cs": 42,
|
|
||||||
"int": 44,
|
|
||||||
"rst": 43
|
|
||||||
},
|
|
||||||
"led": {
|
|
||||||
"led0": 17,
|
|
||||||
"led1": 18
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 2,
|
|
||||||
"data": 2,
|
|
||||||
"clk": 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -22,34 +22,6 @@
|
|||||||
"clk_mode": 0
|
"clk_mode": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "WT32-ETH01 with SH1106",
|
|
||||||
"links": [
|
|
||||||
{"name": "Datasheet", "url": "http://www.wireless-tag.com/portfolio/wt32-eth01/"}
|
|
||||||
],
|
|
||||||
"nrf24": {
|
|
||||||
"miso": 4,
|
|
||||||
"mosi": 2,
|
|
||||||
"clk": 32,
|
|
||||||
"irq": 33,
|
|
||||||
"en": 14,
|
|
||||||
"cs": 15
|
|
||||||
},
|
|
||||||
"eth": {
|
|
||||||
"enabled": true,
|
|
||||||
"phy_addr": 1,
|
|
||||||
"power": 16,
|
|
||||||
"mdc": 23,
|
|
||||||
"mdio": 18,
|
|
||||||
"type": 0,
|
|
||||||
"clk_mode": 0
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"type": 3,
|
|
||||||
"data": 5,
|
|
||||||
"clk": 17
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "WT32-ETH01 with SSD1306",
|
"name": "WT32-ETH01 with SSD1306",
|
||||||
"links": [
|
"links": [
|
||||||
@ -106,4 +78,4 @@
|
|||||||
"clk": 17
|
"clk": 17
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1,3 +1,20 @@
|
|||||||
# Display integration
|
# Display integration
|
||||||
|
|
||||||
This documentation will has been moved and can be found here: <https://tbnobody.github.io/OpenDTU-docs/hardware/display/>
|
OpenDTU currently supports 3 types of displays (SSD1306, SH1106 and PCD8544). Currently only displays with a resolution of 128x64 pixel are supported. To activate a display you have to specify it's type and pin assignment either in the `platformio_override.ini` or in a device profile. Due to the fact that device profiles work with the pre-compiled binary the following documentation will only cover the device profile method.
|
||||||
|
|
||||||
|
You can either create your own device profile as described [here](DeviceProfiles.md) or use some pre-defined. The pre-defined profiles can be found [here](DeviceProfiles/). You can simply open the json file with a text editor of your choice to view/edit the pin assignment.
|
||||||
|
|
||||||
|
## Uploading Device Profiles
|
||||||
|
|
||||||
|
Use the "Config Management" site to upload (Restore) the json file. Make sure to choose "Pin Mapping (pin_mapping.json)" in the combo box. After you click on restore the ESP will restart. At this point, the profile is not yet active. Please read the next chapter.
|
||||||
|

|
||||||
|
|
||||||
|
## Selecting a Device Profile
|
||||||
|
|
||||||
|
After you uploaded the device profile you can select the profile in the "Device Manager" view. After a click on "Save" the ESP will be restarted and the pin assignment is active. At this point the display should already show something. Please see the next chapter for display settings.
|
||||||
|

|
||||||
|
|
||||||
|
## Display Settings
|
||||||
|
|
||||||
|
Display settings can also be found in the "Device Manager".
|
||||||
|

|
||||||
275
docs/PowerLimiterInverterStates.drawio
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
<mxfile host="65bd71144e">
|
||||||
|
<diagram name="Page-1" id="b5b7bab2-c9e2-2cf4-8b2a-24fd1a2a6d21">
|
||||||
|
<mxGraphModel dx="1370" dy="985" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="none" math="0" shadow="0">
|
||||||
|
<root>
|
||||||
|
<mxCell id="0"/>
|
||||||
|
<mxCell id="1" parent="0"/>
|
||||||
|
<mxCell id="6e0c8c40b5770093-72" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=194;tabHeight=22;tabPosition=left;html=1;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeWidth=1;fillColor=none;fontFamily=Verdana;fontSize=10;align=center;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="150" y="114.5" width="1090" height="1065.5" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="6e0c8c40b5770093-73" value="<div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 12px; line-height: 18px;"><span style="color: #4ec9b0;">PowerLimiterClass</span>::<span style="color: #dcdcaa;">loop</span>()</div>" style="text;html=1;align=left;verticalAlign=top;spacingTop=-4;fontSize=10;fontFamily=Verdana" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="150" y="114.5" width="130" height="20" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="sqCMRMHiXPc9LqBIY9SA-1" value="" style="ellipse;html=1;shape=startState;fillColor=#000000;strokeColor=#ff0000;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="475" y="50" width="30" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="sqCMRMHiXPc9LqBIY9SA-2" value="discover state on initial call or after enabling powerLimiter" style="html=1;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="sqCMRMHiXPc9LqBIY9SA-1" target="2" edge="1">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="205" y="370" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="sqCMRMHiXPc9LqBIY9SA-6" value="<p style="margin:0px;margin-top:4px;text-align:center;">STATE_OFF</p><hr><p></p><p style="margin:0px;margin-left:8px;text-align:left;">entry / stop inverter, limit lower limit<br>do / nothing<br>exit / nothing</p>" style="shape=mxgraph.sysml.simpleState;html=1;overflow=fill;whiteSpace=wrap;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="170" y="585" width="200" height="100" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="sqCMRMHiXPc9LqBIY9SA-7" value="<p style="margin:0px;margin-top:4px;text-align:center;">STATE_CONSUME_SOLAR_POWER_ONLY</p><hr><p></p><p style="margin:0px;margin-left:8px;text-align:left;">entry /<br>do / setNewLimit<br>exit /</p>" style="shape=mxgraph.sysml.simpleState;html=1;overflow=fill;whiteSpace=wrap;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="525" y="590" width="270" height="90" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="sqCMRMHiXPc9LqBIY9SA-8" value="<p style="margin:0px;margin-top:4px;text-align:center;">STATE_NORMAL_OPERATION</p><hr><p></p><p style="margin:0px;margin-left:8px;text-align:left;">entry /<br>do / setNewLimit<br>exit /</p>" style="shape=mxgraph.sysml.simpleState;html=1;overflow=fill;whiteSpace=wrap;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="970" y="585" width="200" height="100" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="2" value="<p style="margin:0px;margin-top:4px;text-align:center;">STATE_DISOVER</p><hr><p></p><p style="margin:0px;margin-left:8px;text-align:left;">entry /&nbsp;<br>do / nothing<br>exit /&nbsp;</p>" style="shape=mxgraph.sysml.simpleState;html=1;overflow=fill;whiteSpace=wrap;align=center;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="390" y="180" width="200" height="100" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="5" value="" style="shape=ellipse;html=1;dashed=0;whitespace=wrap;aspect=fixed;strokeWidth=5;perimeter=ellipsePerimeter;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="414" y="780" width="30" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="7" value="<p><span style="font-size: 11px; background-color: rgb(255, 255, 255);">!Inverter-&gt;isProducing || isStopThresholdReached</span></p>" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="425" y="300" width="130" height="130" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="10" value="<span style="font-size: 11px; background-color: rgb(255, 255, 255);">canUseDirectSolarPower</span>" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="595" y="390" width="130" height="120" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="11" value="" style="endArrow=classic;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="10" target="sqCMRMHiXPc9LqBIY9SA-7" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="620" y="540" as="sourcePoint"/>
|
||||||
|
<mxPoint x="670" y="490" as="targetPoint"/>
|
||||||
|
<Array as="points"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="20" value="yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="11" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="0.075" y="1" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="12" value="" style="endArrow=classic;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="2" target="7" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="484" y="280" as="sourcePoint"/>
|
||||||
|
<mxPoint x="420" y="220" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="13" value="" style="endArrow=classic;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryPerimeter=0;" parent="1" source="7" target="sqCMRMHiXPc9LqBIY9SA-6" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="570" y="290" as="sourcePoint"/>
|
||||||
|
<mxPoint x="400" y="330" as="targetPoint"/>
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="270" y="365"/>
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="14" value="yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="13" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="0.3049" relative="1" as="geometry">
|
||||||
|
<mxPoint x="80" y="-105" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="15" value="" style="endArrow=classic;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="7" target="10" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="360" y="370" as="sourcePoint"/>
|
||||||
|
<mxPoint x="280" y="595" as="targetPoint"/>
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="660" y="365"/>
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="16" value="no" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="15" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="0.3049" relative="1" as="geometry">
|
||||||
|
<mxPoint x="-45" y="-15" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18" value="" style="endArrow=classic;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;edgeStyle=orthogonalEdgeStyle;" parent="1" source="10" target="sqCMRMHiXPc9LqBIY9SA-8" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="760" y="340" as="sourcePoint"/>
|
||||||
|
<mxPoint x="810" y="290" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="19" value="no" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="18" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="0.142" y="2" relative="1" as="geometry">
|
||||||
|
<mxPoint x="-239" y="-8" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="21" value="isStopThresholdReached" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="220" y="730" width="130" height="130" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="22" value="" style="endArrow=classic;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="21" target="24" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="620" y="540" as="sourcePoint"/>
|
||||||
|
<mxPoint x="670" y="490" as="targetPoint"/>
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="285" y="995"/>
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="31" value="no" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="22" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.702" y="1" relative="1" as="geometry">
|
||||||
|
<mxPoint x="39" y="91" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="23" value="" style="endArrow=classic;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.581;exitY=0.998;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="sqCMRMHiXPc9LqBIY9SA-6" target="21" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="480" y="810" as="sourcePoint"/>
|
||||||
|
<mxPoint x="530" y="760" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="41" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="24" target="25">
|
||||||
|
<mxGeometry relative="1" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="42" value="no" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="41">
|
||||||
|
<mxGeometry x="0.36" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="24" value="canUseDirectSolarPower" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="600" y="930" width="130" height="130" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="25" value="isStartThresholdReached" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="830" y="930" width="130" height="130" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="29" value="" style="endArrow=classic;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="21" target="5" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="350" y="830" as="sourcePoint"/>
|
||||||
|
<mxPoint x="400" y="780" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="30" value="yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="29" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.1" relative="1" as="geometry">
|
||||||
|
<mxPoint x="3" y="-15" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-38" value="" style="endArrow=classic;html=1;rounded=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="sqCMRMHiXPc9LqBIY9SA-7" target="sqCMRMHiXPc9LqBIY9SA-6" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="570" y="820" as="sourcePoint"/>
|
||||||
|
<mxPoint x="620" y="770" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-39" value="isStopThresholdReached ||<br>(!canUseDirectSolarPower <br>&amp;&amp; EMPTY_WHEN_FULL)" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="JKiNQljIdbqBsyxyxwz1-38" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.2129" y="-2" relative="1" as="geometry">
|
||||||
|
<mxPoint x="-14" y="-33" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-40" value="isStartThresholdReached ||<br style="border-color: var(--border-color);">(!canUseDirectSolarPower<br style="border-color: var(--border-color);">&amp;&amp; EMPTY_AT_NIGHT)" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="sqCMRMHiXPc9LqBIY9SA-7" target="sqCMRMHiXPc9LqBIY9SA-8" edge="1">
|
||||||
|
<mxGeometry x="-0.0286" y="25" width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="570" y="560" as="sourcePoint"/>
|
||||||
|
<mxPoint x="620" y="510" as="targetPoint"/>
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-41" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.22;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.354;exitY=1.025;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="sqCMRMHiXPc9LqBIY9SA-8" target="sqCMRMHiXPc9LqBIY9SA-6" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="1040" y="680" as="sourcePoint"/>
|
||||||
|
<mxPoint x="890" y="750" as="targetPoint"/>
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="1040" y="1070"/>
|
||||||
|
<mxPoint x="214" y="1070"/>
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-42" value="isStopThresholdReached ||" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="JKiNQljIdbqBsyxyxwz1-41" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.2129" y="-2" relative="1" as="geometry">
|
||||||
|
<mxPoint x="-151" y="32" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-43" value="" style="shape=ellipse;html=1;dashed=0;whitespace=wrap;aspect=fixed;strokeWidth=5;perimeter=ellipsePerimeter;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1055" y="799.7" width="30" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-44" value="" style="endArrow=classic;html=1;exitX=0.82;exitY=1.003;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitPerimeter=0;" parent="1" target="JKiNQljIdbqBsyxyxwz1-43" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="1069.0000000000002" y="685" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1119" y="749.7" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-45" value="inTargetRange do nothing" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="JKiNQljIdbqBsyxyxwz1-44" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.1" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-46" value="" style="shape=ellipse;html=1;dashed=0;whitespace=wrap;aspect=fixed;strokeWidth=5;perimeter=ellipsePerimeter;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="530" y="795" width="30" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-47" value="" style="endArrow=classic;html=1;exitX=0.82;exitY=1.003;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitPerimeter=0;" parent="1" target="JKiNQljIdbqBsyxyxwz1-46" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="544" y="680" as="sourcePoint"/>
|
||||||
|
<mxPoint x="594" y="745" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-48" value="after setNewLimit" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="JKiNQljIdbqBsyxyxwz1-47" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.1" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-49" value="" style="shape=ellipse;html=1;dashed=0;whitespace=wrap;aspect=fixed;strokeWidth=5;perimeter=ellipsePerimeter;" parent="1" vertex="1">
|
||||||
|
<mxGeometry x="1110" y="800" width="30" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-50" value="" style="endArrow=classic;html=1;exitX=0.82;exitY=1.003;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitPerimeter=0;" parent="1" target="JKiNQljIdbqBsyxyxwz1-49" edge="1">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="1124.0000000000002" y="685.3" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1174" y="750" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="JKiNQljIdbqBsyxyxwz1-51" value="after setNewLimit" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="JKiNQljIdbqBsyxyxwz1-50" vertex="1" connectable="0">
|
||||||
|
<mxGeometry x="-0.1" relative="1" as="geometry">
|
||||||
|
<mxPoint x="16" y="33" as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="38" value="" style="endArrow=classic;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="24" target="sqCMRMHiXPc9LqBIY9SA-7">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="580" y="710" as="sourcePoint"/>
|
||||||
|
<mxPoint x="630" y="660" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="39" value="yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="38">
|
||||||
|
<mxGeometry x="0.104" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="40" value="" style="endArrow=classic;html=1;entryX=1;entryY=0.75;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" target="sqCMRMHiXPc9LqBIY9SA-7">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="970" y="658" as="sourcePoint"/>
|
||||||
|
<mxPoint x="800" y="660" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="48" value="canUseDirectSolarPower<br style="border-color: var(--border-color);">&amp;&amp; EMPTY_AT_NIGHT" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="40">
|
||||||
|
<mxGeometry x="-0.04" y="1" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="43" value="" style="endArrow=classic;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="25" target="sqCMRMHiXPc9LqBIY9SA-8">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="960" y="980" as="sourcePoint"/>
|
||||||
|
<mxPoint x="1010" y="930" as="targetPoint"/>
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="1020" y="995"/>
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="44" value="yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="43">
|
||||||
|
<mxGeometry x="0.1135" y="2" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="45" value="" style="shape=ellipse;html=1;dashed=0;whitespace=wrap;aspect=fixed;strokeWidth=5;perimeter=ellipsePerimeter;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="880" y="850" width="30" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="46" value="" style="endArrow=classic;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="25" target="45">
|
||||||
|
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||||
|
<mxPoint x="580" y="710" as="sourcePoint"/>
|
||||||
|
<mxPoint x="630" y="660" as="targetPoint"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="47" value="no" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="46">
|
||||||
|
<mxGeometry x="-0.08" relative="1" as="geometry">
|
||||||
|
<mxPoint as="offset"/>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
||||||
BIN
docs/PowerLimiterInverterStates.png
Normal file
|
After Width: | Height: | Size: 147 KiB |
@ -1,3 +1,21 @@
|
|||||||
# Upgrade Partition
|
# Upgrade Partition
|
||||||
|
|
||||||
This documentation has been moved and can be found here: <https://tbnobody.github.io/OpenDTU-docs/firmware/howto/upgrade_partition/>
|
To be able to install further updates you have to update the partition table of the ESP32. Doing so will **erase** all configuration data. Over The Air update using the web interface is **NOT** possible!
|
||||||
|
|
||||||
|
**So make sure you export a backup of your configuration files before continuing.**
|
||||||
|
|
||||||
|
There are several possibilities to update the partition table:
|
||||||
|
|
||||||
|
- Using Visual Studio Code or PlatformIO CLI
|
||||||
|
|
||||||
|
If you have already used Visual Studio Code or the `platformio` command you can use it again to install the latest version. The partition table is upgraded automatically.
|
||||||
|
|
||||||
|
- Any kind of flash interface
|
||||||
|
|
||||||
|
If you like to use any kind of flash interface like `esptool.py`, Espressif Flash Download Tool, ESP_Flasher or esptool-js you have to make sure to upload the provided .factory.bin file. It is important to enter the correct target address.
|
||||||
|
|
||||||
|
| Address | File |
|
||||||
|
| ---------| ---------------------- |
|
||||||
|
| 0x0 | opendtu-*.factory.bin |
|
||||||
|
|
||||||
|
After upgrading the ESP32 will open the intergrated access point (AP) again. Just connect to it using the default password ("openDTU42"). If you are connected, just visit <http://192.168.4.1> and enter the "Configuration Management". Recover the previously backuped config files.
|
||||||
|
|||||||
@ -1,3 +1,44 @@
|
|||||||
# Web API
|
# Web API
|
||||||
|
|
||||||
This documentation will has been moved and can be found here: <https://tbnobody.github.io/OpenDTU-docs/firmware/web_api/>
|
This documentation will has been moved and can be found here: <https://tbnobody.github.io/OpenDTU-docs/firmware/web_api/>
|
||||||
|
|
||||||
|
## List of URLs
|
||||||
|
|
||||||
|
This list may be incomplete
|
||||||
|
|
||||||
|
| GET/POST | Auth required | URL |
|
||||||
|
| -------- | --- | -- |
|
||||||
|
| Get | no | /api/vedirectlivedata/status |
|
||||||
|
| Get | no | /api/vedirect/status |
|
||||||
|
| Get | no | /api/huawei/status |
|
||||||
|
| Get | no | /api/huawei/config |
|
||||||
|
| Get | no | /api/huawei/limit/config |
|
||||||
|
| Get | no | /api/batterylivedata/status |
|
||||||
|
| Get | no | /api/battery/status |
|
||||||
|
| Get | no | /api/powerlimiter/status |
|
||||||
|
|
||||||
|
### Victron REST-API (/api/vedirectlivedata/status):
|
||||||
|
````JSON
|
||||||
|
{
|
||||||
|
"data_age":0,
|
||||||
|
"age_critical":false,
|
||||||
|
"PID":"SmartSolar MPPT 100|30",
|
||||||
|
"SER":"XXX",
|
||||||
|
"FW":"159",
|
||||||
|
"LOAD":"ON",
|
||||||
|
"CS":"Bulk",
|
||||||
|
"ERR":"No error",
|
||||||
|
"OR":"Not off",
|
||||||
|
"MPPT":"MPP Tracker active",
|
||||||
|
"HSDS":{"v":46,"u":"Days"},
|
||||||
|
"V":{"v":26.36,"u":"V"},
|
||||||
|
"I":{"v":3.4,"u":"A"},
|
||||||
|
"VPV":{"v":37.13,"u":"V"},
|
||||||
|
"PPV":{"v":93,"u":"W"},
|
||||||
|
"H19":{"v":83.16,"u":"kWh"},
|
||||||
|
"H20":{"v":1.39,"u":"kWh"},
|
||||||
|
"H21":{"v":719,"u":"W"},
|
||||||
|
"H22":{"v":1.43,"u":"kWh"},
|
||||||
|
"H23":{"v":737,"u":"W"}
|
||||||
|
}
|
||||||
|
````
|
||||||
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 261 KiB |
194
docs/components.drawio.svg
Normal file
|
After Width: | Height: | Size: 3.9 MiB |
191
docs/hardware_flash.md
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
# Hardware, building and flashing Firmware
|
||||||
|
|
||||||
|
## Hardware you need
|
||||||
|
|
||||||
|
### ESP32 board
|
||||||
|
|
||||||
|
For ease of use, buy a "ESP32 DEVKIT DOIT" or "ESP32 NodeMCU Development Board" with an ESP32-S3 or ESP-WROOM-32 chipset on it.
|
||||||
|
|
||||||
|
Sample Picture:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Also supported: Board with Ethernet-Connector and Power-over-Ethernet [Olimex ESP32-POE](https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware)
|
||||||
|
|
||||||
|
### NRF24L01+ radio board (See inverter table above for supported inverters)
|
||||||
|
|
||||||
|
The PLUS sign is IMPORTANT! There are different variants available, with antenna on the printed circuit board or external antenna.
|
||||||
|
|
||||||
|
Sample picture:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Buy your hardware from a trusted source, at best from a dealer/online shop in your country where you have support and the right to return non-functional hardware.
|
||||||
|
When you want to buy from Amazon, AliExpress, eBay etc., take note that there is a lot of low-quality or fake hardware offered. Read customer comments and ratings carefully!
|
||||||
|
|
||||||
|
A heavily incomplete list of trusted hardware shops in Germany is:
|
||||||
|
|
||||||
|
* [AZ-Delivery](https://www.az-delivery.de/)
|
||||||
|
* [Makershop](https://www.makershop.de/)
|
||||||
|
* [Berrybase](https://www.berrybase.de/)
|
||||||
|
|
||||||
|
This list is for your convenience only, the project is not related to any of these shops.
|
||||||
|
|
||||||
|
### CMT2300A radio board (See inverter table above for supported inverters)
|
||||||
|
|
||||||
|
It is important to get a module which supports SPI communication. The following modules are currently supported:
|
||||||
|
|
||||||
|
* EBYTE E49-900M20S
|
||||||
|
|
||||||
|
The CMT2300A uses 3-Wire half duplex SPI communication. Due to this fact it currently requires a separate SPI bus. If you want to run the CMT2300A module on the same ESP32 as a NRF24L01+ module or a PCD8544 display make sure you get a ESP which supports 2 SPI busses. Currently the SPI bus host is hardcoded to number 2. This may change in future.
|
||||||
|
|
||||||
|
### 3.3V / 5V logic level converter
|
||||||
|
|
||||||
|
The logic level converter is used to interface with the Victron MPPT charge controller and the relay board. It converts the 3.3V logic level used by the ESP32 to 5V logic used by the other devices.
|
||||||
|
|
||||||
|
### SN65HVD230 CAN bus transceiver
|
||||||
|
|
||||||
|
The SN65HVD230 CAN bus transceiver is used to interface with the Pylontech battery. It leverages the CAN bus controller of the ESP32. This CAN bus operates at 500kbit/s
|
||||||
|
|
||||||
|
### MCP2515 CAN bus module
|
||||||
|
|
||||||
|
The MCP2515 CAN bus module consists of a CAN bus controller and a CAN bus transceiver and is used to interface with the Huawei AC charger. This CAN bus operates at 125kbit/s. The module is connected via SPI and currently requires a separate SPI bus. If you want to use the Huawei AC charger make sure to get an ESP which supports 2 SPI busses. Currently the SPI bus host is hardcoded to number 2. This may change in future. Please note: Using the Huawei AC charger in combination with the CMT2300A radio board is not supported at the moment.
|
||||||
|
|
||||||
|
MCP2515 CAN bus modules that are widely available are designed for 5V supply voltage. To make them work with 3.3V / the ESP32 a modification is required. [This modification is described here.](https://forums.raspberrypi.com/viewtopic.php?t=141052)
|
||||||
|
|
||||||
|
### Relay module
|
||||||
|
|
||||||
|
The Huawei PSU can be switched on / off using the slot detect port. This is done by this relay.
|
||||||
|
|
||||||
|
### Power supply
|
||||||
|
|
||||||
|
Use a power supply with 5 V and 1 A. The USB cable connected to your PC/Notebook may be powerful enough or may be not.
|
||||||
|
|
||||||
|
## Wiring up the NRF24L01+ module
|
||||||
|
|
||||||
|
### Schematic
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Symbolic view
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Change pin assignment
|
||||||
|
|
||||||
|
Its possible to change all the pins of the NRF24L01+ module, the Display, the LED etc.
|
||||||
|
The recommend way to change the pin assignment is by creating a custom [device profile](DeviceProfiles.md).
|
||||||
|
It is also possible to create a custom environment and compile the source yourself. This can be achieved by copying one of the [env:....] sections from 'platformio.ini' to 'platformio_override.ini' and editing the 'platformio_override.ini' file and add/change one or more of the following lines to the 'build_flags' parameter:
|
||||||
|
|
||||||
|
```makefile
|
||||||
|
-DHOYMILES_PIN_MISO=19
|
||||||
|
-DHOYMILES_PIN_MOSI=23
|
||||||
|
-DHOYMILES_PIN_SCLK=18
|
||||||
|
-DHOYMILES_PIN_IRQ=16
|
||||||
|
-DHOYMILES_PIN_CE=4
|
||||||
|
-DHOYMILES_PIN_CS=5
|
||||||
|
-DVICTRON_PIN_TX=21
|
||||||
|
-DVICTRON_PIN_RX=22
|
||||||
|
-DPYLONTECH_PIN_RX=27
|
||||||
|
-DPYLONTECH_PIN_TX=14
|
||||||
|
-DHUAWEI_PIN_MISO=12
|
||||||
|
-DHUAWEI_PIN_MOSI=13
|
||||||
|
-DHUAWEI_PIN_SCLK=26
|
||||||
|
-DHUAWEI_PIN_IRQ=25
|
||||||
|
-DHUAWEI_PIN_CS=15
|
||||||
|
-DHUAWEI_PIN_POWER=33
|
||||||
|
```
|
||||||
|
|
||||||
|
It is recommended to make all changes only in the 'platformio_override.ini', this is your personal copy.
|
||||||
|
|
||||||
|
## Flashing and starting up
|
||||||
|
|
||||||
|
### with Visual Studio Code
|
||||||
|
|
||||||
|
* Install [Visual Studio Code](https://code.visualstudio.com/download) (from now named "vscode")
|
||||||
|
* In Visual Studio Code, install the [PlatformIO Extension](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide)
|
||||||
|
* Install git and enable git in vscode - [git download](https://git-scm.com/downloads/) - [Instructions](https://www.jcchouinard.com/install-git-in-vscode/)
|
||||||
|
* Clone this repository (you really have to clone it, don't just download the ZIP file. During the build process the git hash gets embedded into the firmware. If you download the ZIP file a build error will occur): Inside vscode open the command palette by pressing `CTRL` + `SHIFT` + `P`. Enter `git clone`, add the repository-URL `https://github.com/tbnobody/OpenDTU`. Next you have to choose (or create) a target directory.
|
||||||
|
* In vscode, choose File --> Open Folder and select the previously downloaded source code. (You have to select the folder which contains the "platformio.ini" and "platformio_override.ini" file)
|
||||||
|
* Adjust the COM port in the file "platformio_override.ini" for your USB-to-serial-converter. It occurs twice:
|
||||||
|
* upload_port
|
||||||
|
* monitor_port
|
||||||
|
* Select the arrow button in the blue bottom status bar (PlatformIO: Upload) to compile and upload the firmware. During the compilation, all required libraries are downloaded automatically.
|
||||||
|
* Under Linux, if the upload fails with error messages "Could not open /dev/ttyUSB0, the port doesn't exist", you can check via ```ls -la /dev/tty*``` to which group your port belongs to, and then add your user this group via ```sudo adduser <yourusername> dialout``` (if you are using ```arch-linux``` use: ```sudo gpasswd -a <yourusername> uucp```, this method requires a logout/login of the affected user).
|
||||||
|
* There are two videos showing these steps:
|
||||||
|
* [Git Clone and compilation](https://youtu.be/9cA_esv3zeA)
|
||||||
|
* [Full installation and compilation](https://youtu.be/xs6TqHn7QWM)
|
||||||
|
|
||||||
|
### on the commandline with PlatformIO Core
|
||||||
|
|
||||||
|
* Install [PlatformIO Core](https://platformio.org/install/cli)
|
||||||
|
* Clone this repository (you really have to clone it, don't just download the ZIP file. During the build process the git hash gets embedded into the firmware. If you download the ZIP file a build error will occur)
|
||||||
|
* Adjust the COM port in the file "platformio_override.ini". It occurs twice:
|
||||||
|
* upload_port
|
||||||
|
* monitor_port
|
||||||
|
* build: `platformio run -e generic`
|
||||||
|
* upload to esp module: `platformio run -e generic -t upload`
|
||||||
|
* other options:
|
||||||
|
* clean the sources: `platformio run -e generic -t clean`
|
||||||
|
* erase flash: `platformio run -e generic -t erase`
|
||||||
|
|
||||||
|
### using the pre-compiled .bin files
|
||||||
|
|
||||||
|
The pre-compiled files can be found on the [github page](https://github.com/tbnobody/OpenDTU) in the tab "Actions" and the sub menu "OpenDTU Build". Just choose the latest build from the master branch (search for "master" in the blue font text but click on the white header text!). You need to be logged in with your github account to download the files.
|
||||||
|
Use a ESP32 flash tool of your choice (see next chapter) and flash the `.bin` files to the right addresses:
|
||||||
|
|
||||||
|
| Address | File |
|
||||||
|
| ---------| ---------------------- |
|
||||||
|
| 0x1000 | bootloader.bin |
|
||||||
|
| 0x8000 | partitions.bin |
|
||||||
|
| 0xe000 | boot_app0.bin |
|
||||||
|
| 0x10000 | opendtu-*.bin |
|
||||||
|
|
||||||
|
For further updates you can just use the web interface and upload the `opendtu-*.bin` file.
|
||||||
|
|
||||||
|
#### Flash with esptool.py (Linux)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
esptool.py --port /dev/ttyUSB0 --chip esp32 --before default_reset --after hard_reset \
|
||||||
|
write_flash --flash_mode dout --flash_freq 40m --flash_size detect \
|
||||||
|
0x1000 bootloader.bin \
|
||||||
|
0x8000 partitions.bin \
|
||||||
|
0xe000 boot_app0.bin \
|
||||||
|
0x10000 opendtu-generic.bin
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Flash with Espressif Flash Download Tool (Windows)
|
||||||
|
|
||||||
|
[Download link](https://www.espressif.com/en/support/download/other-tools)
|
||||||
|
|
||||||
|
* On startup, select Chip Type -> "ESP32" / WorkMode -> "Develop"
|
||||||
|
* Prepare all settings (see picture). Make sure to uncheck the `DoNotChgBin` option. Otherwise you may get errors like "invalid header".
|
||||||
|
* 
|
||||||
|
* Press "Erase" button on screen. Look into the terminal window, you should see dots appear. Then press the "Boot" button on the ESP32 board. Wait for "FINISH" to see if flashing/erasing is done.
|
||||||
|
* To program, press "Start" on screen, then the "Boot" button.
|
||||||
|
* When flashing is complete (FINISH appears) then press the Reset button on the ESP32 board (or powercycle ) to start the OpenDTU application.
|
||||||
|
|
||||||
|
#### Flash with ESP_Flasher (Windows)
|
||||||
|
|
||||||
|
Users report that [ESP_Flasher](https://github.com/Jason2866/ESP_Flasher/releases/) is suitable for flashing OpenDTU on Windows.
|
||||||
|
|
||||||
|
#### Flash with [ESP_Flasher](https://espressif.github.io/esptool-js/) - web version
|
||||||
|
|
||||||
|
It is also possible to flash it via the web tools which might be more convenient and is platform independent.
|
||||||
|
|
||||||
|
## Flashing an Update using "Over The Air" OTA Update
|
||||||
|
|
||||||
|
Once you have your OpenDTU running and connected to WLAN, you can do further updates through the web interface.
|
||||||
|
Navigate to Settings --> Firmware upgrade and press the browse button. Select the firmware file from your local computer.
|
||||||
|
|
||||||
|
You'll find the firmware file (after a successful build process) under `.pio/build/generic/firmware.bin`.
|
||||||
|
|
||||||
|
If you downloaded a precompiled zip archive, unpack it and choose `opendtu-generic.bin`.
|
||||||
|
|
||||||
|
After the successful upload, the OpenDTU immediately restarts into the new firmware.
|
||||||
|
|
||||||
|
|
||||||
|
## Builds
|
||||||
|
|
||||||
|
Different builds from existing installations can be found here [Builds](builds/README.md)
|
||||||
|
Like to show your own build? Just send me a Pull Request.
|
||||||
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 146 KiB |
37
include/Battery.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
#include "BatteryStats.h"
|
||||||
|
|
||||||
|
class BatteryProvider {
|
||||||
|
public:
|
||||||
|
// returns true if the provider is ready for use, false otherwise
|
||||||
|
virtual bool init(bool verboseLogging) = 0;
|
||||||
|
|
||||||
|
virtual void deinit() = 0;
|
||||||
|
virtual void loop() = 0;
|
||||||
|
virtual std::shared_ptr<BatteryStats> getStats() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class BatteryClass {
|
||||||
|
public:
|
||||||
|
void init(Scheduler&);
|
||||||
|
void updateSettings();
|
||||||
|
|
||||||
|
std::shared_ptr<BatteryStats const> getStats() const;
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
uint32_t _lastMqttPublish = 0;
|
||||||
|
mutable std::mutex _mutex;
|
||||||
|
std::unique_ptr<BatteryProvider> _upProvider = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern BatteryClass Battery;
|
||||||
143
include/BatteryStats.h
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "AsyncJson.h"
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "JkBmsDataPoints.h"
|
||||||
|
#include "VeDirectShuntController.h"
|
||||||
|
|
||||||
|
// mandatory interface for all kinds of batteries
|
||||||
|
class BatteryStats {
|
||||||
|
public:
|
||||||
|
String const& getManufacturer() const { return _manufacturer; }
|
||||||
|
|
||||||
|
// the last time *any* datum was updated
|
||||||
|
uint32_t getAgeSeconds() const { return (millis() - _lastUpdate) / 1000; }
|
||||||
|
bool updateAvailable(uint32_t since) const { return _lastUpdate > since; }
|
||||||
|
|
||||||
|
uint8_t getSoC() const { return _SoC; }
|
||||||
|
uint32_t getSoCAgeSeconds() const { return (millis() - _lastUpdateSoC) / 1000; }
|
||||||
|
|
||||||
|
// convert stats to JSON for web application live view
|
||||||
|
virtual void getLiveViewData(JsonVariant& root) const;
|
||||||
|
|
||||||
|
virtual void mqttPublish() const;
|
||||||
|
|
||||||
|
bool isValid() const { return _lastUpdateSoC > 0 && _lastUpdate > 0; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
String _manufacturer = "unknown";
|
||||||
|
uint8_t _SoC = 0;
|
||||||
|
uint32_t _lastUpdateSoC = 0;
|
||||||
|
uint32_t _lastUpdate = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PylontechBatteryStats : public BatteryStats {
|
||||||
|
friend class PylontechCanReceiver;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void getLiveViewData(JsonVariant& root) const final;
|
||||||
|
void mqttPublish() const final;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setManufacturer(String&& m) { _manufacturer = std::move(m); }
|
||||||
|
void setSoC(uint8_t SoC) { _SoC = SoC; _lastUpdateSoC = millis(); }
|
||||||
|
void setLastUpdate(uint32_t ts) { _lastUpdate = ts; }
|
||||||
|
|
||||||
|
float _chargeVoltage;
|
||||||
|
float _chargeCurrentLimitation;
|
||||||
|
float _dischargeCurrentLimitation;
|
||||||
|
uint16_t _stateOfHealth;
|
||||||
|
float _voltage; // total voltage of the battery pack
|
||||||
|
// total current into (positive) or from (negative)
|
||||||
|
// the battery, i.e., the charging current
|
||||||
|
float _current;
|
||||||
|
float _temperature;
|
||||||
|
|
||||||
|
bool _alarmOverCurrentDischarge;
|
||||||
|
bool _alarmOverCurrentCharge;
|
||||||
|
bool _alarmUnderTemperature;
|
||||||
|
bool _alarmOverTemperature;
|
||||||
|
bool _alarmUnderVoltage;
|
||||||
|
bool _alarmOverVoltage;
|
||||||
|
bool _alarmBmsInternal;
|
||||||
|
|
||||||
|
bool _warningHighCurrentDischarge;
|
||||||
|
bool _warningHighCurrentCharge;
|
||||||
|
bool _warningLowTemperature;
|
||||||
|
bool _warningHighTemperature;
|
||||||
|
bool _warningLowVoltage;
|
||||||
|
bool _warningHighVoltage;
|
||||||
|
bool _warningBmsInternal;
|
||||||
|
|
||||||
|
bool _chargeEnabled;
|
||||||
|
bool _dischargeEnabled;
|
||||||
|
bool _chargeImmediately;
|
||||||
|
};
|
||||||
|
|
||||||
|
class JkBmsBatteryStats : public BatteryStats {
|
||||||
|
public:
|
||||||
|
void getLiveViewData(JsonVariant& root) const final {
|
||||||
|
getJsonData(root, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void getInfoViewData(JsonVariant& root) const {
|
||||||
|
getJsonData(root, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mqttPublish() const final;
|
||||||
|
|
||||||
|
void updateFrom(JkBms::DataPointContainer const& dp);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void getJsonData(JsonVariant& root, bool verbose) const;
|
||||||
|
|
||||||
|
JkBms::DataPointContainer _dataPoints;
|
||||||
|
mutable uint32_t _lastMqttPublish = 0;
|
||||||
|
mutable uint32_t _lastFullMqttPublish = 0;
|
||||||
|
|
||||||
|
uint16_t _cellMinMilliVolt = 0;
|
||||||
|
uint16_t _cellAvgMilliVolt = 0;
|
||||||
|
uint16_t _cellMaxMilliVolt = 0;
|
||||||
|
uint32_t _cellVoltageTimestamp = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class VictronSmartShuntStats : public BatteryStats {
|
||||||
|
public:
|
||||||
|
void getLiveViewData(JsonVariant& root) const final;
|
||||||
|
void mqttPublish() const final;
|
||||||
|
|
||||||
|
void updateFrom(VeDirectShuntController::veShuntStruct const& shuntData);
|
||||||
|
|
||||||
|
private:
|
||||||
|
float _voltage;
|
||||||
|
float _current;
|
||||||
|
float _temperature;
|
||||||
|
bool _tempPresent;
|
||||||
|
uint8_t _chargeCycles;
|
||||||
|
uint32_t _timeToGo;
|
||||||
|
float _chargedEnergy;
|
||||||
|
float _dischargedEnergy;
|
||||||
|
String _modelName;
|
||||||
|
|
||||||
|
bool _alarmLowVoltage;
|
||||||
|
bool _alarmHighVoltage;
|
||||||
|
bool _alarmLowSOC;
|
||||||
|
bool _alarmLowTemperature;
|
||||||
|
bool _alarmHighTemperature;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MqttBatteryStats : public BatteryStats {
|
||||||
|
public:
|
||||||
|
// since the source of information was MQTT in the first place,
|
||||||
|
// we do NOT publish the same data under a different topic.
|
||||||
|
void mqttPublish() const final { }
|
||||||
|
|
||||||
|
// the SoC is the only interesting value in this case, which is already
|
||||||
|
// displayed at the top of the live view. do not generate a card.
|
||||||
|
void getLiveViewData(JsonVariant& root) const final { }
|
||||||
|
|
||||||
|
void setSoC(uint8_t SoC) { _SoC = SoC; _lastUpdateSoC = _lastUpdate = millis(); }
|
||||||
|
};
|
||||||
@ -3,12 +3,9 @@
|
|||||||
|
|
||||||
#include "PinMapping.h"
|
#include "PinMapping.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
#include <mutex>
|
|
||||||
#include <condition_variable>
|
|
||||||
|
|
||||||
#define CONFIG_FILENAME "/config.json"
|
#define CONFIG_FILENAME "/config.json"
|
||||||
#define CONFIG_VERSION 0x00011d00 // 0.1.29 // make sure to clean all after change
|
#define CONFIG_VERSION 0x00011900 // 0.1.24 // make sure to clean all after change
|
||||||
|
|
||||||
#define WIFI_MAX_SSID_STRLEN 32
|
#define WIFI_MAX_SSID_STRLEN 32
|
||||||
#define WIFI_MAX_PASSWORD_STRLEN 64
|
#define WIFI_MAX_PASSWORD_STRLEN 64
|
||||||
@ -19,21 +16,30 @@
|
|||||||
#define NTP_MAX_TIMEZONEDESCR_STRLEN 50
|
#define NTP_MAX_TIMEZONEDESCR_STRLEN 50
|
||||||
|
|
||||||
#define MQTT_MAX_HOSTNAME_STRLEN 128
|
#define MQTT_MAX_HOSTNAME_STRLEN 128
|
||||||
#define MQTT_MAX_CLIENTID_STRLEN 64
|
|
||||||
#define MQTT_MAX_USERNAME_STRLEN 64
|
#define MQTT_MAX_USERNAME_STRLEN 64
|
||||||
#define MQTT_MAX_PASSWORD_STRLEN 64
|
#define MQTT_MAX_PASSWORD_STRLEN 64
|
||||||
#define MQTT_MAX_TOPIC_STRLEN 32
|
#define MQTT_MAX_TOPIC_STRLEN 256
|
||||||
#define MQTT_MAX_LWTVALUE_STRLEN 20
|
#define MQTT_MAX_LWTVALUE_STRLEN 20
|
||||||
#define MQTT_MAX_CERT_STRLEN 2560
|
#define MQTT_MAX_CERT_STRLEN 2560
|
||||||
|
|
||||||
#define INV_MAX_NAME_STRLEN 31
|
#define INV_MAX_NAME_STRLEN 31
|
||||||
#define INV_MAX_COUNT 10
|
#define INV_MAX_COUNT 5
|
||||||
#define INV_MAX_CHAN_COUNT 6
|
#define INV_MAX_CHAN_COUNT 6
|
||||||
|
|
||||||
#define CHAN_MAX_NAME_STRLEN 31
|
#define CHAN_MAX_NAME_STRLEN 31
|
||||||
|
|
||||||
#define DEV_MAX_MAPPING_NAME_STRLEN 63
|
#define DEV_MAX_MAPPING_NAME_STRLEN 63
|
||||||
#define LOCALE_STRLEN 2
|
|
||||||
|
#define POWERMETER_MAX_PHASES 3
|
||||||
|
#define POWERMETER_MAX_HTTP_URL_STRLEN 1024
|
||||||
|
#define POWERMETER_MAX_USERNAME_STRLEN 64
|
||||||
|
#define POWERMETER_MAX_PASSWORD_STRLEN 64
|
||||||
|
#define POWERMETER_MAX_HTTP_HEADER_KEY_STRLEN 64
|
||||||
|
#define POWERMETER_MAX_HTTP_HEADER_VALUE_STRLEN 256
|
||||||
|
#define POWERMETER_MAX_HTTP_JSON_PATH_STRLEN 256
|
||||||
|
#define POWERMETER_HTTP_TIMEOUT 1000
|
||||||
|
|
||||||
|
#define JSON_BUFFER_SIZE 15360
|
||||||
|
|
||||||
struct CHANNEL_CONFIG_T {
|
struct CHANNEL_CONFIG_T {
|
||||||
uint16_t MaxChannelPower;
|
uint16_t MaxChannelPower;
|
||||||
@ -52,11 +58,23 @@ struct INVERTER_CONFIG_T {
|
|||||||
uint8_t ReachableThreshold;
|
uint8_t ReachableThreshold;
|
||||||
bool ZeroRuntimeDataIfUnrechable;
|
bool ZeroRuntimeDataIfUnrechable;
|
||||||
bool ZeroYieldDayOnMidnight;
|
bool ZeroYieldDayOnMidnight;
|
||||||
bool ClearEventlogOnMidnight;
|
|
||||||
bool YieldDayCorrection;
|
bool YieldDayCorrection;
|
||||||
CHANNEL_CONFIG_T channel[INV_MAX_CHAN_COUNT];
|
CHANNEL_CONFIG_T channel[INV_MAX_CHAN_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Auth { none, basic, digest };
|
||||||
|
struct POWERMETER_HTTP_PHASE_CONFIG_T {
|
||||||
|
bool Enabled;
|
||||||
|
char Url[POWERMETER_MAX_HTTP_URL_STRLEN + 1];
|
||||||
|
Auth AuthType;
|
||||||
|
char Username[POWERMETER_MAX_USERNAME_STRLEN +1];
|
||||||
|
char Password[POWERMETER_MAX_USERNAME_STRLEN +1];
|
||||||
|
char HeaderKey[POWERMETER_MAX_HTTP_HEADER_KEY_STRLEN + 1];
|
||||||
|
char HeaderValue[POWERMETER_MAX_HTTP_HEADER_VALUE_STRLEN + 1];
|
||||||
|
uint16_t Timeout;
|
||||||
|
char JsonPath[POWERMETER_MAX_HTTP_JSON_PATH_STRLEN + 1];
|
||||||
|
};
|
||||||
|
|
||||||
struct CONFIG_T {
|
struct CONFIG_T {
|
||||||
struct {
|
struct {
|
||||||
uint32_t Version;
|
uint32_t Version;
|
||||||
@ -92,8 +110,8 @@ struct CONFIG_T {
|
|||||||
struct {
|
struct {
|
||||||
bool Enabled;
|
bool Enabled;
|
||||||
char Hostname[MQTT_MAX_HOSTNAME_STRLEN + 1];
|
char Hostname[MQTT_MAX_HOSTNAME_STRLEN + 1];
|
||||||
|
bool VerboseLogging;
|
||||||
uint32_t Port;
|
uint32_t Port;
|
||||||
char ClientId[MQTT_MAX_CLIENTID_STRLEN + 1];
|
|
||||||
char Username[MQTT_MAX_USERNAME_STRLEN + 1];
|
char Username[MQTT_MAX_USERNAME_STRLEN + 1];
|
||||||
char Password[MQTT_MAX_PASSWORD_STRLEN + 1];
|
char Password[MQTT_MAX_PASSWORD_STRLEN + 1];
|
||||||
char Topic[MQTT_MAX_TOPIC_STRLEN + 1];
|
char Topic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
@ -134,8 +152,8 @@ struct CONFIG_T {
|
|||||||
struct {
|
struct {
|
||||||
int8_t PaLevel;
|
int8_t PaLevel;
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
uint8_t CountryMode;
|
|
||||||
} Cmt;
|
} Cmt;
|
||||||
|
bool VerboseLogging;
|
||||||
} Dtu;
|
} Dtu;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -148,49 +166,94 @@ struct CONFIG_T {
|
|||||||
bool ScreenSaver;
|
bool ScreenSaver;
|
||||||
uint8_t Rotation;
|
uint8_t Rotation;
|
||||||
uint8_t Contrast;
|
uint8_t Contrast;
|
||||||
char Locale[LOCALE_STRLEN + 1];
|
uint8_t Language;
|
||||||
struct {
|
uint32_t DiagramDuration;
|
||||||
uint32_t Duration;
|
|
||||||
uint8_t Mode;
|
|
||||||
} Diagram;
|
|
||||||
} Display;
|
} Display;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t Brightness;
|
uint8_t Brightness;
|
||||||
} Led_Single[PINMAPPING_LED_COUNT];
|
} Led_Single[PINMAPPING_LED_COUNT];
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool Enabled;
|
||||||
|
bool VerboseLogging;
|
||||||
|
bool UpdatesOnly;
|
||||||
|
} Vedirect;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool Enabled;
|
||||||
|
bool VerboseLogging;
|
||||||
|
uint32_t Interval;
|
||||||
|
uint32_t Source;
|
||||||
|
char MqttTopicPowerMeter1[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
|
char MqttTopicPowerMeter2[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
|
char MqttTopicPowerMeter3[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
|
uint32_t SdmBaudrate;
|
||||||
|
uint32_t SdmAddress;
|
||||||
|
uint32_t HttpInterval;
|
||||||
|
bool HttpIndividualRequests;
|
||||||
|
POWERMETER_HTTP_PHASE_CONFIG_T Http_Phase[POWERMETER_MAX_PHASES];
|
||||||
|
} PowerMeter;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool Enabled;
|
||||||
|
bool VerboseLogging;
|
||||||
|
bool SolarPassThroughEnabled;
|
||||||
|
uint8_t SolarPassThroughLosses;
|
||||||
|
uint8_t BatteryDrainStategy;
|
||||||
|
uint32_t Interval;
|
||||||
|
bool IsInverterBehindPowerMeter;
|
||||||
|
uint8_t InverterId;
|
||||||
|
uint8_t InverterChannelId;
|
||||||
|
int32_t TargetPowerConsumption;
|
||||||
|
int32_t TargetPowerConsumptionHysteresis;
|
||||||
|
int32_t LowerPowerLimit;
|
||||||
|
int32_t UpperPowerLimit;
|
||||||
|
uint32_t BatterySocStartThreshold;
|
||||||
|
uint32_t BatterySocStopThreshold;
|
||||||
|
float VoltageStartThreshold;
|
||||||
|
float VoltageStopThreshold;
|
||||||
|
float VoltageLoadCorrectionFactor;
|
||||||
|
int8_t RestartHour;
|
||||||
|
uint32_t FullSolarPassThroughSoc;
|
||||||
|
float FullSolarPassThroughStartVoltage;
|
||||||
|
float FullSolarPassThroughStopVoltage;
|
||||||
|
} PowerLimiter;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool Enabled;
|
||||||
|
bool VerboseLogging;
|
||||||
|
uint8_t Provider;
|
||||||
|
uint8_t JkBmsInterface;
|
||||||
|
uint8_t JkBmsPollingInterval;
|
||||||
|
char MqttTopic[MQTT_MAX_TOPIC_STRLEN + 1];
|
||||||
|
} Battery;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool Enabled;
|
||||||
|
uint32_t CAN_Controller_Frequency;
|
||||||
|
bool Auto_Power_Enabled;
|
||||||
|
float Auto_Power_Voltage_Limit;
|
||||||
|
float Auto_Power_Enable_Voltage_Limit;
|
||||||
|
float Auto_Power_Lower_Power_Limit;
|
||||||
|
float Auto_Power_Upper_Power_Limit;
|
||||||
|
} Huawei;
|
||||||
|
|
||||||
|
|
||||||
INVERTER_CONFIG_T Inverter[INV_MAX_COUNT];
|
INVERTER_CONFIG_T Inverter[INV_MAX_COUNT];
|
||||||
char Dev_PinMapping[DEV_MAX_MAPPING_NAME_STRLEN + 1];
|
char Dev_PinMapping[DEV_MAX_MAPPING_NAME_STRLEN + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigurationClass {
|
class ConfigurationClass {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler& scheduler);
|
void init();
|
||||||
bool read();
|
bool read();
|
||||||
bool write();
|
bool write();
|
||||||
void migrate();
|
void migrate();
|
||||||
CONFIG_T const& get();
|
CONFIG_T& get();
|
||||||
|
|
||||||
class WriteGuard {
|
|
||||||
public:
|
|
||||||
WriteGuard();
|
|
||||||
CONFIG_T& getConfig();
|
|
||||||
~WriteGuard();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_lock<std::mutex> _lock;
|
|
||||||
};
|
|
||||||
|
|
||||||
WriteGuard getWriteGuard();
|
|
||||||
|
|
||||||
INVERTER_CONFIG_T* getFreeInverterSlot();
|
INVERTER_CONFIG_T* getFreeInverterSlot();
|
||||||
INVERTER_CONFIG_T* getInverterConfig(const uint64_t serial);
|
INVERTER_CONFIG_T* getInverterConfig(const uint64_t serial);
|
||||||
void deleteInverterById(const uint8_t id);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void loop();
|
|
||||||
|
|
||||||
Task _loopTask;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ConfigurationClass Configuration;
|
extern ConfigurationClass Configuration;
|
||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
class DatastoreClass {
|
class DatastoreClass {
|
||||||
public:
|
public:
|
||||||
DatastoreClass();
|
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
// Sum of yield total of all enabled inverters, a inverter which is just disabled at night is also included
|
// Sum of yield total of all enabled inverters, a inverter which is just disabled at night is also included
|
||||||
@ -82,4 +81,4 @@ private:
|
|||||||
bool _isAtLeastOnePollEnabled = false;
|
bool _isAtLeastOnePollEnabled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DatastoreClass Datastore;
|
extern DatastoreClass Datastore;
|
||||||
@ -6,31 +6,15 @@
|
|||||||
#include <TaskSchedulerDeclarations.h>
|
#include <TaskSchedulerDeclarations.h>
|
||||||
#include <U8g2lib.h>
|
#include <U8g2lib.h>
|
||||||
|
|
||||||
#define CHART_HEIGHT 20 // chart area hight in pixels
|
|
||||||
#define CHART_WIDTH 47 // chart area width in pixels
|
|
||||||
|
|
||||||
// Left-Upper position of diagram is drawn
|
|
||||||
// (text of Y-axis is display left of that pos)
|
|
||||||
#define CHART_POSX 80
|
|
||||||
#define CHART_POSY 0
|
|
||||||
|
|
||||||
enum DisplayType_t {
|
enum DisplayType_t {
|
||||||
None,
|
None,
|
||||||
PCD8544,
|
PCD8544,
|
||||||
SSD1306,
|
SSD1306,
|
||||||
SH1106,
|
SH1106,
|
||||||
SSD1309,
|
SSD1309,
|
||||||
ST7567_GM12864I_59N,
|
|
||||||
DisplayType_Max,
|
DisplayType_Max,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DiagramMode_t {
|
|
||||||
Off,
|
|
||||||
Small,
|
|
||||||
Fullscreen,
|
|
||||||
DisplayMode_Max,
|
|
||||||
};
|
|
||||||
|
|
||||||
class DisplayGraphicClass {
|
class DisplayGraphicClass {
|
||||||
public:
|
public:
|
||||||
DisplayGraphicClass();
|
DisplayGraphicClass();
|
||||||
@ -40,8 +24,7 @@ public:
|
|||||||
void setContrast(const uint8_t contrast);
|
void setContrast(const uint8_t contrast);
|
||||||
void setStatus(const bool turnOn);
|
void setStatus(const bool turnOn);
|
||||||
void setOrientation(const uint8_t rotation = DISPLAY_ROTATION);
|
void setOrientation(const uint8_t rotation = DISPLAY_ROTATION);
|
||||||
void setLocale(const String& locale);
|
void setLanguage(const uint8_t language);
|
||||||
void setDiagramMode(DiagramMode_t mode);
|
|
||||||
void setStartupDisplay();
|
void setStartupDisplay();
|
||||||
|
|
||||||
DisplayGraphicDiagramClass& Diagram();
|
DisplayGraphicDiagramClass& Diagram();
|
||||||
@ -64,24 +47,14 @@ private:
|
|||||||
bool _displayTurnedOn;
|
bool _displayTurnedOn;
|
||||||
|
|
||||||
DisplayType_t _display_type = DisplayType_t::None;
|
DisplayType_t _display_type = DisplayType_t::None;
|
||||||
DiagramMode_t _diagram_mode = DiagramMode_t::Off;
|
uint8_t _display_language = DISPLAY_LANGUAGE;
|
||||||
String _display_language = DISPLAY_LOCALE;
|
|
||||||
uint8_t _mExtra;
|
uint8_t _mExtra;
|
||||||
const uint16_t _period = 1000;
|
uint16_t _period = 1000;
|
||||||
const uint16_t _interval = 60000; // interval at which to power save (milliseconds)
|
uint16_t _interval = 60000; // interval at which to power save (milliseconds)
|
||||||
uint32_t _previousMillis = 0;
|
uint32_t _previousMillis = 0;
|
||||||
char _fmtText[32];
|
char _fmtText[32];
|
||||||
bool _isLarge = false;
|
bool _isLarge = false;
|
||||||
uint8_t _lineOffsets[5];
|
uint8_t _lineOffsets[5];
|
||||||
|
|
||||||
String _i18n_offline;
|
|
||||||
String _i18n_yield_today_kwh;
|
|
||||||
String _i18n_yield_today_wh;
|
|
||||||
String _i18n_date_format;
|
|
||||||
String _i18n_current_power_kw;
|
|
||||||
String _i18n_current_power_w;
|
|
||||||
String _i18n_yield_total_mwh;
|
|
||||||
String _i18n_yield_total_kwh;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplayGraphicClass Display;
|
extern DisplayGraphicClass Display;
|
||||||
@ -5,14 +5,20 @@
|
|||||||
#include <U8g2lib.h>
|
#include <U8g2lib.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#define MAX_DATAPOINTS 128
|
#define CHART_HEIGHT 20 // chart area hight in pixels
|
||||||
|
#define CHART_WIDTH 47 // chart area width in pixels
|
||||||
|
|
||||||
|
// Left-Upper position of diagram is drawn
|
||||||
|
// (text of Y-axis is display left of that pos)
|
||||||
|
#define DIAG_POSX 80
|
||||||
|
#define DIAG_POSY 0
|
||||||
|
|
||||||
class DisplayGraphicDiagramClass {
|
class DisplayGraphicDiagramClass {
|
||||||
public:
|
public:
|
||||||
DisplayGraphicDiagramClass();
|
DisplayGraphicDiagramClass();
|
||||||
|
|
||||||
void init(Scheduler& scheduler, U8G2* display);
|
void init(Scheduler& scheduler, U8G2* display);
|
||||||
void redraw(uint8_t screenSaverOffsetX, uint8_t xPos, uint8_t yPos, uint8_t width, uint8_t height, bool isFullscreen);
|
void redraw(uint8_t screenSaverOffsetX);
|
||||||
|
|
||||||
void updatePeriod();
|
void updatePeriod();
|
||||||
|
|
||||||
@ -20,17 +26,15 @@ private:
|
|||||||
void averageLoop();
|
void averageLoop();
|
||||||
void dataPointLoop();
|
void dataPointLoop();
|
||||||
|
|
||||||
uint32_t getSecondsPerDot();
|
static uint32_t getSecondsPerDot();
|
||||||
|
|
||||||
Task _averageTask;
|
Task _averageTask;
|
||||||
Task _dataPointTask;
|
Task _dataPointTask;
|
||||||
|
|
||||||
U8G2* _display = nullptr;
|
U8G2* _display = nullptr;
|
||||||
std::array<float, MAX_DATAPOINTS> _graphValues = {};
|
std::array<float, CHART_WIDTH> _graphValues = {};
|
||||||
uint8_t _graphValuesCount = 0;
|
uint8_t _graphValuesCount = 0;
|
||||||
|
|
||||||
uint8_t _chartWidth = MAX_DATAPOINTS;
|
|
||||||
|
|
||||||
float _iRunningAverage = 0;
|
float _iRunningAverage = 0;
|
||||||
uint16_t _iRunningAverageCnt = 0;
|
uint16_t _iRunningAverageCnt = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
26
include/HttpPowerMeter.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <HTTPClient.h>
|
||||||
|
|
||||||
|
class HttpPowerMeterClass {
|
||||||
|
public:
|
||||||
|
void init();
|
||||||
|
bool updateValues();
|
||||||
|
float getPower(int8_t phase);
|
||||||
|
bool httpRequest(const char* url, Auth authType, const char* username, const char* password, const char* httpHeader, const char* httpValue, uint32_t timeout,
|
||||||
|
char* response, size_t responseSize, char* error, size_t errorSize);
|
||||||
|
float getFloatValueByJsonPath(const char* jsonString, const char* jsonPath, float &value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void extractUrlComponents(const String& url, String& protocol, String& hostname, String& uri);
|
||||||
|
void prepareRequest(uint32_t timeout, const char* httpHeader, const char* httpValue);
|
||||||
|
HTTPClient httpClient;
|
||||||
|
float power[POWERMETER_MAX_PHASES];
|
||||||
|
String sha256(const String& data);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
extern HttpPowerMeterClass HttpPowerMeter;
|
||||||
156
include/Huawei_can.h
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include "SPI.h"
|
||||||
|
#include <mcp_can.h>
|
||||||
|
#include <mutex>
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
#ifndef HUAWEI_PIN_MISO
|
||||||
|
#define HUAWEI_PIN_MISO 12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HUAWEI_PIN_MOSI
|
||||||
|
#define HUAWEI_PIN_MOSI 13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HUAWEI_PIN_SCLK
|
||||||
|
#define HUAWEI_PIN_SCLK 26
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HUAWEI_PIN_IRQ
|
||||||
|
#define HUAWEI_PIN_IRQ 25
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HUAWEI_PIN_CS
|
||||||
|
#define HUAWEI_PIN_CS 15
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HUAWEI_PIN_POWER
|
||||||
|
#define HUAWEI_PIN_POWER 33
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define HUAWEI_MINIMAL_OFFLINE_VOLTAGE 48
|
||||||
|
#define HUAWEI_MINIMAL_ONLINE_VOLTAGE 42
|
||||||
|
|
||||||
|
#define MAX_CURRENT_MULTIPLIER 20
|
||||||
|
|
||||||
|
// Index values for rec_values array
|
||||||
|
#define HUAWEI_INPUT_POWER_IDX 0
|
||||||
|
#define HUAWEI_INPUT_FREQ_IDX 1
|
||||||
|
#define HUAWEI_INPUT_CURRENT_IDX 2
|
||||||
|
#define HUAWEI_OUTPUT_POWER_IDX 3
|
||||||
|
#define HUAWEI_EFFICIENCY_IDX 4
|
||||||
|
#define HUAWEI_OUTPUT_VOLTAGE_IDX 5
|
||||||
|
#define HUAWEI_OUTPUT_CURRENT_MAX_IDX 6
|
||||||
|
#define HUAWEI_INPUT_VOLTAGE_IDX 7
|
||||||
|
#define HUAWEI_OUTPUT_TEMPERATURE_IDX 8
|
||||||
|
#define HUAWEI_INPUT_TEMPERATURE_IDX 9
|
||||||
|
#define HUAWEI_OUTPUT_CURRENT_IDX 10
|
||||||
|
#define HUAWEI_OUTPUT_CURRENT1_IDX 11
|
||||||
|
|
||||||
|
// Defines and index values for tx_values array
|
||||||
|
#define HUAWEI_OFFLINE_VOLTAGE 0x01
|
||||||
|
#define HUAWEI_ONLINE_VOLTAGE 0x00
|
||||||
|
#define HUAWEI_OFFLINE_CURRENT 0x04
|
||||||
|
#define HUAWEI_ONLINE_CURRENT 0x03
|
||||||
|
|
||||||
|
// Modes of operation
|
||||||
|
#define HUAWEI_MODE_OFF 0
|
||||||
|
#define HUAWEI_MODE_ON 1
|
||||||
|
#define HUAWEI_MODE_AUTO_EXT 2
|
||||||
|
#define HUAWEI_MODE_AUTO_INT 3
|
||||||
|
|
||||||
|
// Error codes
|
||||||
|
#define HUAWEI_ERROR_CODE_RX 0x01
|
||||||
|
#define HUAWEI_ERROR_CODE_TX 0x02
|
||||||
|
|
||||||
|
// Wait time/current before shuting down the PSU / charger
|
||||||
|
// This is set to allow the fan to run for some time
|
||||||
|
#define HUAWEI_AUTO_MODE_SHUTDOWN_DELAY 60000
|
||||||
|
#define HUAWEI_AUTO_MODE_SHUTDOWN_CURRENT 0.75
|
||||||
|
|
||||||
|
// Updateinterval used to request new values from the PSU
|
||||||
|
#define HUAWEI_DATA_REQUEST_INTERVAL_MS 2500
|
||||||
|
|
||||||
|
typedef struct RectifierParameters {
|
||||||
|
float input_voltage;
|
||||||
|
float input_frequency;
|
||||||
|
float input_current;
|
||||||
|
float input_power;
|
||||||
|
float input_temp;
|
||||||
|
float efficiency;
|
||||||
|
float output_voltage;
|
||||||
|
float output_current;
|
||||||
|
float max_output_current;
|
||||||
|
float output_power;
|
||||||
|
float output_temp;
|
||||||
|
float amp_hour;
|
||||||
|
} RectifierParameters_t;
|
||||||
|
|
||||||
|
class HuaweiCanCommClass {
|
||||||
|
public:
|
||||||
|
bool init(uint8_t huawei_miso, uint8_t huawei_mosi, uint8_t huawei_clk,
|
||||||
|
uint8_t huawei_irq, uint8_t huawei_cs, uint32_t frequency);
|
||||||
|
void loop();
|
||||||
|
bool gotNewRxDataFrame(bool clear);
|
||||||
|
uint8_t getErrorCode(bool clear);
|
||||||
|
uint32_t getParameterValue(uint8_t parameter);
|
||||||
|
void setParameterValue(uint16_t in, uint8_t parameterType);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void sendRequest();
|
||||||
|
|
||||||
|
SPIClass *SPI;
|
||||||
|
MCP_CAN *_CAN;
|
||||||
|
uint8_t _huaweiIrq; // IRQ pin
|
||||||
|
uint32_t _nextRequestMillis = 0; // When to send next data request to PSU
|
||||||
|
|
||||||
|
std::mutex _mutex;
|
||||||
|
|
||||||
|
uint32_t _recValues[12];
|
||||||
|
uint16_t _txValues[5];
|
||||||
|
bool _hasNewTxValue[5];
|
||||||
|
|
||||||
|
uint8_t _errorCode;
|
||||||
|
bool _completeUpdateReceived;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HuaweiCanClass {
|
||||||
|
public:
|
||||||
|
void init(Scheduler& scheduler, uint8_t huawei_miso, uint8_t huawei_mosi, uint8_t huawei_clk, uint8_t huawei_irq, uint8_t huawei_cs, uint8_t huawei_power);
|
||||||
|
void updateSettings(uint8_t huawei_miso, uint8_t huawei_mosi, uint8_t huawei_clk, uint8_t huawei_irq, uint8_t huawei_cs, uint8_t huawei_power);
|
||||||
|
void setValue(float in, uint8_t parameterType);
|
||||||
|
void setMode(uint8_t mode);
|
||||||
|
|
||||||
|
RectifierParameters_t * get();
|
||||||
|
uint32_t getLastUpdate();
|
||||||
|
bool getAutoPowerStatus();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
void processReceivedParameters();
|
||||||
|
void _setValue(float in, uint8_t parameterType);
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
TaskHandle_t _HuaweiCanCommunicationTaskHdl = NULL;
|
||||||
|
bool _initialized = false;
|
||||||
|
uint8_t _huaweiPower; // Power pin
|
||||||
|
uint8_t _mode = HUAWEI_MODE_AUTO_EXT;
|
||||||
|
|
||||||
|
RectifierParameters_t _rp;
|
||||||
|
|
||||||
|
uint32_t _lastUpdateReceivedMillis; // Timestamp for last data seen from the PSU
|
||||||
|
uint32_t _outputCurrentOnSinceMillis; // Timestamp since when the PSU was idle at zero amps
|
||||||
|
uint32_t _nextAutoModePeriodicIntMillis; // When to set the next output voltage in automatic mode
|
||||||
|
uint32_t _lastPowerMeterUpdateReceivedMillis; // Timestamp of last seen power meter value
|
||||||
|
uint32_t _autoModeBlockedTillMillis = 0; // Timestamp to block running auto mode for some time
|
||||||
|
|
||||||
|
uint8_t _autoPowerEnabledCounter = 0;
|
||||||
|
bool _autoPowerEnabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern HuaweiCanClass HuaweiCan;
|
||||||
|
extern HuaweiCanCommClass HuaweiCanComm;
|
||||||
@ -1,35 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
#include <WString.h>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
struct LanguageInfo_t {
|
|
||||||
String code;
|
|
||||||
String name;
|
|
||||||
String filename;
|
|
||||||
};
|
|
||||||
|
|
||||||
class I18nClass {
|
|
||||||
public:
|
|
||||||
I18nClass();
|
|
||||||
void init(Scheduler& scheduler);
|
|
||||||
std::list<LanguageInfo_t> getAvailableLanguages();
|
|
||||||
String getFilenameByLocale(const String& locale) const;
|
|
||||||
void readDisplayStrings(
|
|
||||||
const String& locale,
|
|
||||||
String& date_format,
|
|
||||||
String& offline,
|
|
||||||
String& power_w, String& power_kw,
|
|
||||||
String& yield_today_wh, String& yield_today_kwh,
|
|
||||||
String& yield_total_kwh, String& yield_total_mwh);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void readLangPacks();
|
|
||||||
void readConfig(String file);
|
|
||||||
|
|
||||||
std::list<LanguageInfo_t> _availLanguages;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern I18nClass I18n;
|
|
||||||
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
class InverterSettingsClass {
|
class InverterSettingsClass {
|
||||||
public:
|
public:
|
||||||
InverterSettingsClass();
|
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
75
include/JkBmsController.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Battery.h"
|
||||||
|
#include "JkBmsSerialMessage.h"
|
||||||
|
|
||||||
|
class DataPointContainer;
|
||||||
|
|
||||||
|
namespace JkBms {
|
||||||
|
|
||||||
|
class Controller : public BatteryProvider {
|
||||||
|
public:
|
||||||
|
Controller() = default;
|
||||||
|
|
||||||
|
bool init(bool verboseLogging) final;
|
||||||
|
void deinit() final;
|
||||||
|
void loop() final;
|
||||||
|
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum class Status : unsigned {
|
||||||
|
Initializing,
|
||||||
|
Timeout,
|
||||||
|
WaitingForPollInterval,
|
||||||
|
HwSerialNotAvailableForWrite,
|
||||||
|
BusyReading,
|
||||||
|
RequestSent,
|
||||||
|
FrameCompleted
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string const& getStatusText(Status status);
|
||||||
|
void announceStatus(Status status);
|
||||||
|
void sendRequest(uint8_t pollInterval);
|
||||||
|
void rxData(uint8_t inbyte);
|
||||||
|
void reset();
|
||||||
|
void frameComplete();
|
||||||
|
void processDataPoints(DataPointContainer const& dataPoints);
|
||||||
|
|
||||||
|
enum class Interface : unsigned {
|
||||||
|
Invalid,
|
||||||
|
Uart,
|
||||||
|
Transceiver
|
||||||
|
};
|
||||||
|
|
||||||
|
Interface getInterface() const;
|
||||||
|
|
||||||
|
enum class ReadState : unsigned {
|
||||||
|
Idle,
|
||||||
|
WaitingForFrameStart,
|
||||||
|
FrameStartReceived,
|
||||||
|
StartMarkerReceived,
|
||||||
|
FrameLengthMsbReceived,
|
||||||
|
ReadingFrame
|
||||||
|
};
|
||||||
|
ReadState _readState;
|
||||||
|
void setReadState(ReadState state) {
|
||||||
|
_readState = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _verboseLogging = true;
|
||||||
|
int8_t _rxEnablePin = -1;
|
||||||
|
int8_t _txEnablePin = -1;
|
||||||
|
Status _lastStatus = Status::Initializing;
|
||||||
|
uint32_t _lastStatusPrinted = 0;
|
||||||
|
uint32_t _lastRequest = 0;
|
||||||
|
uint16_t _frameLength = 0;
|
||||||
|
uint8_t _protocolVersion = -1;
|
||||||
|
SerialResponse::tData _buffer = {};
|
||||||
|
std::shared_ptr<JkBmsBatteryStats> _stats =
|
||||||
|
std::make_shared<JkBmsBatteryStats>();
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace JkBms */
|
||||||
302
include/JkBmsDataPoints.h
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <variant>
|
||||||
|
|
||||||
|
namespace JkBms {
|
||||||
|
|
||||||
|
#define ALARM_BITS(fnc) \
|
||||||
|
fnc(LowCapacity, (1<<0)) \
|
||||||
|
fnc(BmsOvertemperature, (1<<1)) \
|
||||||
|
fnc(ChargingOvervoltage, (1<<2)) \
|
||||||
|
fnc(DischargeUndervoltage, (1<<3)) \
|
||||||
|
fnc(BatteryOvertemperature, (1<<4)) \
|
||||||
|
fnc(ChargingOvercurrent, (1<<5)) \
|
||||||
|
fnc(DischargeOvercurrent, (1<<6)) \
|
||||||
|
fnc(CellVoltageDifference, (1<<7)) \
|
||||||
|
fnc(BatteryBoxOvertemperature, (1<<8)) \
|
||||||
|
fnc(BatteryUndertemperature, (1<<9)) \
|
||||||
|
fnc(CellOvervoltage, (1<<10)) \
|
||||||
|
fnc(CellUndervoltage, (1<<11)) \
|
||||||
|
fnc(AProtect, (1<<12)) \
|
||||||
|
fnc(BProtect, (1<<13)) \
|
||||||
|
fnc(Reserved1, (1<<14)) \
|
||||||
|
fnc(Reserved2, (1<<15))
|
||||||
|
|
||||||
|
enum class AlarmBits : uint16_t {
|
||||||
|
#define ALARM_ENUM(name, value) name = value,
|
||||||
|
ALARM_BITS(ALARM_ENUM)
|
||||||
|
#undef ALARM_ENUM
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::map<AlarmBits, std::string> AlarmBitTexts = {
|
||||||
|
#define ALARM_TEXT(name, value) { AlarmBits::name, #name },
|
||||||
|
ALARM_BITS(ALARM_TEXT)
|
||||||
|
#undef ALARM_TEXT
|
||||||
|
};
|
||||||
|
|
||||||
|
#define STATUS_BITS(fnc) \
|
||||||
|
fnc(ChargingActive, (1<<0)) \
|
||||||
|
fnc(DischargingActive, (1<<1)) \
|
||||||
|
fnc(BalancingActive, (1<<2)) \
|
||||||
|
fnc(BatteryOnline, (1<<3))
|
||||||
|
|
||||||
|
enum class StatusBits : uint16_t {
|
||||||
|
#define STATUS_ENUM(name, value) name = value,
|
||||||
|
STATUS_BITS(STATUS_ENUM)
|
||||||
|
#undef STATUS_ENUM
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::map<StatusBits, std::string> StatusBitTexts = {
|
||||||
|
#define STATUS_TEXT(name, value) { StatusBits::name, #name },
|
||||||
|
STATUS_BITS(STATUS_TEXT)
|
||||||
|
#undef STATUS_TEXT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DataPointLabel : uint8_t {
|
||||||
|
CellsMilliVolt = 0x79,
|
||||||
|
BmsTempCelsius = 0x80,
|
||||||
|
BatteryTempOneCelsius = 0x81,
|
||||||
|
BatteryTempTwoCelsius = 0x82,
|
||||||
|
BatteryVoltageMilliVolt = 0x83,
|
||||||
|
BatteryCurrentMilliAmps = 0x84,
|
||||||
|
BatterySoCPercent = 0x85,
|
||||||
|
BatteryTemperatureSensorAmount = 0x86,
|
||||||
|
BatteryCycles = 0x87,
|
||||||
|
BatteryCycleCapacity = 0x89,
|
||||||
|
BatteryCellAmount = 0x8a,
|
||||||
|
AlarmsBitmask = 0x8b,
|
||||||
|
StatusBitmask = 0x8c,
|
||||||
|
TotalOvervoltageThresholdMilliVolt = 0x8e,
|
||||||
|
TotalUndervoltageThresholdMilliVolt = 0x8f,
|
||||||
|
CellOvervoltageThresholdMilliVolt = 0x90,
|
||||||
|
CellOvervoltageRecoveryMilliVolt = 0x91,
|
||||||
|
CellOvervoltageProtectionDelaySeconds = 0x92,
|
||||||
|
CellUndervoltageThresholdMilliVolt = 0x93,
|
||||||
|
CellUndervoltageRecoveryMilliVolt = 0x94,
|
||||||
|
CellUndervoltageProtectionDelaySeconds = 0x95,
|
||||||
|
CellVoltageDiffThresholdMilliVolt = 0x96,
|
||||||
|
DischargeOvercurrentThresholdAmperes = 0x97,
|
||||||
|
DischargeOvercurrentDelaySeconds = 0x98,
|
||||||
|
ChargeOvercurrentThresholdAmps = 0x99,
|
||||||
|
ChargeOvercurrentDelaySeconds = 0x9a,
|
||||||
|
BalanceCellVoltageThresholdMilliVolt = 0x9b,
|
||||||
|
BalanceVoltageDiffThresholdMilliVolt = 0x9c,
|
||||||
|
BalancingEnabled = 0x9d,
|
||||||
|
BmsTempProtectionThresholdCelsius = 0x9e,
|
||||||
|
BmsTempRecoveryThresholdCelsius = 0x9f,
|
||||||
|
BatteryTempProtectionThresholdCelsius = 0xa0,
|
||||||
|
BatteryTempRecoveryThresholdCelsius = 0xa1,
|
||||||
|
BatteryTempDiffThresholdCelsius = 0xa2,
|
||||||
|
ChargeHighTempThresholdCelsius = 0xa3,
|
||||||
|
DischargeHighTempThresholdCelsius = 0xa4,
|
||||||
|
ChargeLowTempThresholdCelsius = 0xa5,
|
||||||
|
ChargeLowTempRecoveryCelsius = 0xa6,
|
||||||
|
DischargeLowTempThresholdCelsius = 0xa7,
|
||||||
|
DischargeLowTempRecoveryCelsius = 0xa8,
|
||||||
|
CellAmountSetting = 0xa9,
|
||||||
|
BatteryCapacitySettingAmpHours = 0xaa,
|
||||||
|
BatteryChargeEnabled = 0xab,
|
||||||
|
BatteryDischargeEnabled = 0xac,
|
||||||
|
CurrentCalibrationMilliAmps = 0xad,
|
||||||
|
BmsAddress = 0xae,
|
||||||
|
BatteryType = 0xaf,
|
||||||
|
SleepWaitTime = 0xb0, // what's this?
|
||||||
|
LowCapacityAlarmThresholdPercent = 0xb1,
|
||||||
|
ModificationPassword = 0xb2,
|
||||||
|
DedicatedChargerSwitch = 0xb3, // what's this?
|
||||||
|
EquipmentId = 0xb4,
|
||||||
|
DateOfManufacturing = 0xb5,
|
||||||
|
BmsHourMeterMinutes = 0xb6,
|
||||||
|
BmsSoftwareVersion = 0xb7,
|
||||||
|
CurrentCalibration = 0xb8,
|
||||||
|
ActualBatteryCapacityAmpHours = 0xb9,
|
||||||
|
ProductId = 0xba,
|
||||||
|
ProtocolVersion = 0xc0
|
||||||
|
};
|
||||||
|
|
||||||
|
using tCells = std::map<uint8_t, uint16_t>;
|
||||||
|
|
||||||
|
template<DataPointLabel> struct DataPointLabelTraits;
|
||||||
|
|
||||||
|
#define LABEL_TRAIT(n, t, u) template<> struct DataPointLabelTraits<DataPointLabel::n> { \
|
||||||
|
using type = t; \
|
||||||
|
static constexpr char const name[] = #n; \
|
||||||
|
static constexpr char const unit[] = u; \
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the types associated with the labels are the types for the respective data
|
||||||
|
* points in the JkBms::DataPoint class. they are *not* always equal to the
|
||||||
|
* type used in the serial message.
|
||||||
|
*
|
||||||
|
* it is unfortunate that we have to repeat all enum values here to define the
|
||||||
|
* traits. code generation could help here (labels are defined in a single
|
||||||
|
* source of truth and this code is generated -- no typing errors, etc.).
|
||||||
|
* however, the compiler will complain if an enum is misspelled or traits are
|
||||||
|
* defined for a removed enum, so we will notice. it will also complain when a
|
||||||
|
* trait is missing and if a data point for a label without traits is added to
|
||||||
|
* the DataPointContainer class, because the traits must be available then.
|
||||||
|
* even though this is tedious to maintain, human errors will be caught.
|
||||||
|
*/
|
||||||
|
LABEL_TRAIT(CellsMilliVolt, tCells, "mV");
|
||||||
|
LABEL_TRAIT(BmsTempCelsius, int16_t, "°C");
|
||||||
|
LABEL_TRAIT(BatteryTempOneCelsius, int16_t, "°C");
|
||||||
|
LABEL_TRAIT(BatteryTempTwoCelsius, int16_t, "°C");
|
||||||
|
LABEL_TRAIT(BatteryVoltageMilliVolt, uint32_t, "mV");
|
||||||
|
LABEL_TRAIT(BatteryCurrentMilliAmps, int32_t, "mA");
|
||||||
|
LABEL_TRAIT(BatterySoCPercent, uint8_t, "%");
|
||||||
|
LABEL_TRAIT(BatteryTemperatureSensorAmount, uint8_t, "");
|
||||||
|
LABEL_TRAIT(BatteryCycles, uint16_t, "");
|
||||||
|
LABEL_TRAIT(BatteryCycleCapacity, uint32_t, "Ah");
|
||||||
|
LABEL_TRAIT(BatteryCellAmount, uint16_t, "");
|
||||||
|
LABEL_TRAIT(AlarmsBitmask, uint16_t, "");
|
||||||
|
LABEL_TRAIT(StatusBitmask, uint16_t, "");
|
||||||
|
LABEL_TRAIT(TotalOvervoltageThresholdMilliVolt, uint32_t, "mV");
|
||||||
|
LABEL_TRAIT(TotalUndervoltageThresholdMilliVolt, uint32_t, "mV");
|
||||||
|
LABEL_TRAIT(CellOvervoltageThresholdMilliVolt, uint16_t, "mV");
|
||||||
|
LABEL_TRAIT(CellOvervoltageRecoveryMilliVolt, uint16_t, "mV");
|
||||||
|
LABEL_TRAIT(CellOvervoltageProtectionDelaySeconds, uint16_t, "s");
|
||||||
|
LABEL_TRAIT(CellUndervoltageThresholdMilliVolt, uint16_t, "mV");
|
||||||
|
LABEL_TRAIT(CellUndervoltageRecoveryMilliVolt, uint16_t, "mV");
|
||||||
|
LABEL_TRAIT(CellUndervoltageProtectionDelaySeconds, uint16_t, "s");
|
||||||
|
LABEL_TRAIT(CellVoltageDiffThresholdMilliVolt, uint16_t, "mV");
|
||||||
|
LABEL_TRAIT(DischargeOvercurrentThresholdAmperes, uint16_t, "A");
|
||||||
|
LABEL_TRAIT(DischargeOvercurrentDelaySeconds, uint16_t, "s");
|
||||||
|
LABEL_TRAIT(ChargeOvercurrentThresholdAmps, uint16_t, "A");
|
||||||
|
LABEL_TRAIT(ChargeOvercurrentDelaySeconds, uint16_t, "s");
|
||||||
|
LABEL_TRAIT(BalanceCellVoltageThresholdMilliVolt, uint16_t, "mV");
|
||||||
|
LABEL_TRAIT(BalanceVoltageDiffThresholdMilliVolt, uint16_t, "mV");
|
||||||
|
LABEL_TRAIT(BalancingEnabled, bool, "");
|
||||||
|
LABEL_TRAIT(BmsTempProtectionThresholdCelsius, uint16_t, "°C");
|
||||||
|
LABEL_TRAIT(BmsTempRecoveryThresholdCelsius, uint16_t, "°C");
|
||||||
|
LABEL_TRAIT(BatteryTempProtectionThresholdCelsius, uint16_t, "°C");
|
||||||
|
LABEL_TRAIT(BatteryTempRecoveryThresholdCelsius, uint16_t, "°C");
|
||||||
|
LABEL_TRAIT(BatteryTempDiffThresholdCelsius, uint16_t, "°C");
|
||||||
|
LABEL_TRAIT(ChargeHighTempThresholdCelsius, uint16_t, "°C");
|
||||||
|
LABEL_TRAIT(DischargeHighTempThresholdCelsius, uint16_t, "°C");
|
||||||
|
LABEL_TRAIT(ChargeLowTempThresholdCelsius, int16_t, "°C");
|
||||||
|
LABEL_TRAIT(ChargeLowTempRecoveryCelsius, int16_t, "°C");
|
||||||
|
LABEL_TRAIT(DischargeLowTempThresholdCelsius, int16_t, "°C");
|
||||||
|
LABEL_TRAIT(DischargeLowTempRecoveryCelsius, int16_t, "°C");
|
||||||
|
LABEL_TRAIT(CellAmountSetting, uint8_t, "");
|
||||||
|
LABEL_TRAIT(BatteryCapacitySettingAmpHours, uint32_t, "Ah");
|
||||||
|
LABEL_TRAIT(BatteryChargeEnabled, bool, "");
|
||||||
|
LABEL_TRAIT(BatteryDischargeEnabled, bool, "");
|
||||||
|
LABEL_TRAIT(CurrentCalibrationMilliAmps, uint16_t, "mA");
|
||||||
|
LABEL_TRAIT(BmsAddress, uint8_t, "");
|
||||||
|
LABEL_TRAIT(BatteryType, uint8_t, "");
|
||||||
|
LABEL_TRAIT(SleepWaitTime, uint16_t, "s");
|
||||||
|
LABEL_TRAIT(LowCapacityAlarmThresholdPercent, uint8_t, "%");
|
||||||
|
LABEL_TRAIT(ModificationPassword, std::string, "");
|
||||||
|
LABEL_TRAIT(DedicatedChargerSwitch, bool, "");
|
||||||
|
LABEL_TRAIT(EquipmentId, std::string, "");
|
||||||
|
LABEL_TRAIT(DateOfManufacturing, std::string, "");
|
||||||
|
LABEL_TRAIT(BmsHourMeterMinutes, uint32_t, "min");
|
||||||
|
LABEL_TRAIT(BmsSoftwareVersion, std::string, "");
|
||||||
|
LABEL_TRAIT(CurrentCalibration, bool, "");
|
||||||
|
LABEL_TRAIT(ActualBatteryCapacityAmpHours, uint32_t, "Ah");
|
||||||
|
LABEL_TRAIT(ProductId, std::string, "");
|
||||||
|
LABEL_TRAIT(ProtocolVersion, uint8_t, "");
|
||||||
|
#undef LABEL_TRAIT
|
||||||
|
|
||||||
|
class DataPoint {
|
||||||
|
friend class DataPointContainer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
using tValue = std::variant<bool, uint8_t, uint16_t, uint32_t,
|
||||||
|
int16_t, int32_t, std::string, tCells>;
|
||||||
|
|
||||||
|
DataPoint() = delete;
|
||||||
|
|
||||||
|
DataPoint(DataPoint const& other)
|
||||||
|
: _strLabel(other._strLabel)
|
||||||
|
, _strValue(other._strValue)
|
||||||
|
, _strUnit(other._strUnit)
|
||||||
|
, _value(other._value)
|
||||||
|
, _timestamp(other._timestamp) { }
|
||||||
|
|
||||||
|
DataPoint(std::string const& strLabel, std::string const& strValue,
|
||||||
|
std::string const& strUnit, tValue value, uint32_t timestamp)
|
||||||
|
: _strLabel(strLabel)
|
||||||
|
, _strValue(strValue)
|
||||||
|
, _strUnit(strUnit)
|
||||||
|
, _value(std::move(value))
|
||||||
|
, _timestamp(timestamp) { }
|
||||||
|
|
||||||
|
std::string const& getLabelText() const { return _strLabel; }
|
||||||
|
std::string const& getValueText() const { return _strValue; }
|
||||||
|
std::string const& getUnitText() const { return _strUnit; }
|
||||||
|
uint32_t getTimestamp() const { return _timestamp; }
|
||||||
|
|
||||||
|
bool operator==(DataPoint const& other) const {
|
||||||
|
return _value == other._value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _strLabel;
|
||||||
|
std::string _strValue;
|
||||||
|
std::string _strUnit;
|
||||||
|
tValue _value;
|
||||||
|
uint32_t _timestamp;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T> std::string dataPointValueToStr(T const& v);
|
||||||
|
|
||||||
|
class DataPointContainer {
|
||||||
|
public:
|
||||||
|
DataPointContainer() = default;
|
||||||
|
|
||||||
|
using Label = DataPointLabel;
|
||||||
|
template<Label L> using Traits = JkBms::DataPointLabelTraits<L>;
|
||||||
|
|
||||||
|
template<Label L>
|
||||||
|
void add(typename Traits<L>::type val) {
|
||||||
|
_dataPoints.emplace(
|
||||||
|
L,
|
||||||
|
DataPoint(
|
||||||
|
Traits<L>::name,
|
||||||
|
dataPointValueToStr(val),
|
||||||
|
Traits<L>::unit,
|
||||||
|
DataPoint::tValue(std::move(val)),
|
||||||
|
millis()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure add() is only called with the type expected for the
|
||||||
|
// respective label, no implicit conversions allowed.
|
||||||
|
template<Label L, typename T>
|
||||||
|
void add(T) = delete;
|
||||||
|
|
||||||
|
template<Label L>
|
||||||
|
std::optional<DataPoint const> getDataPointFor() const {
|
||||||
|
auto it = _dataPoints.find(L);
|
||||||
|
if (it == _dataPoints.end()) { return std::nullopt; }
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<Label L>
|
||||||
|
std::optional<typename Traits<L>::type> get() const {
|
||||||
|
auto optionalDataPoint = getDataPointFor<L>();
|
||||||
|
if (!optionalDataPoint.has_value()) { return std::nullopt; }
|
||||||
|
return std::get<typename Traits<L>::type>(optionalDataPoint->_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
using tMap = std::unordered_map<Label, DataPoint const>;
|
||||||
|
tMap::const_iterator cbegin() const { return _dataPoints.cbegin(); }
|
||||||
|
tMap::const_iterator cend() const { return _dataPoints.cend(); }
|
||||||
|
|
||||||
|
// copy all data points from source into this instance, overwriting
|
||||||
|
// existing data points in this instance.
|
||||||
|
void updateFrom(DataPointContainer const& source);
|
||||||
|
|
||||||
|
private:
|
||||||
|
tMap _dataPoints;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace JkBms */
|
||||||
93
include/JkBmsSerialMessage.h
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#include "JkBmsDataPoints.h"
|
||||||
|
|
||||||
|
namespace JkBms {
|
||||||
|
|
||||||
|
class SerialMessage {
|
||||||
|
public:
|
||||||
|
using tData = std::vector<uint8_t>;
|
||||||
|
|
||||||
|
SerialMessage() = delete;
|
||||||
|
|
||||||
|
enum class Command : uint8_t {
|
||||||
|
Activate = 0x01,
|
||||||
|
Write = 0x02,
|
||||||
|
Read = 0x03,
|
||||||
|
Password = 0x05,
|
||||||
|
ReadAll = 0x06
|
||||||
|
};
|
||||||
|
|
||||||
|
Command getCommand() const { return static_cast<Command>(_raw[8]); }
|
||||||
|
|
||||||
|
enum class Source : uint8_t {
|
||||||
|
BMS = 0x00,
|
||||||
|
Bluetooth = 0x01,
|
||||||
|
GPS = 0x02,
|
||||||
|
Host = 0x03
|
||||||
|
};
|
||||||
|
Source getSource() const { return static_cast<Source>(_raw[9]); }
|
||||||
|
|
||||||
|
enum class Type : uint8_t {
|
||||||
|
Command = 0x00,
|
||||||
|
Response = 0x01,
|
||||||
|
Unsolicited = 0x02
|
||||||
|
};
|
||||||
|
Type getType() const { return static_cast<Type>(_raw[10]); }
|
||||||
|
|
||||||
|
// this does *not* include the two byte start marker
|
||||||
|
uint16_t getFrameLength() const { return get<uint16_t>(_raw.cbegin()+2); }
|
||||||
|
|
||||||
|
uint32_t getTerminalId() const { return get<uint32_t>(_raw.cbegin()+4); }
|
||||||
|
|
||||||
|
// there are 20 bytes of overhead. two of those are the start marker
|
||||||
|
// bytes, which are *not* counted by the frame length.
|
||||||
|
uint16_t getVariableFieldLength() const { return getFrameLength() - 18; }
|
||||||
|
|
||||||
|
// the upper byte of the 4-byte "record number" is reserved (for encryption)
|
||||||
|
uint32_t getSequence() const { return get<uint32_t>(_raw.cend()-9) >> 8; }
|
||||||
|
|
||||||
|
bool isValid() const;
|
||||||
|
|
||||||
|
uint8_t const* data() { return _raw.data(); }
|
||||||
|
size_t size() { return _raw.size(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
template <typename... Args>
|
||||||
|
explicit SerialMessage(Args&&... args) : _raw(std::forward<Args>(args)...) { }
|
||||||
|
|
||||||
|
template<typename T, typename It> T get(It&& pos) const;
|
||||||
|
template<typename It> bool getBool(It&& pos) const;
|
||||||
|
template<typename It> int16_t getTemperature(It&& pos) const;
|
||||||
|
template<typename It> std::string getString(It&& pos, size_t len, bool replaceZeroes = false) const;
|
||||||
|
void processBatteryCurrent(tData::const_iterator& pos, uint8_t protocolVersion);
|
||||||
|
template<typename T> void set(tData::iterator const& pos, T val);
|
||||||
|
uint16_t calcChecksum() const;
|
||||||
|
void updateChecksum();
|
||||||
|
|
||||||
|
tData _raw;
|
||||||
|
JkBms::DataPointContainer _dp;
|
||||||
|
|
||||||
|
static constexpr uint16_t startMarker = 0x4e57;
|
||||||
|
static constexpr uint8_t endMarker = 0x68;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SerialResponse : public SerialMessage {
|
||||||
|
public:
|
||||||
|
using tData = SerialMessage::tData;
|
||||||
|
explicit SerialResponse(tData&& raw, uint8_t protocolVersion = -1);
|
||||||
|
|
||||||
|
DataPointContainer const& getDataPoints() const { return _dp; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class SerialCommand : public SerialMessage {
|
||||||
|
public:
|
||||||
|
using Command = SerialMessage::Command;
|
||||||
|
explicit SerialCommand(Command cmd);
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace JkBms */
|
||||||
@ -1,34 +1,40 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AsyncWebSocket.h>
|
#include <AsyncWebSocket.h>
|
||||||
#include <HardwareSerial.h>
|
#include <TaskSchedulerDeclarations.h>
|
||||||
#include <Stream.h>
|
#include <Print.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
#include <freertos/task.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <vector>
|
||||||
#define BUFFER_SIZE 500
|
#include <unordered_map>
|
||||||
|
#include <queue>
|
||||||
class MessageOutputClass : public Print {
|
|
||||||
public:
|
class MessageOutputClass : public Print {
|
||||||
MessageOutputClass();
|
public:
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
size_t write(uint8_t c) override;
|
size_t write(uint8_t c) override;
|
||||||
size_t write(const uint8_t* buffer, size_t size) override;
|
size_t write(const uint8_t* buffer, size_t size) override;
|
||||||
void register_ws_output(AsyncWebSocket* output);
|
void register_ws_output(AsyncWebSocket* output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
|
|
||||||
AsyncWebSocket* _ws = nullptr;
|
using message_t = std::vector<uint8_t>;
|
||||||
char _buffer[BUFFER_SIZE];
|
|
||||||
uint16_t _buff_pos = 0;
|
// we keep a buffer for every task and only write complete lines to the
|
||||||
uint32_t _lastSend = 0;
|
// serial output and then move them to be pushed through the websocket.
|
||||||
bool _forceSend = false;
|
// this way we prevent mangling of messages from different contexts.
|
||||||
|
std::unordered_map<TaskHandle_t, message_t> _task_messages;
|
||||||
std::mutex _msgLock;
|
std::queue<message_t> _lines;
|
||||||
};
|
|
||||||
|
AsyncWebSocket* _ws = nullptr;
|
||||||
extern MessageOutputClass MessageOutput;
|
|
||||||
|
std::mutex _msgLock;
|
||||||
|
|
||||||
|
void serialWrite(message_t const& m);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MessageOutputClass MessageOutput;
|
||||||
22
include/MqttBattery.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Battery.h"
|
||||||
|
#include <espMqttClient.h>
|
||||||
|
|
||||||
|
class MqttBattery : public BatteryProvider {
|
||||||
|
public:
|
||||||
|
MqttBattery() = default;
|
||||||
|
|
||||||
|
bool init(bool verboseLogging) final;
|
||||||
|
void deinit() final;
|
||||||
|
void loop() final { return; } // this class is event-driven
|
||||||
|
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _verboseLogging = false;
|
||||||
|
String _socTopic;
|
||||||
|
std::shared_ptr<MqttBatteryStats> _stats = std::make_shared<MqttBatteryStats>();
|
||||||
|
|
||||||
|
void onMqttMessage(espMqttClientTypes::MessageProperties const& properties,
|
||||||
|
char const* topic, uint8_t const* payload, size_t len, size_t index, size_t total);
|
||||||
|
};
|
||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
class MqttHandleDtuClass {
|
class MqttHandleDtuClass {
|
||||||
public:
|
public:
|
||||||
MqttHandleDtuClass();
|
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -15,4 +14,4 @@ private:
|
|||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MqttHandleDtuClass MqttHandleDtu;
|
extern MqttHandleDtuClass MqttHandleDtu;
|
||||||
@ -6,42 +6,29 @@
|
|||||||
#include <TaskSchedulerDeclarations.h>
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
// mqtt discovery device classes
|
// mqtt discovery device classes
|
||||||
enum DeviceClassType {
|
enum {
|
||||||
DEVICE_CLS_NONE = 0,
|
DEVICE_CLS_NONE = 0,
|
||||||
DEVICE_CLS_CURRENT,
|
DEVICE_CLS_CURRENT,
|
||||||
DEVICE_CLS_ENERGY,
|
DEVICE_CLS_ENERGY,
|
||||||
DEVICE_CLS_PWR,
|
DEVICE_CLS_PWR,
|
||||||
DEVICE_CLS_VOLTAGE,
|
DEVICE_CLS_VOLTAGE,
|
||||||
DEVICE_CLS_FREQ,
|
DEVICE_CLS_FREQ,
|
||||||
|
DEVICE_CLS_TEMP,
|
||||||
DEVICE_CLS_POWER_FACTOR,
|
DEVICE_CLS_POWER_FACTOR,
|
||||||
DEVICE_CLS_REACTIVE_POWER,
|
DEVICE_CLS_REACTIVE_POWER
|
||||||
DEVICE_CLS_CONNECTIVITY,
|
|
||||||
DEVICE_CLS_DURATION,
|
|
||||||
DEVICE_CLS_SIGNAL_STRENGTH,
|
|
||||||
DEVICE_CLS_TEMPERATURE,
|
|
||||||
DEVICE_CLS_RESTART
|
|
||||||
};
|
};
|
||||||
const char* const deviceClass_name[] = { 0, "current", "energy", "power", "voltage", "frequency", "power_factor", "reactive_power", "connectivity", "duration", "signal_strength", "temperature", "restart" };
|
const char* const deviceClasses[] = { 0, "current", "energy", "power", "voltage", "frequency", "temperature", "power_factor", "reactive_power" };
|
||||||
|
enum {
|
||||||
enum StateClassType {
|
|
||||||
STATE_CLS_NONE = 0,
|
STATE_CLS_NONE = 0,
|
||||||
STATE_CLS_MEASUREMENT,
|
STATE_CLS_MEASUREMENT,
|
||||||
STATE_CLS_TOTAL_INCREASING
|
STATE_CLS_TOTAL_INCREASING
|
||||||
};
|
};
|
||||||
const char* const stateClass_name[] = { 0, "measurement", "total_increasing" };
|
const char* const stateClasses[] = { 0, "measurement", "total_increasing" };
|
||||||
|
|
||||||
enum CategoryType {
|
|
||||||
CATEGORY_NONE = 0,
|
|
||||||
CATEGORY_CONFIG,
|
|
||||||
CATEGORY_DIAGNOSTIC
|
|
||||||
};
|
|
||||||
const char* const category_name[] = { 0, "config", "diagnostic" };
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FieldId_t fieldId; // field id
|
FieldId_t fieldId; // field id
|
||||||
DeviceClassType deviceClsId; // device class
|
uint8_t deviceClsId; // device class
|
||||||
StateClassType stateClsId; // state class
|
uint8_t stateClsId; // state class
|
||||||
} byteAssign_fieldDeviceClass_t;
|
} byteAssign_fieldDeviceClass_t;
|
||||||
|
|
||||||
const byteAssign_fieldDeviceClass_t deviceFieldAssignment[] = {
|
const byteAssign_fieldDeviceClass_t deviceFieldAssignment[] = {
|
||||||
@ -54,7 +41,7 @@ const byteAssign_fieldDeviceClass_t deviceFieldAssignment[] = {
|
|||||||
{ FLD_IAC, DEVICE_CLS_CURRENT, STATE_CLS_MEASUREMENT },
|
{ FLD_IAC, DEVICE_CLS_CURRENT, STATE_CLS_MEASUREMENT },
|
||||||
{ FLD_PAC, DEVICE_CLS_PWR, STATE_CLS_MEASUREMENT },
|
{ FLD_PAC, DEVICE_CLS_PWR, STATE_CLS_MEASUREMENT },
|
||||||
{ FLD_F, DEVICE_CLS_FREQ, STATE_CLS_MEASUREMENT },
|
{ FLD_F, DEVICE_CLS_FREQ, STATE_CLS_MEASUREMENT },
|
||||||
{ FLD_T, DEVICE_CLS_TEMPERATURE, STATE_CLS_MEASUREMENT },
|
{ FLD_T, DEVICE_CLS_TEMP, STATE_CLS_MEASUREMENT },
|
||||||
{ FLD_PF, DEVICE_CLS_POWER_FACTOR, STATE_CLS_MEASUREMENT },
|
{ FLD_PF, DEVICE_CLS_POWER_FACTOR, STATE_CLS_MEASUREMENT },
|
||||||
{ FLD_EFF, DEVICE_CLS_NONE, STATE_CLS_NONE },
|
{ FLD_EFF, DEVICE_CLS_NONE, STATE_CLS_NONE },
|
||||||
{ FLD_IRR, DEVICE_CLS_NONE, STATE_CLS_NONE },
|
{ FLD_IRR, DEVICE_CLS_NONE, STATE_CLS_NONE },
|
||||||
@ -64,36 +51,24 @@ const byteAssign_fieldDeviceClass_t deviceFieldAssignment[] = {
|
|||||||
|
|
||||||
class MqttHandleHassClass {
|
class MqttHandleHassClass {
|
||||||
public:
|
public:
|
||||||
MqttHandleHassClass();
|
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
void publishConfig();
|
void publishConfig();
|
||||||
void forceUpdate();
|
void forceUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
static void publish(const String& subtopic, const String& payload);
|
void publish(const String& subtopic, const String& payload);
|
||||||
static void publish(const String& subtopic, const JsonDocument& doc);
|
void publishDtuSensor(const char* name, const char* device_class, const char* category, const char* icon, const char* unit_of_measure, const char* subTopic);
|
||||||
|
void publishDtuBinarySensor(const char* name, const char* device_class, const char* category, const char* payload_on, const char* payload_off, const char* subTopic = "");
|
||||||
|
void publishInverterField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const byteAssign_fieldDeviceClass_t fieldType, const bool clear = false);
|
||||||
|
void publishInverterButton(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category, const char* deviceClass, const char* subTopic, const char* payload);
|
||||||
|
void publishInverterNumber(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category, const char* commandTopic, const char* stateTopic, const char* unitOfMeasure, const int16_t min = 1, const int16_t max = 100);
|
||||||
|
void publishInverterBinarySensor(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* subTopic, const char* payload_on, const char* payload_off);
|
||||||
|
|
||||||
static void addCommonMetadata(JsonDocument& doc, const String& unit_of_measure, const String& icon, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
static void createInverterInfo(DynamicJsonDocument& doc, std::shared_ptr<InverterAbstract> inv);
|
||||||
|
static void createDtuInfo(DynamicJsonDocument& doc);
|
||||||
|
|
||||||
// Binary Sensor
|
static void createDeviceInfo(DynamicJsonDocument& doc, const String& name, const String& identifiers, const String& configuration_url, const String& manufacturer, const String& model, const String& sw_version, const String& via_device = "");
|
||||||
static void publishBinarySensor(JsonDocument& doc, const String& root_device, const String& unique_id_prefix, const String& name, const String& state_topic, const String& payload_on, const String& payload_off, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
|
||||||
static void publishDtuBinarySensor(const String& name, const String& state_topic, const String& payload_on, const String& payload_off, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
|
||||||
static void publishInverterBinarySensor(std::shared_ptr<InverterAbstract> inv, const String& name, const String& state_topic, const String& payload_on, const String& payload_off, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
|
||||||
|
|
||||||
// Sensor
|
|
||||||
static void publishSensor(JsonDocument& doc, const String& root_device, const String& unique_id_prefix, const String& name, const String& state_topic, const String& unit_of_measure, const String& icon, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
|
||||||
static void publishDtuSensor(const String& name, const String& state_topic, const String& unit_of_measure, const String& icon, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
|
||||||
static void publishInverterSensor(std::shared_ptr<InverterAbstract> inv, const String& name, const String& state_topic, const String& unit_of_measure, const String& icon, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
|
||||||
|
|
||||||
static void publishInverterField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const byteAssign_fieldDeviceClass_t fieldType, const bool clear = false);
|
|
||||||
static void publishInverterButton(std::shared_ptr<InverterAbstract> inv, const String& name, const String& state_topic, const String& payload, const String& icon, const DeviceClassType device_class, const StateClassType state_class, const CategoryType category);
|
|
||||||
static void publishInverterNumber(std::shared_ptr<InverterAbstract> inv, const String& name, const String& state_topic, const String& command_topic, const int16_t min, const int16_t max, float step, const String& unit_of_measure, const String& icon, const StateClassType state_class, const CategoryType category);
|
|
||||||
|
|
||||||
static void createInverterInfo(JsonDocument& doc, std::shared_ptr<InverterAbstract> inv);
|
|
||||||
static void createDtuInfo(JsonDocument& doc);
|
|
||||||
|
|
||||||
static void createDeviceInfo(JsonDocument& doc, const String& name, const String& identifiers, const String& configuration_url, const String& manufacturer, const String& model, const String& sw_version, const String& via_device = "");
|
|
||||||
|
|
||||||
static String getDtuUniqueId();
|
static String getDtuUniqueId();
|
||||||
static String getDtuUrl();
|
static String getDtuUrl();
|
||||||
@ -104,4 +79,4 @@ private:
|
|||||||
bool _updateForced = false;
|
bool _updateForced = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MqttHandleHassClass MqttHandleHass;
|
extern MqttHandleHassClass MqttHandleHass;
|
||||||
44
include/MqttHandleHuawei.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Configuration.h"
|
||||||
|
#include <Huawei_can.h>
|
||||||
|
#include <espMqttClient.h>
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
#include <mutex>
|
||||||
|
#include <deque>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
class MqttHandleHuaweiClass {
|
||||||
|
public:
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
enum class Topic : unsigned {
|
||||||
|
LimitOnlineVoltage,
|
||||||
|
LimitOnlineCurrent,
|
||||||
|
LimitOfflineVoltage,
|
||||||
|
LimitOfflineCurrent,
|
||||||
|
Mode
|
||||||
|
};
|
||||||
|
|
||||||
|
void onMqttMessage(Topic t,
|
||||||
|
const espMqttClientTypes::MessageProperties& properties,
|
||||||
|
const char* topic, const uint8_t* payload, size_t len,
|
||||||
|
size_t index, size_t total);
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
uint32_t _lastPublishStats;
|
||||||
|
uint32_t _lastPublish;
|
||||||
|
|
||||||
|
// MQTT callbacks to process updates on subscribed topics are executed in
|
||||||
|
// the MQTT thread's context. we use this queue to switch processing the
|
||||||
|
// user requests into the main loop's context (TaskScheduler context).
|
||||||
|
mutable std::mutex _mqttMutex;
|
||||||
|
std::deque<std::function<void()>> _mqttCallbacks;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MqttHandleHuaweiClass MqttHandleHuawei;
|
||||||
@ -5,22 +5,17 @@
|
|||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
#include <TaskSchedulerDeclarations.h>
|
||||||
#include <espMqttClient.h>
|
#include <espMqttClient.h>
|
||||||
#include <frozen/map.h>
|
|
||||||
#include <frozen/string.h>
|
|
||||||
|
|
||||||
class MqttHandleInverterClass {
|
class MqttHandleInverterClass {
|
||||||
public:
|
public:
|
||||||
MqttHandleInverterClass();
|
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
static String getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
static String getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
|
|
||||||
void subscribeTopics();
|
|
||||||
void unsubscribeTopics();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
void publishField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
void publishField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
|
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, const size_t len, const size_t index, const size_t total);
|
||||||
|
|
||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
|
|
||||||
@ -42,29 +37,6 @@ private:
|
|||||||
FLD_IRR,
|
FLD_IRR,
|
||||||
FLD_Q
|
FLD_Q
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Topic : unsigned {
|
|
||||||
LimitPersistentRelative,
|
|
||||||
LimitPersistentAbsolute,
|
|
||||||
LimitNonPersistentRelative,
|
|
||||||
LimitNonPersistentAbsolute,
|
|
||||||
Power,
|
|
||||||
Restart,
|
|
||||||
ResetRfStats,
|
|
||||||
};
|
|
||||||
|
|
||||||
static constexpr frozen::string _cmdtopic = "+/cmd/";
|
|
||||||
static constexpr frozen::map<frozen::string, Topic, 7> _subscriptions = {
|
|
||||||
{ "limit_persistent_relative", Topic::LimitPersistentRelative },
|
|
||||||
{ "limit_persistent_absolute", Topic::LimitPersistentAbsolute },
|
|
||||||
{ "limit_nonpersistent_relative", Topic::LimitNonPersistentRelative },
|
|
||||||
{ "limit_nonpersistent_absolute", Topic::LimitNonPersistentAbsolute },
|
|
||||||
{ "power", Topic::Power },
|
|
||||||
{ "restart", Topic::Restart },
|
|
||||||
{ "reset_rf_stats", Topic::ResetRfStats },
|
|
||||||
};
|
|
||||||
|
|
||||||
void onMqttMessage(Topic t, const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, const size_t len, const size_t index, const size_t total);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MqttHandleInverterClass MqttHandleInverter;
|
extern MqttHandleInverterClass MqttHandleInverter;
|
||||||
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
class MqttHandleInverterTotalClass {
|
class MqttHandleInverterTotalClass {
|
||||||
public:
|
public:
|
||||||
MqttHandleInverterTotalClass();
|
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -14,4 +13,4 @@ private:
|
|||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MqttHandleInverterTotalClass MqttHandleInverterTotal;
|
extern MqttHandleInverterTotalClass MqttHandleInverterTotal;
|
||||||
31
include/MqttHandlePowerLimiter.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Configuration.h"
|
||||||
|
#include <espMqttClient.h>
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
#include <mutex>
|
||||||
|
#include <deque>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
class MqttHandlePowerLimiterClass {
|
||||||
|
public:
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
void onCmdMode(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total);
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
uint32_t _lastPublishStats;
|
||||||
|
uint32_t _lastPublish;
|
||||||
|
|
||||||
|
// MQTT callbacks to process updates on subscribed topics are executed in
|
||||||
|
// the MQTT thread's context. we use this queue to switch processing the
|
||||||
|
// user requests into the main loop's context (TaskScheduler context).
|
||||||
|
mutable std::mutex _mqttMutex;
|
||||||
|
std::deque<std::function<void()>> _mqttCallbacks;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MqttHandlePowerLimiterClass MqttHandlePowerLimiter;
|
||||||
27
include/MqttHandlePylontechHass.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
class MqttHandlePylontechHassClass {
|
||||||
|
public:
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
void publishConfig();
|
||||||
|
void forceUpdate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
void publish(const String& subtopic, const String& payload);
|
||||||
|
void publishBinarySensor(const char* caption, const char* icon, const char* subTopic, const char* payload_on, const char* payload_off);
|
||||||
|
void publishSensor(const char* caption, const char* icon, const char* subTopic, const char* deviceClass = NULL, const char* stateClass = NULL, const char* unitOfMeasurement = NULL);
|
||||||
|
void createDeviceInfo(JsonObject& object);
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
bool _wasConnected = false;
|
||||||
|
bool _updateForced = false;
|
||||||
|
String serial = "0001"; // pseudo-serial, can be replaced in future with real serialnumber
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MqttHandlePylontechHassClass MqttHandlePylontechHass;
|
||||||
36
include/MqttHandleVedirect.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "VeDirectMpptController.h"
|
||||||
|
#include "Configuration.h"
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
#ifndef VICTRON_PIN_RX
|
||||||
|
#define VICTRON_PIN_RX 22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef VICTRON_PIN_TX
|
||||||
|
#define VICTRON_PIN_TX 21
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class MqttHandleVedirectClass {
|
||||||
|
public:
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
void forceUpdate();
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
VeDirectMpptController::veMpptStruct _kvFrame{};
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
// point of time in millis() when updated values will be published
|
||||||
|
uint32_t _nextPublishUpdatesOnly = 0;
|
||||||
|
|
||||||
|
// point of time in millis() when all values will be published
|
||||||
|
uint32_t _nextPublishFull = 1;
|
||||||
|
|
||||||
|
bool _PublishFull;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MqttHandleVedirectClass MqttHandleVedirect;
|
||||||
27
include/MqttHandleVedirectHass.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
#include "VeDirectMpptController.h"
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
class MqttHandleVedirectHassClass {
|
||||||
|
public:
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
void publishConfig();
|
||||||
|
void forceUpdate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
void publish(const String& subtopic, const String& payload);
|
||||||
|
void publishBinarySensor(const char* caption, const char* icon, const char* subTopic, const char* payload_on, const char* payload_off);
|
||||||
|
void publishSensor(const char* caption, const char* icon, const char* subTopic, const char* deviceClass = NULL, const char* stateClass = NULL, const char* unitOfMeasurement = NULL);
|
||||||
|
void createDeviceInfo(JsonObject& object);
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
bool _wasConnected = false;
|
||||||
|
bool _updateForced = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MqttHandleVedirectHassClass MqttHandleVedirectHass;
|
||||||
@ -11,6 +11,7 @@ class MqttSettingsClass {
|
|||||||
public:
|
public:
|
||||||
MqttSettingsClass();
|
MqttSettingsClass();
|
||||||
void init();
|
void init();
|
||||||
|
void loop();
|
||||||
void performReconnect();
|
void performReconnect();
|
||||||
bool getConnected();
|
bool getConnected();
|
||||||
void publish(const String& subtopic, const String& payload);
|
void publish(const String& subtopic, const String& payload);
|
||||||
@ -20,7 +21,6 @@ public:
|
|||||||
void unsubscribe(const String& topic);
|
void unsubscribe(const String& topic);
|
||||||
|
|
||||||
String getPrefix() const;
|
String getPrefix() const;
|
||||||
String getClientId() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void NetworkEvent(network_event event);
|
void NetworkEvent(network_event event);
|
||||||
@ -38,6 +38,7 @@ private:
|
|||||||
Ticker _mqttReconnectTimer;
|
Ticker _mqttReconnectTimer;
|
||||||
MqttSubscribeParser _mqttSubscribeParser;
|
MqttSubscribeParser _mqttSubscribeParser;
|
||||||
std::mutex _clientLock;
|
std::mutex _clientLock;
|
||||||
|
bool _verboseLogging = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MqttSettingsClass MqttSettings;
|
extern MqttSettingsClass MqttSettings;
|
||||||
@ -1,7 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "W5500.h"
|
|
||||||
#include <DNSServer.h>
|
#include <DNSServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
#include <TaskSchedulerDeclarations.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
@ -24,18 +23,18 @@ enum class network_event {
|
|||||||
NETWORK_EVENT_MAX
|
NETWORK_EVENT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::function<void(network_event event)> DtuNetworkEventCb;
|
typedef std::function<void(network_event event)> NetworkEventCb;
|
||||||
|
|
||||||
typedef struct DtuNetworkEventCbList {
|
typedef struct NetworkEventCbList {
|
||||||
DtuNetworkEventCb cb;
|
NetworkEventCb cb;
|
||||||
network_event event;
|
network_event event;
|
||||||
|
|
||||||
DtuNetworkEventCbList()
|
NetworkEventCbList()
|
||||||
: cb(nullptr)
|
: cb(nullptr)
|
||||||
, event(network_event::NETWORK_UNKNOWN)
|
, event(network_event::NETWORK_UNKNOWN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} DtuNetworkEventCbList_t;
|
} NetworkEventCbList_t;
|
||||||
|
|
||||||
class NetworkSettingsClass {
|
class NetworkSettingsClass {
|
||||||
public:
|
public:
|
||||||
@ -54,7 +53,7 @@ public:
|
|||||||
bool isConnected() const;
|
bool isConnected() const;
|
||||||
network_mode NetworkMode() const;
|
network_mode NetworkMode() const;
|
||||||
|
|
||||||
bool onEvent(DtuNetworkEventCb cbEvent, const network_event event = network_event::NETWORK_EVENT_MAX);
|
bool onEvent(NetworkEventCb cbEvent, const network_event event = network_event::NETWORK_EVENT_MAX);
|
||||||
void raiseEvent(const network_event event);
|
void raiseEvent(const network_event event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -63,7 +62,7 @@ private:
|
|||||||
void setStaticIp();
|
void setStaticIp();
|
||||||
void handleMDNS();
|
void handleMDNS();
|
||||||
void setupMode();
|
void setupMode();
|
||||||
void NetworkEvent(const WiFiEvent_t event, WiFiEventInfo_t info);
|
void NetworkEvent(const WiFiEvent_t event);
|
||||||
|
|
||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
|
|
||||||
@ -82,9 +81,8 @@ private:
|
|||||||
bool _dnsServerStatus = false;
|
bool _dnsServerStatus = false;
|
||||||
network_mode _networkMode = network_mode::Undefined;
|
network_mode _networkMode = network_mode::Undefined;
|
||||||
bool _ethConnected = false;
|
bool _ethConnected = false;
|
||||||
std::vector<DtuNetworkEventCbList_t> _cbEventList;
|
std::vector<NetworkEventCbList_t> _cbEventList;
|
||||||
bool _lastMdnsEnabled = false;
|
bool _lastMdnsEnabled = false;
|
||||||
std::unique_ptr<W5500> _w5500;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NetworkSettingsClass NetworkSettings;
|
extern NetworkSettingsClass NetworkSettings;
|
||||||
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
struct PinMapping_t {
|
struct PinMapping_t {
|
||||||
char name[MAPPING_NAME_STRLEN + 1];
|
char name[MAPPING_NAME_STRLEN + 1];
|
||||||
|
|
||||||
int8_t nrf24_miso;
|
int8_t nrf24_miso;
|
||||||
int8_t nrf24_mosi;
|
int8_t nrf24_mosi;
|
||||||
int8_t nrf24_clk;
|
int8_t nrf24_clk;
|
||||||
@ -27,14 +26,6 @@ struct PinMapping_t {
|
|||||||
int8_t cmt_gpio3;
|
int8_t cmt_gpio3;
|
||||||
int8_t cmt_sdio;
|
int8_t cmt_sdio;
|
||||||
|
|
||||||
int8_t w5500_mosi;
|
|
||||||
int8_t w5500_miso;
|
|
||||||
int8_t w5500_sclk;
|
|
||||||
int8_t w5500_cs;
|
|
||||||
int8_t w5500_int;
|
|
||||||
int8_t w5500_rst;
|
|
||||||
|
|
||||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
|
||||||
int8_t eth_phy_addr;
|
int8_t eth_phy_addr;
|
||||||
bool eth_enabled;
|
bool eth_enabled;
|
||||||
int eth_power;
|
int eth_power;
|
||||||
@ -42,14 +33,23 @@ struct PinMapping_t {
|
|||||||
int eth_mdio;
|
int eth_mdio;
|
||||||
eth_phy_type_t eth_type;
|
eth_phy_type_t eth_type;
|
||||||
eth_clock_mode_t eth_clk_mode;
|
eth_clock_mode_t eth_clk_mode;
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t display_type;
|
uint8_t display_type;
|
||||||
uint8_t display_data;
|
uint8_t display_data;
|
||||||
uint8_t display_clk;
|
uint8_t display_clk;
|
||||||
uint8_t display_cs;
|
uint8_t display_cs;
|
||||||
uint8_t display_reset;
|
uint8_t display_reset;
|
||||||
|
int8_t victron_tx;
|
||||||
|
int8_t victron_rx;
|
||||||
|
int8_t battery_rx;
|
||||||
|
int8_t battery_rxen;
|
||||||
|
int8_t battery_tx;
|
||||||
|
int8_t battery_txen;
|
||||||
|
int8_t huawei_miso;
|
||||||
|
int8_t huawei_mosi;
|
||||||
|
int8_t huawei_clk;
|
||||||
|
int8_t huawei_irq;
|
||||||
|
int8_t huawei_cs;
|
||||||
|
int8_t huawei_power;
|
||||||
int8_t led[PINMAPPING_LED_COUNT];
|
int8_t led[PINMAPPING_LED_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,19 +59,13 @@ public:
|
|||||||
bool init(const String& deviceMapping);
|
bool init(const String& deviceMapping);
|
||||||
PinMapping_t& get();
|
PinMapping_t& get();
|
||||||
|
|
||||||
bool isMappingSelected() const { return _mappingSelected; }
|
|
||||||
|
|
||||||
bool isValidNrf24Config() const;
|
bool isValidNrf24Config() const;
|
||||||
bool isValidCmt2300Config() const;
|
bool isValidCmt2300Config() const;
|
||||||
bool isValidW5500Config() const;
|
|
||||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
|
||||||
bool isValidEthConfig() const;
|
bool isValidEthConfig() const;
|
||||||
#endif
|
bool isValidHuaweiConfig() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PinMapping_t _pinMapping;
|
PinMapping_t _pinMapping;
|
||||||
|
|
||||||
bool _mappingSelected = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PinMappingClass PinMapping;
|
extern PinMappingClass PinMapping;
|
||||||
|
|||||||
106
include/PowerLimiter.h
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Configuration.h"
|
||||||
|
#include <espMqttClient.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <Hoymiles.h>
|
||||||
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
#define PL_UI_STATE_INACTIVE 0
|
||||||
|
#define PL_UI_STATE_CHARGING 1
|
||||||
|
#define PL_UI_STATE_USE_SOLAR_ONLY 2
|
||||||
|
#define PL_UI_STATE_USE_SOLAR_AND_BATTERY 3
|
||||||
|
|
||||||
|
#define PL_MODE_ENABLE_NORMAL_OP 0
|
||||||
|
#define PL_MODE_FULL_DISABLE 1
|
||||||
|
#define PL_MODE_SOLAR_PT_ONLY 2
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
EMPTY_WHEN_FULL= 0,
|
||||||
|
EMPTY_AT_NIGHT
|
||||||
|
} batDrainStrategy;
|
||||||
|
|
||||||
|
|
||||||
|
class PowerLimiterClass {
|
||||||
|
public:
|
||||||
|
enum class Status : unsigned {
|
||||||
|
Initializing,
|
||||||
|
DisabledByConfig,
|
||||||
|
DisabledByMqtt,
|
||||||
|
WaitingForValidTimestamp,
|
||||||
|
PowerMeterDisabled,
|
||||||
|
PowerMeterTimeout,
|
||||||
|
PowerMeterPending,
|
||||||
|
InverterInvalid,
|
||||||
|
InverterChanged,
|
||||||
|
InverterOffline,
|
||||||
|
InverterCommandsDisabled,
|
||||||
|
InverterLimitPending,
|
||||||
|
InverterPowerCmdPending,
|
||||||
|
InverterDevInfoPending,
|
||||||
|
InverterStatsPending,
|
||||||
|
UnconditionalSolarPassthrough,
|
||||||
|
NoVeDirect,
|
||||||
|
Settling,
|
||||||
|
Stable,
|
||||||
|
};
|
||||||
|
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
uint8_t getPowerLimiterState();
|
||||||
|
int32_t getLastRequestedPowerLimit();
|
||||||
|
|
||||||
|
enum class Mode : unsigned {
|
||||||
|
Normal = 0,
|
||||||
|
Disabled = 1,
|
||||||
|
UnconditionalFullSolarPassthrough = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
void setMode(Mode m) { _mode = m; }
|
||||||
|
Mode getMode() const { return _mode; }
|
||||||
|
void calcNextInverterRestart();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
int32_t _lastRequestedPowerLimit = 0;
|
||||||
|
uint32_t _lastPowerLimitMillis = 0;
|
||||||
|
uint32_t _shutdownTimeout = 0;
|
||||||
|
Status _lastStatus = Status::Initializing;
|
||||||
|
uint32_t _lastStatusPrinted = 0;
|
||||||
|
uint32_t _lastCalculation = 0;
|
||||||
|
static constexpr uint32_t _calculationBackoffMsDefault = 128;
|
||||||
|
uint32_t _calculationBackoffMs = _calculationBackoffMsDefault;
|
||||||
|
Mode _mode = Mode::Normal;
|
||||||
|
std::shared_ptr<InverterAbstract> _inverter = nullptr;
|
||||||
|
bool _batteryDischargeEnabled = false;
|
||||||
|
uint32_t _nextInverterRestart = 0; // Values: 0->not calculated / 1->no restart configured / >1->time of next inverter restart in millis()
|
||||||
|
uint32_t _nextCalculateCheck = 5000; // time in millis for next NTP check to calulate restart
|
||||||
|
bool _fullSolarPassThroughEnabled = false;
|
||||||
|
bool _verboseLogging = true;
|
||||||
|
|
||||||
|
std::string const& getStatusText(Status status);
|
||||||
|
void announceStatus(Status status);
|
||||||
|
bool shutdown(Status status);
|
||||||
|
bool shutdown() { return shutdown(_lastStatus); }
|
||||||
|
int32_t inverterPowerDcToAc(std::shared_ptr<InverterAbstract> inverter, int32_t dcPower);
|
||||||
|
void unconditionalSolarPassthrough(std::shared_ptr<InverterAbstract> inverter);
|
||||||
|
bool canUseDirectSolarPower();
|
||||||
|
int32_t calcPowerLimit(std::shared_ptr<InverterAbstract> inverter, bool solarPowerEnabled, bool batteryDischargeEnabled);
|
||||||
|
void commitPowerLimit(std::shared_ptr<InverterAbstract> inverter, int32_t limit, bool enablePowerProduction);
|
||||||
|
bool setNewPowerLimit(std::shared_ptr<InverterAbstract> inverter, int32_t newPowerLimit);
|
||||||
|
int32_t getSolarChargePower();
|
||||||
|
float getLoadCorrectedVoltage();
|
||||||
|
bool testThreshold(float socThreshold, float voltThreshold,
|
||||||
|
std::function<bool(float, float)> compare);
|
||||||
|
bool isStartThresholdReached();
|
||||||
|
bool isStopThresholdReached();
|
||||||
|
bool isBelowStopThreshold();
|
||||||
|
bool useFullSolarPassthrough();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern PowerLimiterClass PowerLimiter;
|
||||||
79
include/PowerMeter.h
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Configuration.h"
|
||||||
|
#include <espMqttClient.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <map>
|
||||||
|
#include <list>
|
||||||
|
#include "SDM.h"
|
||||||
|
#include "sml.h"
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
#ifndef SDM_RX_PIN
|
||||||
|
#define SDM_RX_PIN 13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SDM_TX_PIN
|
||||||
|
#define SDM_TX_PIN 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SML_RX_PIN
|
||||||
|
#define SML_RX_PIN 35
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const unsigned char OBIS[6];
|
||||||
|
void (*Fn)(double&);
|
||||||
|
float* Arg;
|
||||||
|
} OBISHandler;
|
||||||
|
|
||||||
|
class PowerMeterClass {
|
||||||
|
public:
|
||||||
|
enum SOURCE {
|
||||||
|
SOURCE_MQTT = 0,
|
||||||
|
SOURCE_SDM1PH = 1,
|
||||||
|
SOURCE_SDM3PH = 2,
|
||||||
|
SOURCE_HTTP = 3,
|
||||||
|
SOURCE_SML = 4
|
||||||
|
};
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
float getPowerTotal(bool forceUpdate = true);
|
||||||
|
uint32_t getLastPowerMeterUpdate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
void mqtt();
|
||||||
|
|
||||||
|
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties,
|
||||||
|
const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total);
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
bool _verboseLogging = true;
|
||||||
|
uint32_t _lastPowerMeterCheck;
|
||||||
|
// Used in Power limiter for safety check
|
||||||
|
uint32_t _lastPowerMeterUpdate;
|
||||||
|
|
||||||
|
float _powerMeter1Power = 0.0;
|
||||||
|
float _powerMeter2Power = 0.0;
|
||||||
|
float _powerMeter3Power = 0.0;
|
||||||
|
float _powerMeter1Voltage = 0.0;
|
||||||
|
float _powerMeter2Voltage = 0.0;
|
||||||
|
float _powerMeter3Voltage = 0.0;
|
||||||
|
float _powerMeterImport = 0.0;
|
||||||
|
float _powerMeterExport = 0.0;
|
||||||
|
|
||||||
|
std::map<String, float*> _mqttSubscriptions;
|
||||||
|
|
||||||
|
void readPowerMeter();
|
||||||
|
|
||||||
|
bool smlReadLoop();
|
||||||
|
const std::list<OBISHandler> smlHandlerList{
|
||||||
|
{{0x01, 0x00, 0x10, 0x07, 0x00, 0xff}, &smlOBISW, &_powerMeter1Power},
|
||||||
|
{{0x01, 0x00, 0x01, 0x08, 0x00, 0xff}, &smlOBISWh, &_powerMeterImport},
|
||||||
|
{{0x01, 0x00, 0x02, 0x08, 0x00, 0xff}, &smlOBISWh, &_powerMeterExport}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extern PowerMeterClass PowerMeter;
|
||||||
29
include/PylontechCanReceiver.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Configuration.h"
|
||||||
|
#include "Battery.h"
|
||||||
|
#include <espMqttClient.h>
|
||||||
|
#include <driver/twai.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
class PylontechCanReceiver : public BatteryProvider {
|
||||||
|
public:
|
||||||
|
bool init(bool verboseLogging) final;
|
||||||
|
void deinit() final;
|
||||||
|
void loop() final;
|
||||||
|
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t readUnsignedInt16(uint8_t *data);
|
||||||
|
int16_t readSignedInt16(uint8_t *data);
|
||||||
|
float scaleValue(int16_t value, float factor);
|
||||||
|
bool getBit(uint8_t value, uint8_t bit);
|
||||||
|
|
||||||
|
void dummyData();
|
||||||
|
|
||||||
|
bool _verboseLogging = true;
|
||||||
|
std::shared_ptr<PylontechBatteryStats> _stats =
|
||||||
|
std::make_shared<PylontechBatteryStats>();
|
||||||
|
};
|
||||||
@ -1,18 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class RestartHelperClass {
|
|
||||||
public:
|
|
||||||
RestartHelperClass();
|
|
||||||
void init(Scheduler& scheduler);
|
|
||||||
void triggerRestart();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void loop();
|
|
||||||
|
|
||||||
Task _rebootTask;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern RestartHelperClass RestartHelper;
|
|
||||||
@ -1,8 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ArduinoJson.h>
|
|
||||||
#include <LittleFS.h>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
class Utils {
|
class Utils {
|
||||||
@ -10,8 +8,5 @@ public:
|
|||||||
static uint32_t getChipId();
|
static uint32_t getChipId();
|
||||||
static uint64_t generateDtuSerial();
|
static uint64_t generateDtuSerial();
|
||||||
static int getTimezoneOffset();
|
static int getTimezoneOffset();
|
||||||
static bool checkJsonAlloc(const JsonDocument& doc, const char* function, const uint16_t line);
|
static void restartDtu();
|
||||||
static void removeAllFiles();
|
|
||||||
static String generateMd5FromFile(String file);
|
|
||||||
static void skipBom(File& f);
|
|
||||||
};
|
};
|
||||||
|
|||||||
52
include/VictronMppt.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "VeDirectMpptController.h"
|
||||||
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
|
class VictronMpptClass {
|
||||||
|
public:
|
||||||
|
VictronMpptClass() = default;
|
||||||
|
~VictronMpptClass() = default;
|
||||||
|
|
||||||
|
void init(Scheduler& scheduler);
|
||||||
|
void updateSettings();
|
||||||
|
|
||||||
|
bool isDataValid() const;
|
||||||
|
|
||||||
|
// returns the data age of all controllers,
|
||||||
|
// i.e, the youngest data's age is returned.
|
||||||
|
uint32_t getDataAgeMillis() const;
|
||||||
|
|
||||||
|
VeDirectMpptController::spData_t getData(size_t idx = 0) const;
|
||||||
|
|
||||||
|
// total output of all MPPT charge controllers in Watts
|
||||||
|
int32_t getPowerOutputWatts() const;
|
||||||
|
|
||||||
|
// total panel input power of all MPPT charge controllers in Watts
|
||||||
|
int32_t getPanelPowerWatts() const;
|
||||||
|
|
||||||
|
// sum of total yield of all MPPT charge controllers in kWh
|
||||||
|
double getYieldTotal() const;
|
||||||
|
|
||||||
|
// sum of today's yield of all MPPT charge controllers in kWh
|
||||||
|
double getYieldDay() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loop();
|
||||||
|
VictronMpptClass(VictronMpptClass const& other) = delete;
|
||||||
|
VictronMpptClass(VictronMpptClass&& other) = delete;
|
||||||
|
VictronMpptClass& operator=(VictronMpptClass const& other) = delete;
|
||||||
|
VictronMpptClass& operator=(VictronMpptClass&& other) = delete;
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
|
mutable std::mutex _mutex;
|
||||||
|
using controller_t = std::unique_ptr<VeDirectMpptController>;
|
||||||
|
std::vector<controller_t> _controllers;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern VictronMpptClass VictronMppt;
|
||||||
16
include/VictronSmartShunt.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Battery.h"
|
||||||
|
|
||||||
|
class VictronSmartShunt : public BatteryProvider {
|
||||||
|
public:
|
||||||
|
bool init(bool verboseLogging) final;
|
||||||
|
void deinit() final { }
|
||||||
|
void loop() final;
|
||||||
|
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<VictronSmartShuntStats> _stats =
|
||||||
|
std::make_shared<VictronSmartShuntStats>();
|
||||||
|
};
|
||||||
@ -1,29 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <driver/spi_master.h>
|
|
||||||
#include <esp_eth.h> // required for esp_eth_handle_t
|
|
||||||
#include <esp_netif.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
class W5500 {
|
|
||||||
private:
|
|
||||||
explicit W5500(spi_device_handle_t spi, gpio_num_t pin_int);
|
|
||||||
|
|
||||||
public:
|
|
||||||
W5500(const W5500&) = delete;
|
|
||||||
W5500& operator=(const W5500&) = delete;
|
|
||||||
~W5500();
|
|
||||||
|
|
||||||
static std::unique_ptr<W5500> setup(int8_t pin_mosi, int8_t pin_miso, int8_t pin_sclk, int8_t pin_cs, int8_t pin_int, int8_t pin_rst);
|
|
||||||
String macAddress();
|
|
||||||
|
|
||||||
private:
|
|
||||||
static bool connection_check_spi(spi_device_handle_t spi);
|
|
||||||
static bool connection_check_interrupt(gpio_num_t pin_int);
|
|
||||||
|
|
||||||
esp_eth_handle_t eth_handle;
|
|
||||||
esp_netif_t* eth_netif;
|
|
||||||
};
|
|
||||||
@ -1,15 +1,14 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "WebApi_battery.h"
|
||||||
|
#include "WebApi_config.h"
|
||||||
#include "WebApi_device.h"
|
#include "WebApi_device.h"
|
||||||
#include "WebApi_devinfo.h"
|
#include "WebApi_devinfo.h"
|
||||||
#include "WebApi_dtu.h"
|
#include "WebApi_dtu.h"
|
||||||
#include "WebApi_errors.h"
|
|
||||||
#include "WebApi_eventlog.h"
|
#include "WebApi_eventlog.h"
|
||||||
#include "WebApi_file.h"
|
|
||||||
#include "WebApi_firmware.h"
|
#include "WebApi_firmware.h"
|
||||||
#include "WebApi_gridprofile.h"
|
#include "WebApi_gridprofile.h"
|
||||||
#include "WebApi_i18n.h"
|
|
||||||
#include "WebApi_inverter.h"
|
#include "WebApi_inverter.h"
|
||||||
#include "WebApi_limit.h"
|
#include "WebApi_limit.h"
|
||||||
#include "WebApi_maintenance.h"
|
#include "WebApi_maintenance.h"
|
||||||
@ -17,13 +16,19 @@
|
|||||||
#include "WebApi_network.h"
|
#include "WebApi_network.h"
|
||||||
#include "WebApi_ntp.h"
|
#include "WebApi_ntp.h"
|
||||||
#include "WebApi_power.h"
|
#include "WebApi_power.h"
|
||||||
|
#include "WebApi_powermeter.h"
|
||||||
|
#include "WebApi_powerlimiter.h"
|
||||||
#include "WebApi_prometheus.h"
|
#include "WebApi_prometheus.h"
|
||||||
#include "WebApi_security.h"
|
#include "WebApi_security.h"
|
||||||
#include "WebApi_sysstatus.h"
|
#include "WebApi_sysstatus.h"
|
||||||
#include "WebApi_webapp.h"
|
#include "WebApi_webapp.h"
|
||||||
#include "WebApi_ws_console.h"
|
#include "WebApi_ws_console.h"
|
||||||
#include "WebApi_ws_live.h"
|
#include "WebApi_ws_live.h"
|
||||||
#include <AsyncJson.h>
|
#include "WebApi_ws_vedirect_live.h"
|
||||||
|
#include "WebApi_vedirect.h"
|
||||||
|
#include "WebApi_ws_Huawei.h"
|
||||||
|
#include "WebApi_Huawei.h"
|
||||||
|
#include "WebApi_ws_battery.h"
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
#include <TaskSchedulerDeclarations.h>
|
||||||
|
|
||||||
@ -31,30 +36,27 @@ class WebApiClass {
|
|||||||
public:
|
public:
|
||||||
WebApiClass();
|
WebApiClass();
|
||||||
void init(Scheduler& scheduler);
|
void init(Scheduler& scheduler);
|
||||||
void reload();
|
|
||||||
|
|
||||||
static bool checkCredentials(AsyncWebServerRequest* request);
|
static bool checkCredentials(AsyncWebServerRequest* request);
|
||||||
static bool checkCredentialsReadonly(AsyncWebServerRequest* request);
|
static bool checkCredentialsReadonly(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
static void sendTooManyRequests(AsyncWebServerRequest* request);
|
static void sendTooManyRequests(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
static void writeConfig(JsonVariant& retMsg, const WebApiError code = WebApiError::GenericSuccess, const String& message = "Settings saved!");
|
|
||||||
|
|
||||||
static bool parseRequestData(AsyncWebServerRequest* request, AsyncJsonResponse* response, JsonDocument& json_document);
|
|
||||||
static uint64_t parseSerialFromRequest(AsyncWebServerRequest* request, String param_name = "inv");
|
|
||||||
static bool sendJsonResponse(AsyncWebServerRequest* request, AsyncJsonResponse* response, const char* function, const uint16_t line);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
Task _loopTask;
|
||||||
|
|
||||||
AsyncWebServer _server;
|
AsyncWebServer _server;
|
||||||
|
|
||||||
|
WebApiBatteryClass _webApiBattery;
|
||||||
|
WebApiConfigClass _webApiConfig;
|
||||||
WebApiDeviceClass _webApiDevice;
|
WebApiDeviceClass _webApiDevice;
|
||||||
WebApiDevInfoClass _webApiDevInfo;
|
WebApiDevInfoClass _webApiDevInfo;
|
||||||
WebApiDtuClass _webApiDtu;
|
WebApiDtuClass _webApiDtu;
|
||||||
WebApiEventlogClass _webApiEventlog;
|
WebApiEventlogClass _webApiEventlog;
|
||||||
WebApiFileClass _webApiFile;
|
|
||||||
WebApiFirmwareClass _webApiFirmware;
|
WebApiFirmwareClass _webApiFirmware;
|
||||||
WebApiGridProfileClass _webApiGridprofile;
|
WebApiGridProfileClass _webApiGridprofile;
|
||||||
WebApiI18nClass _webApiI18n;
|
|
||||||
WebApiInverterClass _webApiInverter;
|
WebApiInverterClass _webApiInverter;
|
||||||
WebApiLimitClass _webApiLimit;
|
WebApiLimitClass _webApiLimit;
|
||||||
WebApiMaintenanceClass _webApiMaintenance;
|
WebApiMaintenanceClass _webApiMaintenance;
|
||||||
@ -62,12 +64,19 @@ private:
|
|||||||
WebApiNetworkClass _webApiNetwork;
|
WebApiNetworkClass _webApiNetwork;
|
||||||
WebApiNtpClass _webApiNtp;
|
WebApiNtpClass _webApiNtp;
|
||||||
WebApiPowerClass _webApiPower;
|
WebApiPowerClass _webApiPower;
|
||||||
|
WebApiPowerMeterClass _webApiPowerMeter;
|
||||||
|
WebApiPowerLimiterClass _webApiPowerLimiter;
|
||||||
WebApiPrometheusClass _webApiPrometheus;
|
WebApiPrometheusClass _webApiPrometheus;
|
||||||
WebApiSecurityClass _webApiSecurity;
|
WebApiSecurityClass _webApiSecurity;
|
||||||
WebApiSysstatusClass _webApiSysstatus;
|
WebApiSysstatusClass _webApiSysstatus;
|
||||||
WebApiWebappClass _webApiWebapp;
|
WebApiWebappClass _webApiWebapp;
|
||||||
WebApiWsConsoleClass _webApiWsConsole;
|
WebApiWsConsoleClass _webApiWsConsole;
|
||||||
WebApiWsLiveClass _webApiWsLive;
|
WebApiWsLiveClass _webApiWsLive;
|
||||||
|
WebApiWsVedirectLiveClass _webApiWsVedirectLive;
|
||||||
|
WebApiVedirectClass _webApiVedirect;
|
||||||
|
WebApiHuaweiClass _webApiHuaweiClass;
|
||||||
|
WebApiWsHuaweiLiveClass _webApiWsHuaweiLive;
|
||||||
|
WebApiWsBatteryLiveClass _webApiWsBatteryLive;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WebApiClass WebApi;
|
extern WebApiClass WebApi;
|
||||||
19
include/WebApi_Huawei.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
|
class WebApiHuaweiClass {
|
||||||
|
public:
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
void getJsonData(JsonObject& root);
|
||||||
|
private:
|
||||||
|
void onStatus(AsyncWebServerRequest* request);
|
||||||
|
void onAdminGet(AsyncWebServerRequest* request);
|
||||||
|
void onAdminPost(AsyncWebServerRequest* request);
|
||||||
|
void onPost(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
18
include/WebApi_battery.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
|
||||||
|
|
||||||
|
class WebApiBatteryClass {
|
||||||
|
public:
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onStatus(AsyncWebServerRequest* request);
|
||||||
|
void onAdminGet(AsyncWebServerRequest* request);
|
||||||
|
void onAdminPost(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
19
include/WebApi_config.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
|
||||||
|
class WebApiConfigClass {
|
||||||
|
public:
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onConfigGet(AsyncWebServerRequest* request);
|
||||||
|
void onConfigDelete(AsyncWebServerRequest* request);
|
||||||
|
void onConfigListGet(AsyncWebServerRequest* request);
|
||||||
|
void onConfigUploadFinish(AsyncWebServerRequest* request);
|
||||||
|
void onConfigUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,13 +2,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiDeviceClass {
|
class WebApiDeviceClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onDeviceAdminGet(AsyncWebServerRequest* request);
|
void onDeviceAdminGet(AsyncWebServerRequest* request);
|
||||||
void onDeviceAdminPost(AsyncWebServerRequest* request);
|
void onDeviceAdminPost(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,12 +2,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiDevInfoClass {
|
class WebApiDevInfoClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onDevInfoStatus(AsyncWebServerRequest* request);
|
void onDevInfoStatus(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,17 +2,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiDtuClass {
|
class WebApiDtuClass {
|
||||||
public:
|
public:
|
||||||
WebApiDtuClass();
|
void init(AsyncWebServer& server);
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onDtuAdminGet(AsyncWebServerRequest* request);
|
void onDtuAdminGet(AsyncWebServerRequest* request);
|
||||||
void onDtuAdminPost(AsyncWebServerRequest* request);
|
void onDtuAdminPost(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
Task _applyDataTask;
|
AsyncWebServer* _server;
|
||||||
void applyDataTaskCb();
|
};
|
||||||
};
|
|
||||||
@ -5,23 +5,19 @@ enum WebApiError {
|
|||||||
GenericBase = 1000,
|
GenericBase = 1000,
|
||||||
GenericSuccess,
|
GenericSuccess,
|
||||||
GenericNoValueFound,
|
GenericNoValueFound,
|
||||||
GenericDataTooLarge, // not used anymore
|
GenericDataTooLarge,
|
||||||
GenericParseError,
|
GenericParseError,
|
||||||
GenericValueMissing,
|
GenericValueMissing,
|
||||||
GenericWriteFailed,
|
|
||||||
GenericInternalServerError,
|
|
||||||
|
|
||||||
DtuBase = 2000,
|
DtuBase = 2000,
|
||||||
DtuSerialZero,
|
DtuSerialZero,
|
||||||
DtuPollZero,
|
DtuPollZero,
|
||||||
DtuInvalidPowerLevel,
|
DtuInvalidPowerLevel,
|
||||||
DtuInvalidCmtFrequency,
|
DtuInvalidCmtFrequency,
|
||||||
DtuInvalidCmtCountry,
|
|
||||||
|
|
||||||
FileBase = 3000,
|
ConfigBase = 3000,
|
||||||
FileNotDeleted,
|
ConfigNotDeleted,
|
||||||
FileSuccess,
|
ConfigSuccess,
|
||||||
FileDeleteSuccess,
|
|
||||||
|
|
||||||
InverterBase = 4000,
|
InverterBase = 4000,
|
||||||
InverterSerialZero,
|
InverterSerialZero,
|
||||||
@ -33,7 +29,6 @@ enum WebApiError {
|
|||||||
InverterChanged,
|
InverterChanged,
|
||||||
InverterDeleted,
|
InverterDeleted,
|
||||||
InverterOrdered,
|
InverterOrdered,
|
||||||
InverterStatsResetted,
|
|
||||||
|
|
||||||
LimitBase = 5000,
|
LimitBase = 5000,
|
||||||
LimitSerialZero,
|
LimitSerialZero,
|
||||||
@ -62,7 +57,6 @@ enum WebApiError {
|
|||||||
MqttHassTopicLength,
|
MqttHassTopicLength,
|
||||||
MqttHassTopicCharacter,
|
MqttHassTopicCharacter,
|
||||||
MqttLwtQos,
|
MqttLwtQos,
|
||||||
MqttClientIdLength,
|
|
||||||
|
|
||||||
NetworkBase = 8000,
|
NetworkBase = 8000,
|
||||||
NetworkIpInvalid,
|
NetworkIpInvalid,
|
||||||
@ -94,4 +88,4 @@ enum WebApiError {
|
|||||||
|
|
||||||
HardwareBase = 12000,
|
HardwareBase = 12000,
|
||||||
HardwarePinMappingLength,
|
HardwarePinMappingLength,
|
||||||
};
|
};
|
||||||
@ -2,12 +2,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiEventlogClass {
|
class WebApiEventlogClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onEventlogStatus(AsyncWebServerRequest* request);
|
void onEventlogStatus(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -1,18 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiFileClass {
|
|
||||||
public:
|
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void onFileGet(AsyncWebServerRequest* request);
|
|
||||||
void onFileDelete(AsyncWebServerRequest* request);
|
|
||||||
void onFileDeleteAll(AsyncWebServerRequest* request);
|
|
||||||
void onFileListGet(AsyncWebServerRequest* request);
|
|
||||||
void onFileUploadFinish(AsyncWebServerRequest* request);
|
|
||||||
void onFileUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);
|
|
||||||
};
|
|
||||||
@ -2,13 +2,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiFirmwareClass {
|
class WebApiFirmwareClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onFirmwareUpdateFinish(AsyncWebServerRequest* request);
|
void onFirmwareUpdateFinish(AsyncWebServerRequest* request);
|
||||||
void onFirmwareUpdateUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);
|
void onFirmwareUpdateUpload(AsyncWebServerRequest* request, String filename, size_t index, uint8_t* data, size_t len, bool final);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,13 +2,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiGridProfileClass {
|
class WebApiGridProfileClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onGridProfileStatus(AsyncWebServerRequest* request);
|
void onGridProfileStatus(AsyncWebServerRequest* request);
|
||||||
void onGridProfileRawdata(AsyncWebServerRequest* request);
|
void onGridProfileRawdata(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -1,14 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiI18nClass {
|
|
||||||
public:
|
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void onI18nLanguages(AsyncWebServerRequest* request);
|
|
||||||
void onI18nLanguage(AsyncWebServerRequest* request);
|
|
||||||
};
|
|
||||||
@ -2,11 +2,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiInverterClass {
|
class WebApiInverterClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onInverterList(AsyncWebServerRequest* request);
|
void onInverterList(AsyncWebServerRequest* request);
|
||||||
@ -14,5 +14,6 @@ private:
|
|||||||
void onInverterEdit(AsyncWebServerRequest* request);
|
void onInverterEdit(AsyncWebServerRequest* request);
|
||||||
void onInverterDelete(AsyncWebServerRequest* request);
|
void onInverterDelete(AsyncWebServerRequest* request);
|
||||||
void onInverterOrder(AsyncWebServerRequest* request);
|
void onInverterOrder(AsyncWebServerRequest* request);
|
||||||
void onInverterStatReset(AsyncWebServerRequest* request);
|
|
||||||
};
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,13 +2,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiLimitClass {
|
class WebApiLimitClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onLimitStatus(AsyncWebServerRequest* request);
|
void onLimitStatus(AsyncWebServerRequest* request);
|
||||||
void onLimitPost(AsyncWebServerRequest* request);
|
void onLimitPost(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,12 +2,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiMaintenanceClass {
|
class WebApiMaintenanceClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onRebootPost(AsyncWebServerRequest* request);
|
void onRebootPost(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,15 +2,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
#define MQTT_JSON_DOC_SIZE 10240
|
||||||
|
|
||||||
class WebApiMqttClass {
|
class WebApiMqttClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onMqttStatus(AsyncWebServerRequest* request);
|
void onMqttStatus(AsyncWebServerRequest* request);
|
||||||
void onMqttAdminGet(AsyncWebServerRequest* request);
|
void onMqttAdminGet(AsyncWebServerRequest* request);
|
||||||
void onMqttAdminPost(AsyncWebServerRequest* request);
|
void onMqttAdminPost(AsyncWebServerRequest* request);
|
||||||
String getTlsCertInfo(const char* cert);
|
String getTlsCertInfo(const char* cert);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,14 +2,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiNetworkClass {
|
class WebApiNetworkClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onNetworkStatus(AsyncWebServerRequest* request);
|
void onNetworkStatus(AsyncWebServerRequest* request);
|
||||||
void onNetworkAdminGet(AsyncWebServerRequest* request);
|
void onNetworkAdminGet(AsyncWebServerRequest* request);
|
||||||
void onNetworkAdminPost(AsyncWebServerRequest* request);
|
void onNetworkAdminPost(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,11 +2,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiNtpClass {
|
class WebApiNtpClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onNtpStatus(AsyncWebServerRequest* request);
|
void onNtpStatus(AsyncWebServerRequest* request);
|
||||||
@ -14,4 +14,6 @@ private:
|
|||||||
void onNtpAdminPost(AsyncWebServerRequest* request);
|
void onNtpAdminPost(AsyncWebServerRequest* request);
|
||||||
void onNtpTimeGet(AsyncWebServerRequest* request);
|
void onNtpTimeGet(AsyncWebServerRequest* request);
|
||||||
void onNtpTimePost(AsyncWebServerRequest* request);
|
void onNtpTimePost(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,13 +2,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiPowerClass {
|
class WebApiPowerClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onPowerStatus(AsyncWebServerRequest* request);
|
void onPowerStatus(AsyncWebServerRequest* request);
|
||||||
void onPowerPost(AsyncWebServerRequest* request);
|
void onPowerPost(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
18
include/WebApi_powerlimiter.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
|
||||||
|
|
||||||
|
class WebApiPowerLimiterClass {
|
||||||
|
public:
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onStatus(AsyncWebServerRequest* request);
|
||||||
|
void onAdminGet(AsyncWebServerRequest* request);
|
||||||
|
void onAdminPost(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
19
include/WebApi_powermeter.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
|
||||||
|
|
||||||
|
class WebApiPowerMeterClass {
|
||||||
|
public:
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onStatus(AsyncWebServerRequest* request);
|
||||||
|
void onAdminGet(AsyncWebServerRequest* request);
|
||||||
|
void onAdminPost(AsyncWebServerRequest* request);
|
||||||
|
void onTestHttpRequest(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class WebApiPrometheusClass {
|
class WebApiPrometheusClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onPrometheusMetricsGet(AsyncWebServerRequest* request);
|
void onPrometheusMetricsGet(AsyncWebServerRequest* request);
|
||||||
@ -17,6 +17,8 @@ private:
|
|||||||
|
|
||||||
void addPanelInfo(AsyncResponseStream* stream, const String& serial, const uint8_t idx, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel);
|
void addPanelInfo(AsyncResponseStream* stream, const String& serial, const uint8_t idx, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
|
||||||
enum MetricType_t {
|
enum MetricType_t {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
GAUGE,
|
GAUGE,
|
||||||
@ -45,4 +47,4 @@ private:
|
|||||||
{ FLD_EFF, MetricType_t::GAUGE },
|
{ FLD_EFF, MetricType_t::GAUGE },
|
||||||
{ FLD_IRR, MetricType_t::GAUGE },
|
{ FLD_IRR, MetricType_t::GAUGE },
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -2,15 +2,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiSecurityClass {
|
class WebApiSecurityClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onSecurityGet(AsyncWebServerRequest* request);
|
void onSecurityGet(AsyncWebServerRequest* request);
|
||||||
void onSecurityPost(AsyncWebServerRequest* request);
|
void onSecurityPost(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
void onAuthenticateGet(AsyncWebServerRequest* request);
|
void onAuthenticateGet(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,12 +2,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiSysstatusClass {
|
class WebApiSysstatusClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onSystemStatus(AsyncWebServerRequest* request);
|
void onSystemStatus(AsyncWebServerRequest* request);
|
||||||
};
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
18
include/WebApi_vedirect.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
|
||||||
|
|
||||||
|
class WebApiVedirectClass {
|
||||||
|
public:
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onVedirectStatus(AsyncWebServerRequest* request);
|
||||||
|
void onVedirectAdminGet(AsyncWebServerRequest* request);
|
||||||
|
void onVedirectAdminPost(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
};
|
||||||
@ -2,12 +2,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiWebappClass {
|
class WebApiWebappClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void responseBinaryDataWithETagCache(AsyncWebServerRequest* request, const String &contentType, const String &contentEncoding, const uint8_t *content, size_t len);
|
AsyncWebServer* _server;
|
||||||
};
|
};
|
||||||
24
include/WebApi_ws_Huawei.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ArduinoJson.h"
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
//#include <HuaweiFrameHandler.h>
|
||||||
|
|
||||||
|
class WebApiWsHuaweiLiveClass {
|
||||||
|
public:
|
||||||
|
WebApiWsHuaweiLiveClass();
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void generateJsonResponse(JsonVariant& root);
|
||||||
|
void onLivedataStatus(AsyncWebServerRequest* request);
|
||||||
|
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
AsyncWebSocket _ws;
|
||||||
|
|
||||||
|
uint32_t _lastWsCleanup = 0;
|
||||||
|
uint32_t _lastUpdateCheck = 0;
|
||||||
|
};
|
||||||
24
include/WebApi_ws_battery.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ArduinoJson.h"
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
|
||||||
|
class WebApiWsBatteryLiveClass {
|
||||||
|
public:
|
||||||
|
WebApiWsBatteryLiveClass();
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void generateJsonResponse(JsonVariant& root);
|
||||||
|
void onLivedataStatus(AsyncWebServerRequest* request);
|
||||||
|
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
AsyncWebSocket _ws;
|
||||||
|
|
||||||
|
uint32_t _lastWsCleanup = 0;
|
||||||
|
uint32_t _lastUpdateCheck = 0;
|
||||||
|
static constexpr uint16_t _responseSize = 1024 + 512;
|
||||||
|
};
|
||||||
@ -1,19 +1,17 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
class WebApiWsConsoleClass {
|
||||||
class WebApiWsConsoleClass {
|
public:
|
||||||
public:
|
WebApiWsConsoleClass();
|
||||||
WebApiWsConsoleClass();
|
void init(AsyncWebServer& server);
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void loop();
|
||||||
void reload();
|
|
||||||
|
private:
|
||||||
private:
|
AsyncWebServer* _server;
|
||||||
AsyncWebSocket _ws;
|
AsyncWebSocket _ws;
|
||||||
AsyncAuthenticationMiddleware _simpleDigestAuth;
|
|
||||||
|
uint32_t _lastWsCleanup = 0;
|
||||||
Task _wsCleanupTask;
|
};
|
||||||
void wsCleanupTaskCb();
|
|
||||||
};
|
|
||||||
@ -1,39 +1,30 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Configuration.h"
|
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
#include <TaskSchedulerDeclarations.h>
|
|
||||||
|
|
||||||
class WebApiWsLiveClass {
|
class WebApiWsLiveClass {
|
||||||
public:
|
public:
|
||||||
WebApiWsLiveClass();
|
WebApiWsLiveClass();
|
||||||
void init(AsyncWebServer& server, Scheduler& scheduler);
|
void init(AsyncWebServer& server);
|
||||||
void reload();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void generateInverterCommonJsonResponse(JsonObject& root, std::shared_ptr<InverterAbstract> inv);
|
void generateJsonResponse(JsonVariant& root);
|
||||||
static void generateInverterChannelJsonResponse(JsonObject& root, std::shared_ptr<InverterAbstract> inv);
|
void addField(JsonObject& root, uint8_t idx, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, String topic = "");
|
||||||
static void generateCommonJsonResponse(JsonVariant& root);
|
void addTotalField(JsonObject& root, const String& name, const float value, const String& unit, const uint8_t digits);
|
||||||
|
|
||||||
static void addField(JsonObject& root, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, String topic = "");
|
|
||||||
static void addTotalField(JsonObject& root, const String& name, const float value, const String& unit, const uint8_t digits);
|
|
||||||
|
|
||||||
void onLivedataStatus(AsyncWebServerRequest* request);
|
void onLivedataStatus(AsyncWebServerRequest* request);
|
||||||
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);
|
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
AsyncWebSocket _ws;
|
AsyncWebSocket _ws;
|
||||||
AsyncAuthenticationMiddleware _simpleDigestAuth;
|
|
||||||
|
|
||||||
uint32_t _lastPublishStats[INV_MAX_COUNT] = { 0 };
|
uint32_t _lastWsPublish = 0;
|
||||||
|
uint32_t _lastInvUpdateCheck = 0;
|
||||||
|
uint32_t _lastWsCleanup = 0;
|
||||||
|
uint32_t _newestInverterTimestamp = 0;
|
||||||
|
|
||||||
std::mutex _mutex;
|
std::mutex _mutex;
|
||||||
|
};
|
||||||
Task _wsCleanupTask;
|
|
||||||
void wsCleanupTaskCb();
|
|
||||||
|
|
||||||
Task _sendDataTask;
|
|
||||||
void sendDataTaskCb();
|
|
||||||
};
|
|
||||||
26
include/WebApi_ws_vedirect_live.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ArduinoJson.h"
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
#include <VeDirectMpptController.h>
|
||||||
|
|
||||||
|
class WebApiWsVedirectLiveClass {
|
||||||
|
public:
|
||||||
|
WebApiWsVedirectLiveClass();
|
||||||
|
void init(AsyncWebServer& server);
|
||||||
|
void loop();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void generateJsonResponse(JsonVariant& root);
|
||||||
|
void onLivedataStatus(AsyncWebServerRequest* request);
|
||||||
|
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);
|
||||||
|
|
||||||
|
AsyncWebServer* _server;
|
||||||
|
AsyncWebSocket _ws;
|
||||||
|
|
||||||
|
uint32_t _lastWsPublish = 0;
|
||||||
|
uint32_t _lastWsCleanup = 0;
|
||||||
|
uint32_t _dataAgeMillis = 0;
|
||||||
|
static constexpr uint16_t _responseSize = 1024 + 128;
|
||||||
|
};
|
||||||
@ -1,9 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// The referenced values are generated by pio-scripts/auto_firmware_version.py
|
|
||||||
|
|
||||||
|
|
||||||
extern const char *__COMPILED_GIT_HASH__;
|
|
||||||
extern const char *__COMPILED_GIT_BRANCH__;
|
|
||||||
// extern const char *__COMPILED_DATE_TIME_UTC_STR__;
|
|
||||||
@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
#define ACCESS_POINT_NAME "OpenDTU-"
|
#define ACCESS_POINT_NAME "OpenDTU-"
|
||||||
#define ACCESS_POINT_PASSWORD "openDTU42"
|
#define ACCESS_POINT_PASSWORD "openDTU42"
|
||||||
#define ACCESS_POINT_TIMEOUT 3
|
#define ACCESS_POINT_TIMEOUT 3;
|
||||||
#define AUTH_USERNAME "admin"
|
#define AUTH_USERNAME "admin"
|
||||||
#define SECURITY_ALLOW_READONLY true
|
#define SECURITY_ALLOW_READONLY true
|
||||||
|
|
||||||
#define WIFI_RECONNECT_TIMEOUT 30
|
#define WIFI_RECONNECT_TIMEOUT 15
|
||||||
#define WIFI_RECONNECT_REDO_TIMEOUT 600
|
#define WIFI_RECONNECT_REDO_TIMEOUT 600
|
||||||
|
|
||||||
#define WIFI_SSID ""
|
#define WIFI_SSID ""
|
||||||
@ -22,8 +22,7 @@
|
|||||||
|
|
||||||
#define MDNS_ENABLED false
|
#define MDNS_ENABLED false
|
||||||
|
|
||||||
#define NTP_SERVER_OLD "pool.ntp.org"
|
#define NTP_SERVER "pool.ntp.org"
|
||||||
#define NTP_SERVER "opendtu.pool.ntp.org"
|
|
||||||
#define NTP_TIMEZONE "CET-1CEST,M3.5.0,M10.5.0/3"
|
#define NTP_TIMEZONE "CET-1CEST,M3.5.0,M10.5.0/3"
|
||||||
#define NTP_TIMEZONEDESCR "Europe/Berlin"
|
#define NTP_TIMEZONEDESCR "Europe/Berlin"
|
||||||
#define NTP_LONGITUDE 10.4515f
|
#define NTP_LONGITUDE 10.4515f
|
||||||
@ -84,8 +83,7 @@
|
|||||||
#define DTU_POLL_INTERVAL 5U
|
#define DTU_POLL_INTERVAL 5U
|
||||||
#define DTU_NRF_PA_LEVEL 0U
|
#define DTU_NRF_PA_LEVEL 0U
|
||||||
#define DTU_CMT_PA_LEVEL 0
|
#define DTU_CMT_PA_LEVEL 0
|
||||||
#define DTU_CMT_FREQUENCY 865000000U
|
#define DTU_CMT_FREQUENCY 865000U
|
||||||
#define DTU_CMT_COUNTRY_MODE 0U
|
|
||||||
|
|
||||||
#define MQTT_HASS_ENABLED false
|
#define MQTT_HASS_ENABLED false
|
||||||
#define MQTT_HASS_EXPIRE true
|
#define MQTT_HASS_EXPIRE true
|
||||||
@ -99,14 +97,61 @@
|
|||||||
#define DISPLAY_SCREENSAVER true
|
#define DISPLAY_SCREENSAVER true
|
||||||
#define DISPLAY_ROTATION 2U
|
#define DISPLAY_ROTATION 2U
|
||||||
#define DISPLAY_CONTRAST 60U
|
#define DISPLAY_CONTRAST 60U
|
||||||
#define DISPLAY_LOCALE "en"
|
#define DISPLAY_LANGUAGE 0U
|
||||||
#define DISPLAY_DIAGRAM_DURATION (10UL * 60UL * 60UL)
|
#define DISPLAY_DIAGRAM_DURATION (10UL * 60UL * 60UL)
|
||||||
#define DISPLAY_DIAGRAM_MODE 1U
|
|
||||||
|
|
||||||
#define REACHABLE_THRESHOLD 2U
|
#define REACHABLE_THRESHOLD 2U
|
||||||
|
|
||||||
#define LED_BRIGHTNESS 100U
|
#define LED_BRIGHTNESS 100U
|
||||||
|
|
||||||
#define MAX_INVERTER_LIMIT 2250
|
#define MAX_INVERTER_LIMIT 2250
|
||||||
|
#define VEDIRECT_ENABLED false
|
||||||
|
#define VEDIRECT_VERBOSE_LOGGING false
|
||||||
|
#define VEDIRECT_UPDATESONLY true
|
||||||
|
|
||||||
#define LANG_PACK_SUFFIX ".lang.json"
|
#define POWERMETER_ENABLED false
|
||||||
|
#define POWERMETER_INTERVAL 10
|
||||||
|
#define POWERMETER_SOURCE 2
|
||||||
|
#define POWERMETER_SDMBAUDRATE 9600
|
||||||
|
#define POWERMETER_SDMADDRESS 1
|
||||||
|
|
||||||
|
|
||||||
|
#define POWERLIMITER_ENABLED false
|
||||||
|
#define POWERLIMITER_SOLAR_PASSTHROUGH_ENABLED true
|
||||||
|
#define POWERLIMITER_SOLAR_PASSTHROUGH_LOSSES 3
|
||||||
|
#define POWERLIMITER_BATTERY_DRAIN_STRATEGY 0
|
||||||
|
#define POWERLIMITER_INTERVAL 10
|
||||||
|
#define POWERLIMITER_IS_INVERTER_BEHIND_POWER_METER true
|
||||||
|
#define POWERLIMITER_INVERTER_ID 0
|
||||||
|
#define POWERLIMITER_INVERTER_CHANNEL_ID 0
|
||||||
|
#define POWERLIMITER_TARGET_POWER_CONSUMPTION 0
|
||||||
|
#define POWERLIMITER_TARGET_POWER_CONSUMPTION_HYSTERESIS 0
|
||||||
|
#define POWERLIMITER_LOWER_POWER_LIMIT 10
|
||||||
|
#define POWERLIMITER_UPPER_POWER_LIMIT 800
|
||||||
|
#define POWERLIMITER_BATTERY_SOC_START_THRESHOLD 80
|
||||||
|
#define POWERLIMITER_BATTERY_SOC_STOP_THRESHOLD 20
|
||||||
|
#define POWERLIMITER_VOLTAGE_START_THRESHOLD 50.0
|
||||||
|
#define POWERLIMITER_VOLTAGE_STOP_THRESHOLD 49.0
|
||||||
|
#define POWERLIMITER_VOLTAGE_LOAD_CORRECTION_FACTOR 0.001
|
||||||
|
#define POWERLIMITER_RESTART_HOUR -1
|
||||||
|
#define POWERLIMITER_FULL_SOLAR_PASSTHROUGH_SOC 100
|
||||||
|
#define POWERLIMITER_FULL_SOLAR_PASSTHROUGH_START_VOLTAGE 100.0
|
||||||
|
#define POWERLIMITER_FULL_SOLAR_PASSTHROUGH_STOP_VOLTAGE 100.0
|
||||||
|
|
||||||
|
#define BATTERY_ENABLED false
|
||||||
|
#define BATTERY_PROVIDER 0 // Pylontech CAN receiver
|
||||||
|
#define BATTERY_JKBMS_INTERFACE 0
|
||||||
|
#define BATTERY_JKBMS_POLLING_INTERVAL 5
|
||||||
|
|
||||||
|
#define HUAWEI_ENABLED false
|
||||||
|
#define HUAWEI_CAN_CONTROLLER_FREQUENCY 8000000UL
|
||||||
|
#define HUAWEI_AUTO_POWER_VOLTAGE_LIMIT 42.0
|
||||||
|
#define HUAWEI_AUTO_POWER_ENABLE_VOLTAGE_LIMIT 42.0
|
||||||
|
#define HUAWEI_AUTO_POWER_LOWER_POWER_LIMIT 150
|
||||||
|
#define HUAWEI_AUTO_POWER_UPPER_POWER_LIMIT 2000
|
||||||
|
|
||||||
|
#define VERBOSE_LOGGING true
|
||||||
|
|
||||||
|
#define LED_BRIGHTNESS 100U
|
||||||
|
|
||||||
|
#define MAX_INVERTER_LIMIT 2250
|
||||||