Hallo Guys
i have be trying to put this in my configuration but with out luck, anyone there can help me?
right now i have 24 sensors to do this, so i did try this to shorten it down a bit
- platform: template
sensors:
{% for hour in range(24) %}
energy_price_{{ '%02d' | format(hour) }}_{{ '%02d' | format((hour + 1) % 24) }}:
friendly_name: 'Energy Price {{ "%02d" | format(hour) }}-{{ "%02d" | format((hour + 1) % 24) }}'
value_template: >
{% set raw_today = state_attr('sensor.energy_inkl_moms', 'raw_today') %}
{% if raw_today is defined and raw_today | length > hour %}
{{ raw_today[hour]['price'] }}
{% endif %}
unit_of_measurement: kWh
{% endfor %}