Skip to content

Instantly share code, notes, and snippets.

@PattaFeuFeu
Created December 30, 2023 17:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PattaFeuFeu/ba1bd8ae80d0015b4e3ea85838d9576d to your computer and use it in GitHub Desktop.
Save PattaFeuFeu/ba1bd8ae80d0015b4e3ea85838d9576d to your computer and use it in GitHub Desktop.
Home Assistant Tibber Preisaussicht
sensor:
- platform: rest
name: Tibber Prices
unique_id: "tibber-prices-rest-api"
resource: https://api.tibber.com/v1-beta/gql
method: POST
payload: '{ "query": "{viewer {homes {currentSubscription {priceInfo {current {total } today {total startsAt } tomorrow {total 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: 30
headers:
Authorization: !secret tibber_token
Content-Type: application/json
User-Agent: REST
unit_of_measurement: EUR/kWh
type: custom:apexcharts-card
experimental:
color_threshold: true
all_series_config:
unit: Cent/kWh
apex_config:
grid:
show: true
borderColor: '#e7e7e7'
row:
colors:
- '#f3f3f3'
- transparent
opacity: 0.5
chart:
height: 250px
tooltip:
enabled: true
followCursor: false
x:
show: false
fixed:
enabled: true
header:
show: true
title: Strompreis
show_states: true
colorize_states: true
standard_format: false
now:
show: true
label: Jetzt
graph_span: 36h
span:
start: hour
series:
- entity: sensor.tibber_prices
show:
in_header: before_now
name_in_header: false
color_threshold:
- value: 0
color: 4DD0E1
- value: 10
color: 26A69A
- value: 15
color: 4CAF50
- value: 20
color: 7CB342
- value: 25
color: FBC02D
- value: 30
color: EF6C00
- value: 40
color: B71C1C
type: line
curve: stepline
extend_to: false
stroke_width: 3
float_precision: 2
data_generator: >
return [...entity.attributes.today,
...entity.attributes.tomorrow].map((price) => {
return [new Date(price.startsAt), price.total * 100];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment