tbnobody / OpenDTU

Software for ESP32 to talk to Hoymiles/TSUN/Solenso Inverters
GNU General Public License v2.0
1.77k stars 495 forks source link

[Request] Create a toggle for "reset events retrieved from the web API at midnight", resulting in an empty response until next inverter startup. #1875

Open phol opened 5 months ago

phol commented 5 months ago

Is your feature request related to a problem? Please describe.

After our discussion in #1800, in which we discussed the issue of inverter events not containing a date, I have tried to create an analysis of the issue of event timestamps. It is, in a way, similar to #1857, in that this is a problem of how state should be handled by OpenDTU or downstream tools. In OpenDTU Logger, I would like to implement a solution for tracking events in the following way:

Theoretically, this should work, as, according to @tbnobody in #1800, the inverter resets events at midnight. However, OpenDTU keeps track of inverter events in the web interface, even after midnight / disconnection, until next startup of the inverter. This makes it a bit more troublesome to implement this.

Describe the solution you'd like

Create a toggle for "reset events retrieved from the web API at midnight", resulting in an empty response from the /api/eventlog/status?inv=xxxx web API until next startup.

Another approach would be to create a toggle for "reset events web API endpoint after inverter restart",

Describe alternatives you've considered

Alternatively, if @tbnobody is open to implementing feature request #1845

Additional context

Please also let me know if I'm missing something in this analysis, or tell me why this wouldn't work. I'm open to hearing your constructive criticisms :) .

phol commented 3 months ago

I just noticed this feature has been implemented with commit 6e607f7f67a535078a337681a249a82b316876c7, "Feature: Add option to clear eventlog at midnight".

Thanks @tbnobody. I'll try to start working on proper event logging in OpenDTU logger soon. I'm currently also working on creating a Home Assistant integration for OpenDTU logger.

If that's ok, I'll keep this issue open for now. I'll close it once I've implemented events tracking, so that people following along are kept up to date about when it's ready.