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

Make pvoutput reports align with status interval wall clock time #212

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bigjools
Copy link

The previous code had a problem where it would do an intitial report on start up and then add status_interval minutes to the next report time after it had finished processing.

This causes 2 problems:

  1. Time drift - the report time interval is longer than the actual status_interval so over the course of the day ends up being later and later which can lead to a gap in the pvoutput data.
  2. The report time is unpredictable, which will cause clashes with other systems that report consumption data each time the report time drifts enough to clash with the other system's upload with the end result that one cancels out the other.

To fix #2, the second system just needs to report the same report timestamp 30 seconds later than the first.

The fix here aligns the report time to a rounded fraction of the wall clock time so that it matches the wall clock time on pvoutput's list of reports on the UI. Typically if you report every 5 minutes, it will now send a report to pvoutput at :00, :05, :10, etc. instead of the previous non-rounded times that drifted forward.

The previous code had a problem where it would do an intitial report
on start up and then add status_interval minutes to the next report
time *after* it had finished processing.

This causes 2 problems:
 1. Time drift - the report time interval is longer than the actual
    status_interval so over the course of the day ends up being later
    and later which can lead to a gap in the pvoutput data.
 2. The report time is unpredictable, which will cause clashes with other
    systems that report consumption data each time the report time
    drifts enough to clash with the other system's upload with the
    end result that one cancels out the other.

To fix bohdan-s#2, the second system just needs to report the same report
timestamp 30 seconds later than the first.

The fix here aligns the report time to a rounded fraction of the
wall clock time so that it matches the wall clock time on pvoutput's
list of reports on the UI. Typically if you report every 5 minutes,
it will now send a report to pvoutput at :00, :05, :10, etc.
instead of the previous non-rounded times that drifted forward.
@bigjools
Copy link
Author

You can see the effect of the fix here, which was applied around 2pm:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please make sure mqtt.py exists in the exports folder
1 participant