Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ******* Nordpool templare för HA price timline card: https://github.com/Neisi/ha-price-timeline-card *********
- - trigger:
- - platform: time_pattern
- minutes: "/10"
- - platform: homeassistant
- event: start
- action:
- - action: nordpool.get_prices_for_date
- data:
- config_entry: 01K6BFF0TVKT3M3RDYTQWVM38D #BYT TILL DIN EGEN NORDPOOLS ID
- date: "{{ now().date() }}"
- areas: SE3
- currency: SEK
- response_variable: today_price
- - action: nordpool.get_prices_for_date
- data:
- config_entry: 01K6BFF0TVKT3M3RDYTQWVM38D #BYT TILL DIN EGEN NORDPOOLS ID
- date: "{{ now().date() + timedelta(days=1) }}"
- areas: SE3
- currency: SEK
- response_variable: tomorrow_price
- sensor:
- - name: Combined Nordpool Prices
- unique_id: combined_nordpool_prices
- state: "{{ now().isoformat() }}"
- attributes:
- data: >
- {% set all = namespace(prices=[]) %}
- {% if today_price and today_price['SE3'] is defined %}
- {% for item in today_price['SE3'] %}
- {% set all.prices = all.prices + [{
- 'start_time': (item.start | as_datetime | as_local).isoformat(),
- 'end_time': (item.end | as_datetime | as_local).isoformat(),
- 'price_per_kwh': item.price / 1000
- }] %}
- {% endfor %}
- {% endif %}
- {% if tomorrow_price and tomorrow_price['SE3'] is defined %}
- {% for item in tomorrow_price['SE3'] %}
- {% set all.prices = all.prices + [{
- 'start_time': (item.start | as_datetime | as_local).isoformat(),
- 'end_time': (item.end | as_datetime | as_local).isoformat(),
- 'price_per_kwh': item.price / 1000
- }] %}
- {% endfor %}
- {% endif %}
- {{ all.prices | sort(attribute='start_time') }}
Advertisement
Add Comment
Please, Sign In to add comment