Commit Graph

7 Commits

Author SHA1 Message Date
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
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
75c07c17f2 powermeter refactor: SML lib: replace double by float
avoid additional conversions and avoid double for the fact that
calculations on type double are implemented in software, whereas
float is handled in hardware on ESP32.
2024-06-26 20:51:56 +02:00
qubeck
00def1d8d1
Generic SML based power meters support (#146)
* add support for energy & power readings on SML based power meters, taking OBIS 16.7.1 for power (using mod. SML Parser lib. by olliiiver)

* switched SML read to use software serial

* made total power meter response controled by meter source to obtain either the sum of phase powers or explicit total power provided by meter

* made mqtt subscriptions to power meter topics meter source dependend

* simplified SML read loop and OBIS handler registration, + minor refactoring

* minor cleanup/style changes and optim. PowerMeter

* fixed build, add SOURCE_SML == 4

* removed optional usage of HW serial for SML power meter

* switched to usage of _powerMeter1Power for SML power reading to allign better with existing code

---------

Co-authored-by: helgeerbe <helge@erbehome.de>
2023-04-07 20:20:00 +02:00