Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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 this issue Mar 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@phol
Copy link

phol commented Mar 28, 2024

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:

  • At inverter startup, the websocket emits new data
    • This, as I understand it, can be verified by the combination of data_age = 0 and events = 1.
    • This situation is combined with an "Inverter start" message.
    • Whenever this happens, OpenDTU Logger can store the startup date.
  • From inverter startup until the combination of data_age = 0 and events = 1 happens again
    • In the websocket output, the events counter will increase every time a new event occurs.
    • If an increase happens:
      • OpenDTU Logger can query the /api/eventlog/status?inv=11418186xxxx endpoint.
      • OpenDTU Logger can take the startup date + amount of seconds elapsed since then to calculate the start_time and end_time timestamps.

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

  • Add MQTT topic [serial]/events/messages for each inverter with a JSON array of start_time, end_time, message_ID, message with all messages.
    • Only emit the list of events to this topic when the events counter increases.
  • Add another topic [serial]/events/startup_dates containing the startup dates
    • Only update this topic whenever data_age = 0 and events = 1.

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 phol added the enhancement New feature or request label Mar 28, 2024
@phol phol changed the title [Request] Create a toggle for "reset events retrieved from the web API at midnight", resulting in an empty response until next startup. [Request] Create a toggle for "reset events retrieved from the web API at midnight", resulting in an empty response until next inverter startup. Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant