Tibber sensor for future price (tomorrow)

What about a solution such as this custom integration for Frank Energie is doing? They added future prices as an attribute on the sensor with the current price:

state_class: measurement
prices: 
- from: '2022-12-03T00:00:00+01:00'
  till: '2022-12-03T01:00:00+01:00'
  price: 0.4884
- from: '2022-12-03T01:00:00+01:00'
  till: '2022-12-03T02:00:00+01:00'
  price: 0.4481
[...snip...]
- from: '2022-12-03T23:00:00+01:00'
  till: '2022-12-04T00:00:00+01:00'
  price: 0.423

unit_of_measurement: €/kWh
attribution: Data provided by Frank Energie
device_class: monetary
icon: mdi:currency-eur
friendly_name: Current electricity price (All-in)

I really like this approach as it allows me to easily use these values in an automation, e.g. to schedule my dishwasher:

alias: Dishwasher - Auto schedule Eco50
description:
  Automatically schedules the Eco50 program during cheap electricity
  prices when the dishwasher door is closed and remote start is enabled.
trigger:
  - type: not_opened
    platform: device
    device_id: "{{ dishwasher_id }}"
    entity_id: binary_sensor.dishwasher_door
    domain: binary_sensor
condition:
  - condition: state
    entity_id: sensor.dishwasher_operation_state
    state: Ready
  - type: is_on
    condition: device
    device_id: "{{ dishwasher_id }}"
    entity_id: binary_sensor.dishwasher_remote_control
    domain: binary_sensor
action:
  - service: home_connect.start_program
    data:
      device_id: "{{ dishwasher_id }}"
      program: Dishcare.Dishwasher.Program.Eco50
      key: BSH.Common.Option.StartInRelative
      value: |
        {% set lowest_price = state_attr('sensor.current_electricity_price_all_in', 'prices') | selectattr('from', 'gt', now()) | selectattr('till', 'lt', now() + timedelta(hours=check_prices_hours_ahead)) | min(attribute='price') %}
        {% set delay = (lowest_price['from'] - now()).total_seconds() | int - delay_offset_seconds %}
        {{ delay if delay > 0 else 0 }}
      unit: seconds
variables:
  dishwasher_id: 5ea51af1fee5c7e8f4c1b7a8ee70b048
  delay_offset_seconds: 900  # takes over 15 minutes to use full power
  check_prices_hours_ahead: 9
mode: single

From what I can tell (though I may be wrong!), this is not possible with the current custom component as it only provides a graph.

3 Likes

I just signed up for Tibber and am getting ready to make the most of it. I had the other custom component running (that showed OK in it’s standard state) and am now trying to get yours working, but instead of showing OK it actually comes up empty.
Not sure what-äs going on…I don’t get any errors, but it doesn’t appear to be getting any data from the Tibber API despite the API key…

I’ve been in so many discussions around this Tibber data and have worked so much in my sensors that I don’t know which one you are testing right now, but will spend some time later this week to read back this thread and try to understand the issue you have,

Anyway, you can find in GitHub the Tibber library I have on production on my Home Assistant right now:

This custom component provides future prices: Add hourly price data by Knodd · Pull Request #34 · Danielhiversen/home_assistant_tibber_data · GitHub

It will be great to have this from the official integration, however I could see this was merged back in October and still not available in production.
Do you have any clue in how is this process?

Aha!

I just realized that is a different repository…

I will try out later.

By the way, I liked the experimental sensors:

Experimental and requires additional configuration:

  • Grid price (Only if your grid company is supported by Tibber)
  • Estimated total price with subsidy and grid price (Only if your grid company is supported by Tibber)
    How can I setup these additional configuration?

Thanks for your replies. Right now I think my problwm isn’t with the custom component at all, it’s simply that Tibber hasn’t “activated” my contract yet, so I don’t get any data from the API at all. I will keep waiting ans trying and see what happens once my switch to Tibber is complete. I might have to stick with Nordpool as a data source anyway because there are some nice integrations (like the EV Smart Charge) that rely und Nordpool data.
.

1 Like

Have you tried:

Optional for extra sensors:

tibber_data:
  email: Your email registred at Tibber
  password: Your Tibber password

… in conf.yaml

Yeah, I got that, however I’m still a little bit lost with all those new sensors…

I’ve some unknown and I couldn’t find the future prices.

@Danielhiversen, am I missing something?

Ok, yes sure looks like it’s the “unknown” who are interesting :slight_smile: , i don’t know if future_price is a separate, or whether it’s “included” in energy_price … which will get updated in about 1.5 hour
EDIT: Currently there is no “Tomorrows_Price” from Northpool
PS: Seems like there is no such thing as “future_price.sensor” , and as tomorrows_price is not “available” you get “unknown” — keep me posted :wink:

Ok, so now I have the Tibber sensors. It really was because my Tibber contract wasn’t confirmed yet. It’s still not active, but the date is set (February 10) so they apparently unlocked the API for my account.

Now I have Tibber, Nordpool and entso-e data…just need to figure out the best way to use it…:wink:

1 Like

I have a automation using HA and node-red with my bosh dishwasher that start it during night time based on the best price if the door is closed but have been opened since last run… Seem to be the same thing you try to do.

I still ironing out some quirks for the full integration but here is the tibber part, it has been stable (even if the js code is not as good as it could be).

What you get is a global variable called tibberBestPrices that contain objects called h1, h2 … h35. each of this object is an array of timeslots sorted by price.
So if you want echo50 that takes 5hours, you want to look at tibberBestPrices.h5[0].startsAt that contains the timestamp it’s cheapest to run for 5hours tibberBestPrices.h5[0].total contains the price per kwh.
I personaly check multiply the price Bosch SMU4HAW48S - Teleradio with the total of h5 (eco50) h2 (auto2) h1 (quick65). Most of the time echo50 is the most cheap option but it has happened once or twince that h1 or h2 have been cheaper, even if I’m not sure about that as I didn’t included the static cost per kwh back then.

Anyway this can be used to find the best price for anything that can be run automatically for a predefined time. (washing mashine with builtin dryer being what comes to mind first.)
Heating in basement/summer house or what ever could use this (in that case I would have a backup radiator targeting 10degrees and automisation targeting 15 degrees, just in case automisation fail.

I THINK you should be able to import this directly to node-red but you have to add tibber plugins by your self and change the sesors to the correct ones. (should be easy).

Hope it’s of some use. I’m a rookie in this community.

1 Like

Thanks. I will look into this over the next few days.
I have found a good solution for charging my PV battery (I think) but am having some trouble with reliability…not reliability of the script but of the “force charge” Command on my Huawei battery. It fails occasionally and then doesn’t retry which is an issue.
But since my Tibber contract only starts in a month I still have time for fixes.

Is it just me or is the sensor from tibber_data very slow / unreliable to get tomorrows prices? Can’t seem to force an update with homeassistant.update_entity either.

I would like to utilize this so I don’t fetch the same data many times but this seems to be working less reliable than a rest-sensor, nordpool etc.

What do you mean by slow?
It tries at a random time between 13:15 and 13:30

That it often doesn’t have prices for tomorrow when I expect it to.
I wrote my post at around 15:00 but I see now at 20:00 that it still doesn’t have values for tomorrow. So for me it seems that it doesn’t retry if fetching the new prices is not successful.
Nothing in the log either.

Then it is something wrong, it should retry.
You can try to turn on debug logging

Something weid appers to be going on…I have entso-e, Nordpool and Tibber data in Home Assistant.

For some reason, Tibber shows about 1ct (EUR) more than the other two consistently. This appears to be the case for the official integration and the API integration…

Oh yeah, now I get lots of rows in the log. After updating successfully with tomorrows prices for a couple of days, today it refuses to fetch tomorrows prices again.

2023-01-23 13:00:39.041 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Cons: Cons(2023-01-24 23:00:00+01:00, -, 0.43, -)
2023-01-23 13:00:53.948 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Finished fetching Tibber Data Grankullen data in 40.723 seconds (success: True)
2023-01-23 13:00:53.950 DEBUG (MainThread) [custom_components.tibber_data.sensor] No grid price available
2023-01-23 13:00:53.967 DEBUG (MainThread) [custom_components.tibber_data.sensor] No price info for tomorrow
2023-01-23 13:00:53.968 DEBUG (MainThread) [custom_components.tibber_data.sensor] No grid price available, no total price to add
2023-01-23 13:01:08.226 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Updating Tibber data <bound method TibberDataCoordinator._get_data of <custom_components.tibber_data.data_coordinator.TibberDataCoordinator object at 0x7f78fd3e8670>> 2023-01-24 00:00:00+01:00
2023-01-23 13:01:08.227 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Updating Tibber data <bound method TibberDataCoordinator._get_data_tibber of <custom_components.tibber_data.data_coordinator.TibberDataCoordinator object at 0x7f78fd3e8670>> 2023-01-24 13:24:05+01:00
2023-01-23 13:01:08.227 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Updating Tibber data <bound method TibberDataCoordinator._get_charger_data_tibber of <custom_components.tibber_data.data_coordinator.TibberDataCoordinator object at 0x7f78fd3e8670>> 2023-01-23 13:22:12.226262+01:00
2023-01-23 13:01:08.227 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Updating Tibber data <bound method TibberDataCoordinator._get_offline_evs_data_tibber of <custom_components.tibber_data.data_coordinator.TibberDataCoordinator object at 0x7f78fd3e8670>> 2023-01-23 13:22:12.226262+01:00
2023-01-23 13:01:08.228 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Finished fetching Tibber Data Grankullen data in 0.002 seconds (success: True)
2023-01-23 13:01:08.230 DEBUG (MainThread) [custom_components.tibber_data.sensor] No grid price available
2023-01-23 13:01:08.254 DEBUG (MainThread) [custom_components.tibber_data.sensor] No price info for tomorrow
2023-01-23 13:01:08.255 DEBUG (MainThread) [custom_components.tibber_data.sensor] No grid price available, no total price to add

Above the first line are similar lines for every hour in January but for today and tomorrow it shows 1 value instead of 3.
The other lines, except from the hourly prices seems to be stuck in some sort of loop and repeats every 15 seconds or so. Stating “success = True” every time but also “No price info for tomorrow”

2023-01-23 13:00:39.041 DEBUG (MainThread) [custom_components.tibber_data.data_coordinator] Cons: Cons(2023-01-24 23:00:00+01:00, -, 0.43, -)
2 Likes