Tibber integration to include get_historic_data from pyTibber

Here is a start: Add Tibber peak hour, monthly consumption and monthly cost sensors by Danielhiversen · Pull Request #61853 · home-assistant/core · GitHub
Next step is to add hourly consumption data as statistics in Home Assistant

2 Likes

Fetch and store historic consumption data.

(Next step is to also add cost)

Tested a little and seems to work fine so far.
Would also be nice with an option to add additional costs like taxes.
For example additional 33 öre/kwh in taxes here in north Sweden.

For now i created addtional sensors for that but that doesn’t work for energy dashboard.

  elspot_kwh_skatt:
    friendly_name: "Elspot inkl. skatt (kWh)"
    unit_of_measurement: SEK/kWh
    device_class: energy
    icon_template: mdi:currency-usd
    value_template: "{{ (0.33 + float(states.sensor.electricity_price_xxx.state)) | round(3) }}"

  elspot_manad_kwh:
    friendly_name: "Månadens kostnad per kWh"
    unit_of_measurement: SEK/kWh
    device_class: energy
    icon_template: mdi:currency-usd
    value_template: "{{ ((0.33 * float(states.sensor.monthly_net_consumption_xxx.state) + float(states.sensor.monthly_cost_xxx.state)) / float(states.sensor.monthly_net_consumption_xxx.state)) | round(2) }}"
    
  elforbrukning_manad_totalt:
    friendly_name: "Månadens kostnad inkl. skatt"
    unit_of_measurement: SEK
    device_class: energy
    icon_template: mdi:cash
    value_template: "{{ (0.33 * float(states.sensor.monthly_net_consumption_xxx.state) + float(states.sensor.monthly_cost_xxx.state)) | round(2) }}"

Asked earlier but would it be possible to add an sensor for other things that is not monitored.
If you add all indivudal devices to sources you can get the costs for each device.
The idea is that it checks for current total before adding tibberdata something like:
Tibber consumption - Total consumption of all other sources = Other sources consumption.
Instead of adding normal tibber consumption sensor you could add that other sources sensor instead and get correct total consumption.