Tibber - Schedul prices upcoming 24 hours prices!

ja, das meinte ich

Ok, passt das so?

Kann es daran liegen, dass ich noch keine Rechnung bekommen habe?

den yaml code kann ich doch 1 zu 1 von dir übernehmen, oder?

LG Alex

This is an English forum, please adapt to it.

4 Likes

you are right. Sorry.

Hi,
does the multiscrape have some problems at the moment concerning the tibber website? I did not change my config just updated the core, but the sensory are unknown at the moment.

multiscrape:
  - name: HA scraper
    resource: https://tibber.com/de/strompreisentwicklung
    scan_interval: 3600
    sensor:
      - unique_id: tibber_strompreisentwicklung_kw
        name: tibber_strompreisentwicklung_kw
        select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.no-padding > div > div > div > div > div > div > div > h2 > span"
      - unique_id: tibber_strompreisentwicklung_short
        name: tibber_strompreisentwicklung_short
        select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.no-padding > div > div > div > div > div > p"
      - unique_id: tibber_strompreisentwicklung_preise
        name: tibber_strompreisentwicklung_preise
        select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(2)"
        attributes:
          - name: text_eins
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(3)"
          - name: text_zwei
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(4)"
          - name: text_drei
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(5)"
      - unique_id: tibber_strompreisentwicklung_fazit
        name: tibber_strompreisentwicklung_fazit
        select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(6)"

### {{ states("sensor.tibber_strompreisentwicklung_kw") }}
<ha-alert alert-type="info">{{ states("sensor.tibber_strompreisentwicklung_short") }}</ha-alert>

### {{ states("sensor.tibber_strompreisentwicklung_preise") }}

### {{ state_attr("sensor.tibber_strompreisentwicklung_preise","text_eins") }}

{{ state_attr("sensor.tibber_strompreisentwicklung_preise","text_zwei") }}

### {{ state_attr("sensor.tibber_strompreisentwicklung_preise","text_drei") }}

{{ states("sensor.tibber_strompreisentwicklung_fazit") }}

image

1 Like

Tibber seems to have changed some things on that side. If created an updated sensor and an updated code for the card.

Here is the code for my new sensor:

      - unique_id: tibber_strompreisentwicklung_website_text
        name: tibber_strompreisentwicklung_website_text
        select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.no-padding > div > div > div > div > div > div > div > h2"
        attributes:
          - name: tibber_price_preview_week_number
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.no-padding > div > div > div > div > div > div > div > h2"
          - name: tibber_price_preview_week_short_state
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.no-padding > div > div > div > div > div > p:nth-child(2)"
          - name: tibber_price_preview_header_country
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > h2 > div > h2"
          - name: tibber_price_preview_text_prices
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(2)"
          - name: tibber_price_preview_text_background_1
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(3)"
          - name: tibber_price_preview_text_background_2
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(4)"
          - name: tibber_price_preview_text_background_3
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(5)"
          - name: tibber_price_preview_text_background_4
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(6)"            
          - name: tibber_price_preview_text_summary
            select: "#app-root > div.jsx-850a60188453b536.app-container > div > section > div > div:nth-child(2) > div > div > div > div.Blocks.py-xl > div > div > div > p:nth-child(7)"

And here is the updated code for the card:

type: vertical-stack
cards:
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: sensor.tibber_strompreisentwicklung_website_text
        content: '{{states(entity)}}'
        icon: mdi:transmission-tower
        tap_action:
          action: none
        card_mod:
          style: |
            ha-card {
              border: none !important;
              box-shadow: none !important; 
              padding: 3px !important;
              background: none !important;
              margin-bottom: -10px !important;
              font-size: 3.5rem !important;
            }
      - type: spacer
  - type: custom:stack-in-card
    mode: vertical
    keep:
      background: true
      border_radius: true
      box_shadow: false
      margin: true
      outer_padding: true
    cards:
      - type: markdown
        card_mod:
          style:
            .: |
              ha-markdown {
                padding: 0px 0px 0px 0px !important;
                }
              ha-card {
                margin-top: -0.5rem;
                box-shadow: none;
                margin-left: -0.6rem;
                margin-right: -0.6rem;
                margin-top: -1rem;
              }      
        content: >-
          <ha-alert alert-type="info">{{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_week_short_state")
          }}</ha-alert>
      - type: markdown
        content: >-
          ## {{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_header_country")
          }}

          ### {{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_text_prices")
          }}

          ### {{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_text_background_1")
          }}


          {{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_text_background_2")
          }}


          {{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_text_background_3")
          }}


          {{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_text_background_4")
          }}      


          ## {{
          state_attr("sensor.tibber_strompreisentwicklung_website_text","tibber_price_preview_text_summary")
          }}



          Quelle:
          [**https://tibber.com/de/strompreisentwicklung**](https://tibber.com/de/strompreisentwicklung)

It should look like this again:

3 Likes

Updated Tibber Card

I´ve added a 90 day way-back-view of the prices

It looks like this:

Video-Demo

Here is the full YAML-Code for the updated Card.
Download

4 Likes

Hello Ingo, unfortunately I’m having problems again with nothing being displayed, I’ve created the input helpers, what else could be the problem?









Gruß Alex

Could you pls show the card tibber-einstellungen?
I guess you have also the automation for storage charging since there are not longer on top of the card?

For what is the divider between card title and card?

@Alexander-Wehner: only if tibber cycled a complete period, you have values for that. I haven’t reached a month so there are no bills and no infos for the monthly values.

The divider between the header and the rest of the card is just decoration :slight_smile:

You are right, i´ve put my settings into a seperate sub-view, which looks like this:

Here is the yaml-code for that sub-view:

type: custom:stack-in-card
mode: vertical
keep:
  background: true
  border_radius: true
  box_shadow: false
  margin: true
  outer_padding: true
cards:
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        content: Tibber-Einstellungen
        icon: mdi:transmission-tower
        tap_action:
          action: none
        card_mod:
          style: |
            ha-card {
              border: none !important;
              box-shadow: none !important; 
              padding: 3px !important;
              background: none !important;
              margin-bottom: -10px !important;
              font-size: 3.5rem !important;
            }
  - type: entities
    card_mod:
      style: |
        ha-card {
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
          background: none;
        }          
    entities:
      - type: divider
  - entity: input_number.tibber_grundpreis_je_monat
    type: tile
    color: red
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: input_number.tibber_messtellengebuhr_je_tag
    type: tile
    color: red
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: input_number.tibber_netznutzungsgebuhr_je_tag
    type: tile
    color: red
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: input_number.tibber_mehrwertsteuersatz
    type: tile
    color: red
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: automation.tibber_speicher_gunstig_laden
    type: tile
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: switch.senec_safe_charge
    type: tile
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: sensor.solar_restproduktion_heute
    type: tile
    color: orange
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: input_number.laden_bei_restproduktion_unter
    type: tile
    color: orange
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: sensor.produced_power_produktionsueberschuss
    type: tile
    color: green
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: input_number.laden_bei_uberschuss_unter
    type: tile
    color: green
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }  
  - entity: sensor.senec_system_state
    type: tile
    color: purple
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }          
  - entity: sensor.senec_battery_charge_percent
    type: tile
    color: purple
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }                  
  - entity: sensor.tibber_price_level_deutsch
    type: tile
    color: blue
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    
  - entity: sensor.tibber_prices
    type: tile
    color: blue
    card_mod:
      style: |
        ha-card {
          padding: 3px 3px 3px 3px !important;
          margin-top: -0.5rem;
          margin-bottom: -0.5rem;
        }    

And yes: i do have an automation for that. Here is the yaml-code of my automation:

alias: Tibber - Speicher günstig laden
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.tibber_price_level
    to: VERY_CHEAP
    id: sehr günstig
  - platform: state
    entity_id:
      - sensor.tibber_price_level
    to: CHEAP
    id: günstig
  - platform: state
    entity_id:
      - sensor.tibber_price_level
    to: NORMAL
    id: normal
  - platform: state
    entity_id:
      - sensor.tibber_price_level
    to: EXPENSIVE
    id: teuer
  - platform: state
    entity_id:
      - sensor.tibber_price_level
    to: VERY_EXPENSIVE
    id: sehr teuer
  - platform: state
    entity_id:
      - sensor.senec_system_state
    to: AKKU VOLL
    id: Speicher ist voll
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Speicher ist voll
              - normal
              - teuer
              - sehr teuer
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.tibber_speicher_laden
            data: {}
          - type: turn_off
            device_id: ba6662be81284ab19a7ff2a25d6c1c64
            entity_id: 4938b65e9c7938a7bfebb628361a12fb
            domain: switch
            enabled: true
      - conditions:
          - condition: trigger
            id:
              - sehr günstig
              - günstig
          - condition: not
            conditions:
              - condition: state
                entity_id: sensor.senec_system_state
                state: AKKU VOLL
          - condition: numeric_state
            entity_id: sensor.solar_restproduktion_heute
            below: 10
          - condition: numeric_state
            entity_id: sensor.produced_power_produktionsueberschuss
            below: 300
        sequence:
          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.tibber_speicher_laden
            data: {}
          - type: turn_on
            device_id: ba6662be81284ab19a7ff2a25d6c1c64
            entity_id: 4938b65e9c7938a7bfebb628361a12fb
            domain: switch
            enabled: true
mode: single

These sensor are NO input-helpers but restful-sensors to get data from the tibber api. They need to be configured as “sensors” in the configuration.yaml. Here is the code for that sensors:
(this needs to be UNDER a “sensor:”-entry in the configuration.yaml (perhaps you already have it there).

# Tibber Vorschaupreise
- platform: rest
  unique_id: tibber_prices
  name: Tibber Prices
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { currentSubscription { status priceInfo { current { total level startsAt } today { total level startsAt } tomorrow { total level startsAt } } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].currentSubscription.priceInfo" 
  json_attributes:
    - today
    - tomorrow
  value_template: "{{ value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.total | float }}"
  scan_interval: 300
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
    User-Agent: REST
  unit_of_measurement: EUR/kWh
  state_class: total

# Tibber Monthly Consumption Sensor
- platform: rest
  unique_id: tibber_monthly_consumption
  name: Tibber Monthly Consumption
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { consumption(resolution: MONTHLY, last: 12) { nodes { consumption cost unitPrice unitPriceVAT from to } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].consumption"
  json_attributes:
    - nodes
  value_template: "{{ value_json.data.viewer.homes[0].consumption.nodes[0].consumption | float }}"
  scan_interval: 300
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
  unit_of_measurement: kWh
  state_class: total

# Tibber Monthly Cost Sensor
- platform: rest
  unique_id: tibber_monthly_cost
  name: Tibber Monthly Cost
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { consumption(resolution: MONTHLY, last: 12) { nodes { consumption cost unitPrice unitPriceVAT from to } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].consumption"
  json_attributes:
    - nodes
  value_template: "{{ value_json.data.viewer.homes[0].consumption.nodes[0].cost | float }}"
  scan_interval: 300
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
  unit_of_measurement: EUR
  state_class: total

# Tibber Daily Cost Sensor
- platform: rest
  unique_id: tibber_daily_cost
  name: Tibber Daily Cost
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { consumption(resolution: DAILY, last: 30) { nodes { consumption cost unitPrice unitPriceVAT from to } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].consumption"
  json_attributes:
    - nodes
  value_template: "{{ value_json.data.viewer.homes[0].consumption.nodes[0].cost | float }}"
  scan_interval: 300
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
  unit_of_measurement: EUR
  state_class: total

# Tibber Daily Consumption Sensor
- platform: rest
  unique_id: tibber_daily_consumption
  name: Tibber Daily Consumption
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { consumption(resolution: DAILY, last: 30) { nodes { consumption cost unitPrice unitPriceVAT from to } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].consumption"
  json_attributes:
    - nodes
  value_template: "{{ value_json.data.viewer.homes[0].consumption.nodes[0].consumption | float }}"
  scan_interval: 300
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
  unit_of_measurement: kWh
  state_class: total

# Tibber Hourly Cost Sensor
- platform: rest
  unique_id: tibber_hourly_cost
  name: Tibber Hourly Cost
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { consumption(resolution: HOURLY, last: 24) { nodes { consumption cost unitPrice unitPriceVAT from to } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].consumption"
  json_attributes:
    - nodes
  value_template: "{{ value_json.data.viewer.homes[0].consumption.nodes[0].cost | float }}"
  scan_interval: 300
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
  unit_of_measurement: EUR
  state_class: total

# Tibber Hourly Cost Sensor
- platform: rest
  unique_id: tibber_hourly_consumption
  name: Tibber Hourly Consumption
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { consumption(resolution: HOURLY, last: 24) { nodes { consumption cost unitPrice unitPriceVAT from to } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].consumption"
  json_attributes:
    - nodes
  value_template: "{{ value_json.data.viewer.homes[0].consumption.nodes[0].consumption | float }}"
  scan_interval: 300
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
  unit_of_measurement: kWh
  state_class: total

# Tibber Preislevel
- platform: rest
  unique_id: tibber_price_level
  name: Tibber Price Level
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { currentSubscription { status priceInfo { current { level } today { level } tomorrow { level } } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].currentSubscription.priceInfo"
  json_attributes:
    - today
    - tomorrow
  value_template: "{{ value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.level }}"
  scan_interval: 30
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
    User-Agent: REST

# Tibber Preislevel
- platform: rest
  unique_id: tibber_price_level_german
  name: Tibber Price Level Deutsch
  resource: https://api.tibber.com/v1-beta/gql
  method: POST
  payload: '{ "query": "{ viewer { homes { currentSubscription { status priceInfo { current { level } today { level } tomorrow { level } } } } } }" }'
  json_attributes_path: "$.data.viewer.homes[0].currentSubscription.priceInfo"
  json_attributes:
    - today
    - tomorrow
  value_template: >
    {% if value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.level == "NORMAL" %}
      normal
    {% elif value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.level == "CHEAP" %}
      günstig
    {% elif value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.level == "VERY_CHEAP" %}
      sehr günstig  
    {% elif value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.level == "EXPENSIVE" %}
      teuer
    {% elif value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.level == "VERY_EXPENSIVE" %}
      sehr teuer
    {% endif %}  
  scan_interval: 30
  headers:
    Authorization: !secret tibber_token
    Content-Type: application/json
    User-Agent: REST
3 Likes

Thx, do you know if the values for sensor.tibber_prices need 24h values, before it shows the graph?

Answer:

You have not only to reload config but restart complete HA otherwise the recorder did not record.

OK thanks
But why aren’t the values ​​for the 24 hours shown?

pls post your config for hourly cost and hourly consumption!

They come from the normal Sensor and the Home Assistent history

Could you post your entity status, like:


Are both entity’s in recorder allowed (only if you have configured the recorder)?

what do you mean?
Now it seems to be working.



How long do you have tibber? do you have a monthly bill already?