Moin ich beziehe mich auf diesen sensor
- name: Electricity price tibber
unit_of_measurement: "EUR/kWh"
icon: mdi:currency-eur
state: >-
{{state_attr('sensor.tibber_preisabruf', 'current')['total']}}
attributes:
jetzt: >-
{{state_attr('sensor.tibber_preisabruf', 'current')['total']}}
current: >-
{% if state_attr('sensor.tibber_preisabruf', 'current') %}
{{ state_attr('sensor.tibber_preisabruf', 'current') }}
{% else %}
[ ]
{% endif %}
today: >-
{% if state_attr('sensor.tibber_preisabruf', 'today') %}
{{ state_attr('sensor.tibber_preisabruf', 'today') }}
{% else %}
[ ]
{% endif %}
tomorrow: >-
{% if state_attr('sensor.tibber_preisabruf', 'tomorrow') %}
{{ state_attr('sensor.tibber_preisabruf', 'tomorrow') }}
{% else %}
[ ]
{% endif %}
all_prices: " {{ this.attributes.today | default(0) + this.attributes.tomorrow | default([]) }} "
min_price: >-
{% if this.attributes.today | default('unknown') in ['unknown','unavailable','none'] or (this.attributes.today | default([]) | map(attribute='total') | list | count) < 1 %}
unknown
{% else %}
{{ this.attributes.today | default([0]) | map(attribute='total') | list | min | float(0) | round(4) }}
{% endif %}
max_price: >-
{% if this.attributes.today | default('unknown') in ['unknown','unavailable','none'] or (this.attributes.today | default([]) | map(attribute='total') | list | count) < 1 %}
unknown
{% else %}
{{ this.attributes.today | default([0]) | map(attribute='total') | list | max | float(0) | round(4) }}
{% endif %}
avg_price: >-
{% if this.attributes.today | default('unknown') in ['unknown','unavailable','none'] or (this.attributes.today | default([]) | map(attribute='total') | list | count) < 1 %}
unknown
{% elif (this.attributes.today | default([]) | map(attribute='total') | list | count) < 2 %}
{{ this.attributes.today | default([0]) | map(attribute='total') | list | max | float(0) | round(4) }}
{% else %}
{{ this.attributes.today | default([0]) | map(attribute='total') | list | average(0) | float(0) | round(4) }}
{% endif %}
price_level: >-
{% if (this.attributes.current | default('unknown')) in ['unknown','unavailable','none'] %}
unknown
{% else %}
{{ this.attributes.current.level | default('unknown') | replace('_', ' ') | capitalize }}
{% endif %}
price_level_1d: >-
{% set price_cur = this.state | default(0) | float(0) %}
{% set price_avg = this.attributes.avg_price | default(0) | float(0) %}
{% if price_cur == 0 or price_avg == 0 %}
unknown
{% else %}
{% set price_ratio = (price_cur / price_avg) %}
{% if price_ratio >= 1.4 %}
sehr teuer
{% elif price_ratio >= 1.15 %}
teuer
{% elif price_ratio <= 0.6 %}
sehr günstig
{% elif price_ratio <= 0.9 %}
günstig
{% else %}
Normal
{% endif %}
{% endif %}
price_level_combined: >-
{% set level1 = this.attributes.price_level_1d | default('unknown') %}
{% set level3 = this.attributes.price_level | default('unknown') %}
{% if level1 == level3 %}
{{ level1 }}
{% elif level1 in ['unknown','unavailable','none'] or level3 in ['unknown','unavailable','none'] %}
unknown
{% elif level1 == "Very cheap" %}
{{ level3 }}
{% elif level3 == "Very cheap" %}
{{ level1 }}
{% elif level1 == "Cheap" %}
{{ level3 }}
{% elif level3 == "Cheap" %}
{{ level1 }}
{% elif level1 == "Normal" %}
{{ level3 }}
{% elif level3 == "Normal" %}
{{ level1 }}
{% elif level1 == "Expensive" %}
{{ level3 }}
{% else %}
{{ level1 }}
{% endif %}
is_below_average: >-
{% if is_number(this.state) and is_number(this.attributes.avg_price) %}
{{ (this.state | float(0) < this.attributes.avg_price | float(0)) | lower }}
{% else %}
unknown
{% endif %}
is_above_average: >-
{% if is_number(this.state) and is_number(this.attributes.avg_price) %}
{{ (this.state | float(0) > this.attributes.avg_price | float(0)) | lower}}
{% else %}
unknown
{% endif %}
is_at_min: >-
{% if is_number(this.state) and is_number(this.attributes.min_price) %}
{{ (this.state | float(0) <= this.attributes.min_price | float(0)) | lower }}
{% else %}
unknown
{% endif %}
is_at_max: >-
{% if is_number(this.state) and is_number(this.attributes.max_price) %}
{{ (this.state | float(0) >= this.attributes.max_price | float(0)) | lower }}
{% else %}
unknown
{% endif %}
is_close_to_min: >-
{% if is_number(this.state) and is_number(this.attributes.min_price) %}
{{ (this.state | float(0) <= (1.15 * this.attributes.min_price | float(0))) | lower }}
{% else %}
unknown
{% endif %}
future_prices: >-
{% if (this.attributes.all_prices | default('unknown')) in ['unknown','unavailable','none'] %}
unknown
{% else %}
{{ (this.attributes.all_prices | default([])) | selectattr('startsAt', 'gt', (now() - timedelta(hours=1)) | string | replace(' ','T')) | list }}
{% endif %}
future_prices_totals: >-
{% if (this.attributes.future_prices | default('unknown')) in ['unknown','unavailable','none'] %}
unknown
{% else %}
{{ (this.attributes.future_prices | default([])) | map(attribute='total') | list }}
{% endif %}
future_prices_min: |-
{% if this.attributes.future_prices_totals | default([0]) | count > 0 %}
{{ this.attributes.future_prices_totals | default([0]) | min | float(0) | round(4)}}
{% else %}
unknown
{% endif %}
future_prices_max: |-
{% if this.attributes.future_prices_totals | default([0]) | count > 0 %}
{{ (this.attributes.future_prices_totals | default([0])) | max | float(0) | round(4) }}
{% else %}
unknown
{% endif %}
future_prices_avg: >-
{% if this.attributes.future_prices_totals | default([0]) | count > 0 %}
{{ (this.attributes.future_prices_totals | default([0])) | average(0) | float(0) | round(4) }}
{% else %}
unknown
{% endif %}
future_prices_curr_price_level: >-
{% set price_cur = this.state | default(0) | float(0) %}
{% set price_avg = this.attributes.future_prices_avg | default(0) | float(0) %}
{% if price_cur == 0 or price_avg == 0 %}
unknown
{% else %}
{% set price_ratio = (price_cur / price_avg) %}
{% if price_ratio >= 1.4 %}
Sehr teuer
{% elif price_ratio >= 1.15 %}
teuer
{% elif price_ratio <= 0.6 %}
sehr billig
{% elif price_ratio <= 0.9 %}
billig
{% else %}
Normal
{% endif %}
{% endif %}
future_prices_16h: >-
{% if (this.attributes.future_prices | default('unknown')) in ['unknown','unavailable','none'] %}
unknown
{% else %}
{{ (this.attributes.future_prices | default([]) | list)[1:17]}}
{% endif %}
future_prices_16h_totals: >-
{% if (this.attributes.future_prices_16h | default('unknown')) in ['unknown','unavailable','none'] %}
unknown
{% else %}
{{ (this.attributes.future_prices_16h | default([])) | map(attribute='total') | list }}
{% endif %}
future_prices_16h_min: |-
{% if this.attributes.future_prices_16h_totals | default([0]) | count > 0 %}
{{ (this.attributes.future_prices_16h_totals | default([0])) | min | float(0) | round(4) }}
{% else %}
unknown
{% endif %}
future_prices_16h_min_time: |-
{% if this.attributes.future_prices_16h_totals | default([0]) | count > 0 %}
{% set l=this.attributes.future_prices_16h|sort(attribute='total') %}
{{as_datetime(l[0].startsAt)}}
{% else %}
unknown
{% endif %}
future_prices_16h_max: |-
{% if this.attributes.future_prices_16h_totals | default([0]) | count > 0 %}
{{ (this.attributes.future_prices_16h_totals | default([0])) | max | float(0) | round(4) }}
{% else %}
unknown
{% endif %}
future_prices_16h_avg: >-
{% if this.attributes.future_prices_16h_totals | default([0]) | count > 0 %}
{{ (this.attributes.future_prices_16h_totals | default([0])) | average(0) | float(0) | round(4) }}
{% else %}
unknown
{% endif %}
future_prices_16h_current_price_level: >-
{% set price_cur = this.state | default(0) | float(0) %}
{% set price_avg = this.attributes.future_prices_16h_avg | default(0) | float(0) %}
{% if price_cur == 0 or price_avg == 0 %}
unknown
{% else %}
{% set price_ratio = (price_cur / price_avg) %}
{% if price_ratio >= 1.4 %}
sehr teuer
{% elif price_ratio >= 1.15 %}
teuer
{% elif price_ratio <= 0.6 %}
sehr billig
{% elif price_ratio <= 0.9 %}
billig
{% else %}
Normal
{% endif %}
{% endif %}
future_prices_16h_current_price_is_close_to_min: >-
{% if is_number(this.state) and is_number(this.attributes.future_prices_16h_min) %}
{{ (this.state | float(0) <= (1.15 * this.attributes.future_prices_16h_min | default(0) | float(0))) | lower }}
{% else %}
unknown
{% endif %}
future_prices_16h_current_price_is_at_min: >-
{% if this.state | default(0) | float(0) > 0 and this.attributes.future_prices_16h_min | default(0) | float(0) > 0 %}
{{ (this.state | default(0) | float(0) <= this.attributes.future_prices_16h_min | default(0) | float(0)) | lower }}
{% else %}
unknown
{% endif %}
billig1: >-
{% set l=this.attributes.future_prices_16h |sort(attribute='total') %}
{{as_datetime(l[0].startsAt).strftime("%d.%m. %H:%M")}} / {{l[0].total}} €
billig2: >-
{% set l=this.attributes.future_prices_16h|sort(attribute='total') %}
{{as_datetime(l[1].startsAt).strftime("%d.%m. %H:%M")}} / {{l[1].total}} €
billig3: >-
{% set l=this.attributes.future_prices_16h|sort(attribute='total') %}
{{as_datetime(l[2].startsAt).strftime("%d.%m. %H:%M")}} / {{l[2].total}} €
billig4: >-
{% set l=this.attributes.future_prices_16h|sort(attribute='total') %}
{{as_datetime(l[3].startsAt).strftime("%d.%m. %H:%M")}} / {{l[3].total}} €
billigpreis1: >-
{% set l=this.attributes.future_prices_16h |sort(attribute='total') %}
{{l[0].total}}
billigpreis2: >-
{% set l=this.attributes.future_prices_16h |sort(attribute='total') %}
{{l[1].total}}
billigpreis3: >-
{% set l=this.attributes.future_prices_16h |sort(attribute='total') %}
{{l[2].total}}
billigpreis4: >-
{% set l=this.attributes.future_prices_16h |sort(attribute='total') %}
{{l[3].total}}
billigpreis5: >-
{% set l=this.attributes.future_prices_16h |sort(attribute='total') %}
{{l[4].total}}
teuer1: >-
{% set l=this.attributes.future_prices_16h|sort(attribute='total', reverse=true) %}
{{as_datetime(l[0].startsAt).strftime("%d.%m. %H:%M")}} / {{l[0].total}} €
teuer2: >-
{% set l=this.attributes.future_prices_16h|sort(attribute='total', reverse=true) %}
{{as_datetime(l[1].startsAt).strftime("%d.%m. %H:%M")}} / {{l[1].total}} €
teuer3: >-
{% set l=this.attributes.future_prices_16h|sort(attribute='total', reverse=true) %}
{{as_datetime(l[2].startsAt).strftime("%d.%m. %H:%M")}} / {{l[2].total}} €
teuer4: >-
{% set l=this.attributes.future_prices_16h|sort(attribute='total', reverse=true) %}
{{as_datetime(l[3].startsAt).strftime("%d.%m. %H:%M")}} / {{l[3].total}} €
next1: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[0].startsAt).strftime("%d.%m. %H:%M")}} / {{v[0].total}} €
next2: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[1].startsAt).strftime("%d.%m. %H:%M")}} / {{v[1].total}} €
next3: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[2].startsAt).strftime("%d.%m. %H:%M")}} / {{v[2].total}} €
next4: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[3].startsAt).strftime("%d.%m. %H:%M")}} / {{v[3].total}} €
next5: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[4].startsAt).strftime("%d.%m. %H:%M")}} / {{v[4].total}} €
next6: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[5].startsAt).strftime("%d.%m. %H:%M")}} / {{v[5].total}} €
next7: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[6].startsAt).strftime("%d.%m. %H:%M")}} / {{v[6].total}} €
next8: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[7].startsAt).strftime("%d.%m. %H:%M")}} / {{v[7].total}} €
next9: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[8].startsAt).strftime("%d.%m. %H:%M")}} / {{v[8].total}} €
next10: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[9].startsAt).strftime("%d.%m. %H:%M")}} / {{v[9].total}} €
next11: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[10].startsAt).strftime("%d.%m. %H:%M")}} / {{v[10].total}} €
next12: >-
{% set v=this.attributes.future_prices_16h %}
{{as_datetime(v[11].startsAt).strftime("%d.%m. %H:%M")}} / {{v[11].total}} €```
Die Fehlermeldung ist einfach ‚This‘ in undefiend
Sensor….preisabruf ist erstellt und funktioniert.
Attribute sind vorhanden.
Neueste Release von HA.