Commit Graph

8 Commits

Author SHA1 Message Date
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
a1138a2202 Feature: Serial SML power meter: poll asynchronously 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
673b9f4fa8 powermeter refactor: use destructors to de-initialize 2024-06-26 20:51:56 +02:00
Bernhard Kirchen
6108d24795 powermeter refactor: introduce PowerMeterSml
this new class handles SML data. it uses the SML lib to decode values
and manages those. this de-duplicates code as the class is applicable
to all power meters that collect SML data.
2024-06-26 20:51:56 +02:00
Bernhard Kirchen
d99cfd5b31 powermeter refactor: publish values to MQTT in base class
"powertotal" is always published and it is published by the base class
directly. other values are still published by the derived classes, but
use a base class method, which takes care that a common base topic is
used in particular.
2024-06-26 20:51:56 +02:00
Bernhard Kirchen
2397e5cdf5 powermeter refactor: split providers into their own classes
it is important to separate the capabilities of each power meter
provider into their own class/source file, as the providers work
fundamentally different and their implementations must not be
intermangled, which made maintenance and improvements a nightmare
in the past.
2024-06-26 20:51:54 +02:00