XavierBerger / Solar-Router-for-ESPHome

Solar Router for ESPHome
GNU General Public License v3.0
7 stars 2 forks source link

energy saved update #16

Open tikismoke opened 1 week ago

tikismoke commented 1 week ago

https://github.com/XavierBerger/Solar-Router-for-ESPHome/blob/22c3912fd9d19e2ae506fbb93b6e8a1131450b1b/solar_router/energy_saved_counter_theorical.yaml#L18

I think we should update this everytime the regulator_opening.state change, not every 30s.

Maybe just duplicate update script energy_saved_counter from energy_saved_counter_none with the lambda from energy_saved_counter_theorical like done here: https://github.com/XavierBerger/Solar-Router-for-ESPHome/blob/22c3912fd9d19e2ae506fbb93b6e8a1131450b1b/solar_router/solar_router_engine.yaml#L50

May be not so easy ;)

XavierBerger commented 4 days ago

This piece of code is in development stage. I didn't test it yet.

In my algorithm, I planned to increment energy_saved every time the Triac opening is modified. This counter is an incremental counter. To avoid generating too much data, the idea is to publish the energy saved less frequently... every 30sec in my prototype.