openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.57k forks source link

[aWATTar] Update prices more than once a day #16939

Closed thomasleber closed 1 week ago

thomasleber commented 1 month ago

Following up todays havoc on the EEX, we should consider updating the price more than once a day.

The EEX had a hick-up today, spiking the price in Germany and Austria up to 4€ per kwh.

The plugin would only update the price once at 1500 (afaik from code). The prices seemed normal at 1500 CEST. But at 1508 it seems an update occurred, showing new data.

The plugin would not update the prices, leading the schedules to not be aligned with the updated data.

Expected Behavior

New marked prices will be used when an update occurs.

Current Behavior

Scheduler will update once a day at 1500, ignoring all the following updates.

Possible Solution

Schedule more often an update eg. at 1500, 1800, 2300

Steps to Reproduce (for Bugs)

--

Context

https://montelnews.com/news/e072de7e-5651-4abe-b817-cf76e8e95d28/decoupling-causes-huge-price-variations

Your Environment

OpenHAB 4.1.3

tl-photography commented 1 month ago

I have only mobile screenshots but I have made one before and after restarting the bridge today:

Before Screenshot_20240626-101908

After Screenshot_20240626-102242

J-N-K commented 3 weeks ago

@thomasleber Can you check with the latest code (i.e. 4.3.0-SNAPSHOT)? I believe this is also fixed by #17032.

thomasleber commented 2 weeks ago

Hi @J-N-K

Unfortunately i don't think so. The line that controls the refresh is afaik this one: https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.awattar/src/main/java/org/openhab/binding/awattar/internal/handler/AwattarBridgeHandler.java#L188

The API is only checked once, if the data in the time range is older than 15h.

thomasleber commented 2 weeks ago

localPrices.last().timerange().start() < Instant.now().toEpochMilli() + 9 * 3600 * 1000; will return true when the the current time plus 9h is larger than last entry of todays prieces.

tl-photography commented 2 weeks ago

I have tried to fix that here: https://github.com/openhab/openhab-addons/pull/17068