Starting from tomorrow (2025-10-01) Tibber will change from hourly to quarter-hour prices.
I have made this driver for use with Tibber API to control devices according to the current electricity price.
Features:
Gets and stores the price of the current days 96 quarter-hours and updates the current price at the start of every quarter-hour.
Calculates the day average price.
Calculates high and low price.
Fixed high and low price.
Four child devices for easy use in automatons in for example Rule Machine.
Visit my GitHub-page for more information and the code.
Added attributes for number of periods that has low/high price
API is now only called once a day
Fixed a bug.
I noticed that tomorrow the lowest price in SE4 is 3 öre. That made the calculated low-price threshold that low that almost no other periods was considered as low. So I added the ability to set fixed price thresholds as kind of a quick fix.
I also moved the setting for the factor to a command for more easily adjustment.
When adjusting factor or fixed thresholds the driver refreshes and recalculates the thresholds and shows the number of periods that has low/high price.
I changed the driver so that it doesn't call the API every time it refreshes. Use the command callAPI if you want to manually make a API call.
The new code is found in the link in the first post.
Please remember to set fixed high/low and factor when changing to the new code, else the driver wont work.
Hi tsaaek, I've tested your app and would like to use it. However, it should also automatically query the current price from the API every 15 minutes. It doesn't do that, though. Why did you program it that way? Thanks and regards, Basti
It query the API once a day and stores all the 96 quarter-hour data in the driver, does the calculation for average price and thresholds for high and low prices and stores these values.
Then every 15 minutes it query the stored data to get the current price and compares it to the calculated values and updates the child-devices.
One of the reasons i programmed it this way is to limit API-calls so that it is more friendly to their API, instead of doing 96 calls per day. It should also save some (probably not much) time, and cause less load on the hub.
EDIT.
I realized that the instructions in the code and on github was wrong. I made some changes in the code. See next post.