Commit Graph

2574 Commits

Author SHA1 Message Date
Andreas Böhm
e3f9da75b9
BREAKING CHANGE: allow multiple OpenDTU-OnBattery instances at same HASS
This breaks existing HASS automation, as entity names and MQTT topics change!

* include dtu-unique-id in DPL MQTT HASS topics to allow multiple DTUs to be controlled
* fix filename "src/MqttHandlVedirectHass.cpp"
* refactor: use values from 'MqttHandleHass', add 'via_device' to all HASS devices
* set step size for power limiter voltage values
2024-07-23 21:27:14 +02:00
Bernhard Kirchen
6ee6eaf0b2
Fix: inverter power limits precision
Hoymiles inverters allow setting relative limits with a precision of 0.1 %.
this changeset allows to utilize this precision.

* preserve accuracy when decoding power limit
* Web API: process floating point limits
* MQTT: process floating point limits
* use appropriate accuracy for limits in web UI
* HASS: step for relative inverter limit is 0.1 %
2024-07-23 21:17:25 +02:00
Bernhard Kirchen
86a49a781a fix: use mutex when writing MQTT power meter value
we previously used the mutex to protect writing the target variable.
however, we would only do that for the old usecase, where a plain float
value in Watts was expected as the topic's payload.
2024-07-22 20:07:38 +02:00
Bernhard Kirchen
5e5a5253f4 fix: initialize MQTT power meter values to zero
avoid using uninitialized memory.
2024-07-22 20:07:38 +02:00
Niko
415c767d1d
Fix: Victron MPPT: be happy with at least one that delivers valid data (#1118) 2024-07-21 19:46:06 +02:00
Sven Sowa
5fee069c65
Remove double call to generateOnBatteryJsonResponse() (#1115)
the 2nd call was added in a merge operation in April
2024-07-21 17:59:57 +02:00
Niko
0013b2c934
Double VE.Direct receive buffer to avoid overflow (#1109) 2024-07-16 08:15:11 +02:00
Bernhard Kirchen
926a0b992d improve error messages when probing JSON path value type 2024-07-15 17:41:30 +02:00
Bernhard Kirchen
9e7a0bca31 fix: handle numeric values disguised as strings in JSON
closes #1104.
2024-07-15 17:41:30 +02:00
Andreas Böhm
b90da210be
Fix: Improve overscaling for shaded inputs (#1089) 2024-07-11 15:03:12 +02:00
Bernhard Kirchen
d9d0141fde Merge upstream tag 'v24.6.29' into development 2024-07-10 21:45:43 +02:00
Bernhard Kirchen
e358513495
Merge PR #1077 from helgeerbe/powermeter-refactoring
this PowerMeter refactoring tackles many issues and prepares to solve many more.
2024-07-10 21:20:39 +02:00
Andreas Böhm
6a3f90ff95
Feature: add support for Pytes batteries using CAN (#1088)
Co-authored-by: Bernhard Kirchen <schlimmchen@posteo.net>
2024-07-10 21:01:49 +02:00
Bernhard Kirchen
0c16652acb make MQTT power meter the default power meter
make the MQTT power meter pre-selected when editing power meter settings
for the first time. the MQTT power meter is the most efficient and hence
preferred power meter implementation.
2024-07-01 22:12:30 +02:00
Bernhard Kirchen
b808e9ab18 HTTP+JSON power meter: value 1 is always enabled
enabling the HTTP+JSON power meter without enabling at least one value
makes no sense, so value 1 has always been treated as "always enabled".
while doing the power meter refactoring, however, a regression was
introduced that would hide the settings for value 1 in the web UI until
the power meter settings would be saved, which they cannot be due to
missing settings for value 1.
2024-07-01 22:07:55 +02:00
Thomas Basler
e541a885f5 webapp: add app.js.gz 2024-06-29 18:57:35 +02:00
Thomas Basler
4640ddfba0 Better handling of empty MQTT client id
If the configured client id is empty, the default value (auto generated) will be used
2024-06-29 11:05:04 +02:00
Thomas Basler
a667042977 webapp: Update dependencies 2024-06-29 00:33:49 +02:00
Thomas Basler
ba95f99e03 Feature: Allow custom MQTT Client ID 2024-06-29 00:28:21 +02:00
Thomas Basler
e4bbf55ea5 webapp: Check if temperature is set
It seems that some ESPs don't have a temperature sensor anymore
2024-06-29 00:08:57 +02:00
Thomas Basler
b9b2a19ac5 Fix: Remove not required semicolon 2024-06-29 00:08:27 +02:00
Bernhard Kirchen
3fe39d722c PowerMeter admin view: make the linter happy
* do not combine v-if and v-for
* add v-bind:key to for loop of HTTPS+JSON power meter value configs
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
9911dec279 HTTP request config component: do not mutate prop
use an event-driven mutation scheme, i.e., adapt the common v-model
approach to bind data to the child component.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
6b19b877c6 power meter refactoring: split loop task init from init()
when performing a test request using the web UI, we need to init() the
respective power meter, but we do not want to start the polling task.
hence we move initialization of the polling task to the poll() function.
it will return if the task is setup already, otherwise setup the task.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
6b09ca056e Feature: SML power meters: reset SML decoder
implement a function which allows to reset the SML decoder. this new
function is used after a datagram ends. for the SML HTTP power meter
this is simple: after all bytes from the request's answer have been
decoded, we reset the decoder. for the SML serial power meter, we
perform the reset after a datagram ended based on timing (no new bytes
have been received for a specific amount of time).
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
ea454972b9 Feature: SML power meter: handle checksum error
cache the values decoded in the SML datagram and only copy them to the
local stash of values if the checksum of the SML datagram matched. also
makes sure that values from incomplete SML datagrams are not used.

moreover, we now only publish values to the MQTT broker that we actually
decoded (successfully) from an SML datagram (we previously published 0.0
as values to topics we never decoded a value for).
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
5be1615f4e SML parser: add new OBIS handlers for Hertz and Degrees
copied from the original library.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
19a8f6a7bd SML parser: pass SML char by value
there is no use in passing it by reference, especially a non-const
reference.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
7f724ce561 SML parser: remove commented-out code
the comparison is part of the original library code, but the compiler
rightfully complains that the comparison byte <= 0xFF is always true,
since byte is uint8_t. the comparison was commented out, and is now
removed.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
1afa9a6d90 SML parser: prevent out-of-bound array access
array nodes has MAX_TREE_SIZE elements, so the maximum index allowed to
use to access an element of nodes is one less, not MAX_TREE_SIZE.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
a1138a2202 Feature: Serial SML power meter: poll asynchronously 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
7b962f58b0 update EspSoftwareSerial to 8.2.0
also ghostl is now a dependency of EspSoftwareSerial and hence there is
no need to list it explicitly in platformio.ini.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
fb7b710cb7 SML power meter: improve message output
* when printing a message, tell the name of the derived class.
* print total power only when state SML_FINAL reached.
* tell if a checksum verification error occurred.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
6c06e71fd0 Feature: SDM power meter: switch to software serial
a 9600 baud serial interface does not need a hardware UART. these
changes switch the SDM power meter implementation to use a software
serial instance instead. this is desirable as hardware UARTs are scarce
and users need them for JK BMS and VE.Direct interfaces.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
8202bb23cd update SDM power meter library to version 2.2.3
in particular, this brings improved timing (settings). the values are
now read out much quicker in succession.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
a5ba24fdd8 SDM power meter: check stop flag in between transactions
the destructor will block for way too long if we keep holding the
polling mutex while performing a transcation with the SDM power meter.
when reading, we now release the lock. afterwards, i.e., in between
transactions, we check the stop flag so the task terminates in a timely
manner once asked to do so.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
ea84bb9229 power meter web UI: remove JSON path placeholder
this causes too much confusion, as many users don't understand that this
is a placeholder, not an actual configured value.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
40423b0e07 SDM power meter: evaluate error code after polling value 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
24f701020c SDM 1-phase power meter: only publish known values
a 1-phase SDM power meter does not know about power or voltage of phase
2 or 3. do not publish values to the respective MQTT topics when using a
single phase SDM power meter.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
4ad8e88e77 fix: SDM power meter: free HW serial port 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
db869a1144 powermeter refactor: use HTTP1.0
avoid problems with chunked transfer encoding when using the client's
stream to parse a JSON document. fixes the HTTP+JSON power meter to work
with shelly and hichi (Tasmota).
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
15b6a32b92 Feature: support JSON payload in MQTT power meter
the MQTT power meter can now process the messages published at the
respective topics as JSON and extract a power value using a JSON path
(same as in HTTP+JSON power meter). additionally, selecting a unit for
the power value as well as an option to invert the value's sign was
added as well, similar to the HTTPS+JSON power meter.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
347dd67684 Feature: SDM power meter: poll asynchronously 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
8a46ba9541 Feature: HTTP+JSON power meter: poll asynchronously 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
f6f62a604d Feature: HTTP+SML power meter: poll asynchronously 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
9520d8d394 powermeter refactor: polish web UI 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
a2a9debd02 Feature: make power meter polling intervals configurable
this change makes the respective setting accessible from the web UI.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
b891a4c1a3 powermeter refactor: instanciate power meters with config
instead of reading the main config's powermeter struct(s), the
individual power meters now are instanciated using a copy of their
respective config. this allows to instanciate different power meters
with different configs. as a first step, this simplifies instanciating
power meters for test purposes.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
3f2d9d38fa powermeter refactor: fully structure settings per provider
all power meter providers now have their own configuration struct
defined. a respective method to serialize and deserialize the provider
config is implemented for each provider.
2024-06-27 22:18:41 +02:00
Bernhard Kirchen
e1778eba76 powermeter refactor: use HttpGetter in HTTP SML implementation 2024-06-27 22:18:41 +02:00