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

Return None instead of Zero #2

Merged
merged 1 commit into from
Aug 27, 2024
Merged

Return None instead of Zero #2

merged 1 commit into from
Aug 27, 2024

Conversation

Bre77
Copy link
Contributor

@Bre77 Bre77 commented Aug 26, 2024

Zero is a valid price but not correct. Instead fall back to None.

#1

@cabberley cabberley merged commit aa67866 into cabberley:main Aug 27, 2024
@cabberley
Copy link
Owner

Thanks for your contribution! appreciate you not only identifying there was an issue in the way HA treated, but also providing the fix!

@Bre77
Copy link
Contributor Author

Bre77 commented Aug 27, 2024

Looks like it works how I expected now.
image

I am still not fully sure why the Average sensor ever needs to be unknown though, it seems the first period data is avaliable at that time, so I suspect there is a race condition or order of operations issue still with the library. I'll give it another look sometime.

@cabberley
Copy link
Owner

It will be a timing issue.
AEMO data for the 5 minute period normally isn't retrievable until somewhere between +30 to +75ish seconds after the period started. If you look at the coordinator config for my HA integration you will see I have logic that controls the period to poll the AEMO data source.
So the unknown value for period 1 is due to the call to AEMO occurring before the value has been posted by AEMO.
So the bottom line is I decided to start requesting just before we typically get the value and then stop polling at about 1.5 minutes and pause until the next 5 min period starts.

An alternative approach is to loop the AEMO data request until the publish the number.

But if you watched AEMO website a month or so ago when there was spikes going on, they basically suffered an overload and no one could get any data from the website.

Admittedly it is a basic failure of AEMO not use a Content Distribution Network like cloudflare to handle the unexpected burst. The data could easily be accessible no matter the scale of they architected it right.

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.

2 participants