Commit Graph

9 Commits

Author SHA1 Message Date
Bernhard Kirchen
f6f62a604d Feature: HTTP+SML power meter: poll asynchronously 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
e1778eba76 powermeter refactor: use HttpGetter in HTTP SML implementation 2024-06-27 22:18:41 +02:00
Bernhard Kirchen
297b149f84 powermeter refactor: generalize HTTP request config
the parameters to peform an HTTP request by the HTTP(S)+JSON power meter
have been generalized by introducing a new config struct. this is now
used for all values which the HTTP(S)+JSON power meter can retrieve, and
also used by the HTTP+SML power meter implementation. we anticipate that
other feature will use this config as well.

generalizing also allows to share serialization and deserialization
methods in the configuration handler and the web API handler, leading to
de-duplication of code and reduced flash memory usage.

a new web UI component is implemented to manage a set of HTTP request
settings.
2024-06-26 21:25:08 +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
6e44a6d750 powermeter refactor: allow destruction of httpClient
make sure the wifiClient used by the httpClient lives longer than the
httpClient, as it accesses the pointer to the wifiClient in its
destructor.
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