bacco007 / sensor.opennem

OpenNEM Sensor for Home Assistant
MIT License
11 stars 5 forks source link

Reduce the polling interval to every minute instead of 10mins #25

Open gurrier opened 8 months ago

gurrier commented 8 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] The NEM is a 5 minute market but the integration appears to only update every 10 minutes or so. This misses some of the price changes that can be beneficially used for automations.

Describe the solution you'd like A clear and concise description of what you want to happen. Polling on every minute (or preferably use API Push if possible to retrieve updated values as soon as OpenNEM is aware of them.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. I can see the price changes at AEMO website to be able to manually compare and check timings

Additional context Add any other context or screenshots about the feature request here.

gurrier commented 8 months ago

I can see that the json is updated roughly 70 seconds after the start of the 5minute interval. Would be a ideal if it were aware of this typical behaviour to schedule the next update poll. https://data.opennem.org.au/v3/stats/au/NEM/power/7d.json

gurrier commented 8 months ago

I found the hard-coded update interval in /config/custom_components/opennem/init.py

DEFAULT_SCAN_INTERVAL = datetime.timedelta(minutes=10)

Would be great to have this defaulted to a lower value given the 5 minute nature of the National Electricity Market.

Even better would be to have some way of having it more regulalry check near the start of the 5 minute interval until it finds the updated JSON files, then sleep for about 5 minutes.

bacco007 commented 8 months ago

10 minutes was adopted to ensure that the data came through cleanly - it was previously less but resulted in issues where the opennem platform hadn't quite kept pace and resulted in a lot of duplicates and missing data

I'm not in a position to make improvements to the integration for the foreseeable future, I'm more then happy to accept PRs from people who are interested in building out the integration though

On 26 Oct 2023, at 11:12, tmugan @.***> wrote:



I found the hard-coded update interrval in /config/custom_components/opennem/init.py

DEFAULT_SCAN_INTERVAL = datetime.timedelta(minutes=10)

Would be great to have this defaulted to a lower value given the 5 minute nature of the National Electricity Market.

Even better would be to have some way of having it more regulalry check near the start of the 5 minute interval until it finds the updated JSON files, then sleep for about 5 minutes.

— Reply to this email directly, view it on GitHubhttps://github.com/bacco007/sensor.opennem/issues/25#issuecomment-1780224795, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABT6XTHEGPWO72RQUEBAOADYBGTHVAVCNFSM6AAAAAA6QF4ZZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBQGIZDINZZGU. You are receiving this because you are subscribed to this thread.Message ID: @.***>