Commit Graph

420 Commits

Author SHA1 Message Date
Bernhard Kirchen
88a5117007
VE.Direct: do not use debug buffer at all if verbose logging disabled (#437)
this avoids the debug buffer being overrun if verbose logging is
disabled in particular. that would happen because the buffer would
only be reset if verbose logging was enabled but filled in any case.
2023-09-13 12:13:56 +02:00
helgeerbe
2eeb5f1d19 Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development"
This reverts commit eb1c2dbd8c, reversing
changes made to 0cb42a6424.

merge of v23.9.11 broke the system
2023-09-12 20:18:10 +02:00
helgeerbe
eb1c2dbd8c Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-09-12 19:27:32 +02:00
Bernhard Kirchen
d984912d7c
Vedirect Cleanups (#417)
* VE.Direct: remove unused #defines

* VE.Direct: remove unused mStop member variable

* VE.Direct: whitespace cleanups

remove trailing whitespace and fix mixed indentation.
2023-09-12 19:13:28 +02:00
Thomas Basler
3a3adb4723 Completly ignore a disabled (polling + command) inverter.
This leads to higher update rates on still enabled inverters.
2023-09-10 11:49:41 +02:00
Thomas Basler
8023b6620a Fix: Ignore incomplete SystemConfigPara packages
Some inverters seem to transmit too less and incomplete data. These packages will be ignored now.
2023-09-07 23:10:01 +02:00
Thomas Basler
0260af9ada Hoymiles Lib: Move semaphore handing into parser base class 2023-09-07 22:08:07 +02:00
Thomas Basler
9ac6dd6e8d Feature: First very basic support to read the grid profile
The parser is still missing and requires community support to collect data.
2023-09-07 22:08:07 +02:00
Thomas Basler
1acefd8b8c Fix: Do not resend fetch limit request if the last one failed
Due to side effects it is possible that the inverter receives the request but the DTU does not receive the answer. In this case the DTU would resend the request but the inverter would generate a event log entry (DTU command failed) because it received the message twice.
2023-09-05 22:09:16 +02:00
Thomas Basler
ec9af886d5 Feature: Added option to set daily yield to zero at midnight 2023-09-05 20:27:52 +02:00
Bernhard Kirchen
ba303da742
VE.Direct: Reset state machine on timeout, fix and extend logging (#416)
* VE.Direct: reset state machine on timeout

there will never be a large gap between two bytes of the same frame.
if such a large gap is observed, reset the state machine so it tries
to decode a new frame once more data arrives.

this is helpful in case of corrupted data that prevents the state
machine of transitioning to the final state even though the VE.Direct
data producer is done sending bytes that belong to the same frame.

* VE.Direct: print problems to MessageOutput

this includes the web console in particular, where many users have
access to while the serial console is not attached or monitored.

* VE.Direct: collect serial input into buffer and print

should help debug issues for users.

* VE.Direct: implement and use verbose logging switch
2023-09-04 14:07:48 +02:00
Thomas Basler
55afa81cf1 Convert from FreeRTOS Semaphore to std::mutex 2023-09-02 16:46:23 +02:00
Thomas Basler
6127fbe940 Feature: Added option to set runtime values to zero when inverter becames unreachable 2023-09-02 12:22:22 +02:00
Thomas Basler
2c41be106e Feature: Allow setting of the Reachable Threshold per inverter 2023-09-01 19:17:12 +02:00
helgeerbe
d4afc5940a Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-08-29 09:24:25 +02:00
helgeerbe
ca308d0895 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-08-28 13:12:07 +02:00
Thomas Basler
b88030f76e Feature: Re-Request DevInfo if it contains invalid data
It can sometimes occour that the DevInfo request returns invalid data. Currently this is identified if the firmware build year is < 2016. In this case the package will be re-requested now.
2023-08-25 11:04:14 +02:00
Thomas Basler
4bf9083b23 Prometheus Endpoint: Publish only relevant amount of digits
Implemented method to return the correctly formatted field value as string
2023-08-22 11:45:14 +02:00
Bernhard Roth
6eb3c63288 Fix issue #1256 (HMS-2000-4T reactive power should be signed) 2023-08-21 11:14:24 +02:00
helgeerbe
21bbed9b8e Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-08-09 12:37:33 +02:00
Thomas Basler
188a6cf39d Replace template by abstract class 2023-08-05 01:01:53 +02:00
Thomas Basler
22d9b128b9 Fix: Move setting of CMD_PENDING state into the right order 2023-08-04 23:44:18 +02:00
helgeerbe
5335ec1bde Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-08-04 12:21:16 +02:00
Thomas Basler
832df5a80e Implement the command queue thread safe
The queue will be maybe filled from within another thread (mqtt/web) and handled from the main loop
2023-08-03 00:17:32 +02:00
Thomas Basler
be09c4052f Fix: Ensure that only completly assembled packets are put into the command queue 2023-08-02 22:41:53 +02:00
helgeerbe
69456affce Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-08-02 19:46:35 +02:00
Thomas Basler
686112e4ee Fix: Wrong detection of HM-300 inverters
Was introduced in v23.8.1; Fixes #1198
2023-08-02 18:41:25 +02:00
Thomas Basler
5bbc67bc49 Fix: Clear parser buffers to prevent random numbers if no data was received 2023-07-31 22:52:38 +02:00
Thomas Basler
ef65094181 Fix: Prevent wrong values of devinfo data because of non-atomic transaction 2023-07-31 22:27:28 +02:00
Thomas Basler
74169c3b17 Fix: Prevent wrong values of systemconfigpara data because of non-atomic transaction 2023-07-31 22:06:04 +02:00
Thomas Basler
698ecbcd53 Fix: Prevent wrong values of alarm data because of non-atomic transaction and fix calculation of getEntryCount() 2023-07-31 22:06:04 +02:00
Thomas Basler
14305a9f12 Fix: Prevent wrong values of statistics data because of non-atomic transaction 2023-07-31 22:05:22 +02:00
Thomas Basler
9821c1905b Fix: Uninitliazed variable used before first use 2023-07-31 21:44:50 +02:00
helgeerbe
2440028d38 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-07-24 13:16:15 +02:00
Thomas Basler
658a42db80 Apply code formatter without functional changes 2023-07-22 18:00:41 +02:00
Bernhard Kirchen
f0def2ae89
Selective verbosity (#318)
* DPL: implement verbose logging switch

* MQTT: implement verbose logging switch

* power meter: implement verbose logging switch

* Hoymiles lib: implement verbose logging switch

* cpp linting: "final" makes "virtual" and "override" redundant

... however, using only "final" is not as verbose.
2023-07-18 09:57:03 +02:00
helgeerbe
633ef88296 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-07-12 13:45:19 +02:00
Thomas Basler
0ffbba0cf5 Fix: Allow sending of ChannelChangeCommand even if EnableCommands is disabled
This is required to successfull move the inverter to another frequency and then polling it. Without this command its not even possible to poll a inverter.

Fixes #1127
2023-07-10 18:30:59 +02:00
Bernhard Kirchen
e457ab73f9
Fix vedirect polling (#291)
* VE.Direct: remove polling interval

the polling interval was meant to limit the amount of MQTT updates.
however, that is already controlled by the global MQTT publish interval.
the removed interval was instead used to limit polling of the VE.Direct
UART for incoming data.

the Victron device sends data unsolicited. the VeDirectFrameHandler does
not implement any polling mechanism. no data is ever sent to the Victron
device.

what the removed polling interval did was cause a buffer overrun of the
HardwareSerial class, since the incoming data was not processed in time.
so every five seconds, we read a whole valid VE.Direct frame, plus some
old data, which was not a whole frame, leading to VE.Direct error
messages to pop up.

with the polling interval removed, no framing errors are reported, and
instead we gain new data from the charge controller approximately ever
two seconds -- for free.

* VE.Direct: change texts to correct VE.Direct capital letters

* VE.Direct: improve "UpdatesOnly" switch labels

especially since the publish interval setting is gone, the label makes
it hard to comprehend what the switch does. update the texts to better
explain what the switch is used for.

use the same text on the VE.Direct info view.

* VE.Direct: use StatusBadge on info view

there were custom badges to indicate the VE.Direct settings. replace
those by the common StatusBadge to make then look the same as the other
badged on the info views.
2023-07-04 12:04:38 +02:00
helgeerbe
9a4eb75160 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-07-02 14:32:12 +02:00
Bernhard Kirchen
8b23324693 ensure only one PowerCommand and ActivePowerCommand is queued
neither a PowerCommand nor an ActivePowerCommand shall be enqueued if
another one is already pending.
2023-06-30 20:03:21 +02:00
jstammi
82038d3e2d Fix: do not calc sizes multiple times
tbnobody/OpenDTU/issues/1022
2023-06-28 19:26:45 +02:00
jstammi
4ae6a2b4ef Fix: calc expected statistics packet length per parser
tbnobody/OpenDTU/issues/1022
2023-06-28 16:53:38 +02:00
Thomas Basler
69aa247470 Added check in statistics data that at least all required bytes are received
It can occour for some inverters that incomplete fragments with valid crc but less bytes are received

This was mentioned in #1084
2023-06-27 18:59:54 +02:00
Bernhard Kirchen
9995c1172e
VE.Direct live view enhancements (#269)
* add calculated values to VE.Direct data

solar current, battery output power, and the charger's efficiency can be
calculated from the values reported by the charger. the efficiency must
be taken with a grain of salt. it seems that the solar power value and
the battery output voltage/current are not always in sync. for that
reason a moving average is used to smooth out the calculated efficiency
value.

* show calculated VE.Direct values in web live view

order the values and translations similarly for the input and output,
starting with power at the top, then voltage, then current as the last
of these three.

* VE.Direct live view: use 'd' as unit for days

'd' is the SI unit symbol for days and does not need translation, which
is desirable as units are not translated throughout the project.

* refactor VE.Direct live view

* move Dynamic Power Limiter data into its own type.
* split VE.Direct data into three types: "device", "input", and
  "output". hence all input and output values are now ValueObject, which
  allows to iterate over them using a loop without typing issues.
* generate the tables with input and output values using a loop, rather
  than defining each row individually.
* localize numbers using $n (vue method), which fixes switching the
  number format (dot vs. comma) when switching the language.
* use no decimal point for power values (they are integers), three
  decimal points for kWh values (charger only reports two decimal
  places, but three are easier to read since the unit is *kilo* Wh), one
  decimal point for the efficiency, and two for voltage and current.
* update language tokens to avoid mapping JSON keys to language keys
  (use the JSON keys to access the language tokens).
* re-structure language tokes so the brief keys took over from
  VeDirectFrameHandler always make sense (nest into "input" and
  "output").
* order values similarly from top to bottom: power, then voltage, then
  current. this is following the order of the inverters' details.
* group values by type/unit (yield and max. power) and order them
  "newest" to "oldest" from top to bottom.
* increase the DynamicJsonDocument as it was too small to hold the newly
  added data.

* update webapp_dist to include VE.Direct live view refactoring
2023-06-22 21:32:20 +02:00
helgeerbe
cd1db49a98 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-06-22 21:14:12 +02:00
helgeerbe
f018a0136e Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-06-21 16:52:02 +02:00
Thomas Basler
184c659197 Added new found HMS-400 to DevInfoParser
Fixes #1045
2023-06-19 11:33:06 +02:00
Thomas Basler
64c96c34f4 Revert "Fix: String numbers for HMT inverters are mirrored"
This reverts commit 593a33020f.
2023-06-14 21:44:55 +02:00
helgeerbe
e68baa3086 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-06-09 13:16:56 +02:00
Thomas Basler
593a33020f Fix: String numbers for HMT inverters are mirrored
Fixes: #1005
2023-06-07 18:05:51 +02:00
Thomas Basler
82b0272ceb Removed duplicate code by moving it into the radio base class 2023-06-03 12:07:46 +02:00
Thomas Basler
c5a31de5a8 First try to output some dBm info for the NRF module 2023-06-03 11:54:23 +02:00
MalteSchm
e7c8a89bd3 inital version of full solar passthrough
Webinterface change to set full solar passthrough values

Adding webapi and config changes to enable full solar passthrough over certain battery Soc

inital version of full solar passthrough in power limiter

Passthrough mode can be enabled via MQTT

translations

re-enable comment

remove unused variable
2023-06-02 12:49:24 +02:00
Thomas Basler
249436a303 Added possible description for alarm code 73
https://github.com/tbnobody/OpenDTU/discussions/590#discussioncomment-6049750
2023-05-31 19:23:35 +02:00
Thomas Basler
e0027d951b Feature: Added new found HMS-900 to DevInfoParser
Fixes #967
2023-05-27 11:14:15 +02:00
Thomas Basler
5fea7ee066 Fix: Doublecheck if the MutiDataCommand begins with the correct ID
ID is 0x15 | 0x80
2023-05-24 22:06:58 +02:00
Thomas Basler
8f2a2b40b1 Fix: Filter incoming packages from CMT module for the right destination address
The CMT module receives every package on it's target frequency. Compared to the NRF module to filtering takes place. Therefor it's required to check if the package destination id is really the id of our dtu
2023-05-24 21:55:15 +02:00
helgeerbe
a3e7439181 fix(action): sort tags in chronological order 2023-05-24 09:13:04 +02:00
Thomas Basler
fe90c863bf Fix: Better handling of invalid fragment ids 2023-05-23 19:32:51 +02:00
helgeerbe
b7ac70b1ca Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-05-23 09:19:57 +02:00
Thomas Basler
295eeba556 Feature: Added new found HMS-450 to DevInfoParser
Fixes #911
2023-05-11 18:26:56 +02:00
helgeerbe
1c7b7d3cdf Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-05-10 18:16:25 +02:00
Thomas Basler
7be5dd865a Feature: Added new found HMS-1600 to DevInfoParser 2023-05-09 19:29:23 +02:00
Thomas Basler
99ab78d544 Feature: Added new found HMS-600 to DevInfoParser 2023-05-06 17:49:04 +02:00
Thomas Basler
74abc1ec1d Feature: Added new found HMS-2000 to DevInfoParser
Fix #886
2023-05-06 12:16:05 +02:00
helgeerbe
dae4c6fbf5 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-04-28 22:38:39 +02:00
Markus Krause
a56d5adb77 fix SPI assignment across generations 2023-04-28 21:26:22 +02:00
Markus Krause
b086c6ace6 remove non-sensical octa-spi setting in FIFO mode 2023-04-28 21:26:22 +02:00
Markus Krause
a37b394139 try fix SPI driver for CMT 2023-04-28 21:26:22 +02:00
Markus Krause
14f9d1b3c6 avert SPI collision on S3/S2/C3 2023-04-28 21:26:22 +02:00
Thomas Basler
3504884836 Fix: xSemaphoreTake was useless
There was no check of the return value implemented therefore xSemaphoreTake was just executed and not locked
2023-04-28 21:02:10 +02:00
helgeerbe
e91935ab38 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-04-26 11:47:19 +02:00
Thomas Basler
0441bbbe72 Fix: Queue consumed whole memory on inverter timeout
When the poll interval was e.g. 1sec it was possible that the queue ran full and consumed the whole memory.
Now new entries are only added to the queue automatically if the queue is empty.  This issue also caused a lot of "DTU command failed" messages.
2023-04-25 19:24:56 +02:00
helgeerbe
37b5edb010 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-04-25 18:51:18 +02:00
Thomas Basler
98da2b64e2 Rename FLD_PRA to FLD_Q 2023-04-24 22:29:59 +02:00
Thomas Basler
270a7f4933 Rename UNIT_VA to UNIT_VAR 2023-04-24 22:25:15 +02:00
Thomas Basler
793cd9db91 Fix: Possible crash when multiple tasks accessed the SPI bus
This could happen when  the main loop and the web server callback accessed the  SPI bus at the same time  (e.g. to show the isConnected status)
2023-04-22 10:59:32 +02:00
Thomas Basler
f5c15a445b Move byteAssignment to stack (avoid container) to save heap 2023-04-22 01:12:29 +02:00
Thomas Basler
0e9c666981 Implement method as static 2023-04-21 19:02:10 +02:00
helgeerbe
84a6ed540d Merge branch 've.direct-hex' into development 2023-04-19 14:33:00 +02:00
helgeerbe
a1b3bdfee8 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-04-18 12:09:22 +02:00
Thomas Basler
5d2656550c Optimize detection if RF module is configured
Use PinMapping method instead of dedicated method in Hoymiles lib --> Same result but reduces variables
2023-04-17 23:19:53 +02:00
helgeerbe
8cc548d13e add pid 0XA110 SmartSolar MPPT RS 450|100 2023-04-17 22:33:11 +02:00
helgeerbe
b8e06bf824 ve.diect with hex asnync messages
ignore async hex messeage on older devices
2023-04-17 22:18:20 +02:00
Thomas Basler
af3a277e30 Introduced HoymilesRadio property to determine if a configuration attempt was done 2023-04-17 18:59:56 +02:00
Thomas Basler
1416efc6f9 Fix: Endless loop when CMT module was configured but not connected 2023-04-17 18:58:23 +02:00
helgeerbe
40cee1f9ca Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-04-17 11:08:55 +02:00
Thomas Basler
7c37d289c0 Enabled additional statistics data for HMT inverters
Not yet shown in web ui and mqtt
2023-04-15 10:55:48 +02:00
Thomas Basler
6856ba9972 Fix: Change defines to get a correct calculation if base frequency of CMT module is different compared to Hoymiles base frequency 2023-04-15 10:55:48 +02:00
Thomas Basler
f3942bb647 Fix: Set correct frequency when changing it via web ui
Previously it could happen that the frequency was changed between saving old and recovering new frequency. Therefor an invalid frequency was saved in the CMT module
2023-04-15 10:55:48 +02:00
Thomas Basler
8356db94b9 Send ChannelChangeCommand only once per cycle as the inverter will not response at all 2023-04-15 10:55:48 +02:00
Thomas Basler
ac7b5dba11 Resend and Retransmit count is now implementable per command 2023-04-15 10:55:48 +02:00
Thomas Basler
e2aa29f117 Remove cmtProocess method and move RF logic into the cmt2300wrapper class 2023-04-15 10:55:48 +02:00
Thomas Basler
f5767e61ef Implement CMD56 as own command.
By doing so, it's possible to send all packets via the sendEsbPacket method. A lot of stuff could be removed which is no more used.
2023-04-15 10:55:48 +02:00
Thomas Basler
cfb37906ca Rename cmtFreqToChan to getChannelFromFrequency and simplify handling of current channel 2023-04-15 10:55:48 +02:00
Thomas Basler
1259f09503 Replace multiple print calls by a single printf in HoymilesRadio_NRF 2023-04-15 10:55:48 +02:00
Thomas Basler
a11ee472c6 Optimize cmtChToFreq method to return float instead of string. Renamed also to getFrequencyFromChannel 2023-04-15 10:55:48 +02:00
Thomas Basler
2a92f67a9a Implement get and set channel in cmt2300 wrapper class 2023-04-15 10:55:48 +02:00
Thomas Basler
fffd872b20 Replace HOY_BASE_FREQ by CMT_BASE_FREQ 2023-04-15 10:55:48 +02:00