Hello,
I have sensor.
> electricity_production_price_30min_forecast:
> friendly_name: "Electricity production price 30min forecast"
> value_template: >-
> {% set data = state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list %}
> {% set values = namespace(all=[]) %}
> {% for i in range(now().hour+1,data | length) %}
> {% set v = ((-0.00905 + (0.001*(data[i] | float(0))*10)) | round(4)) %}
> {% set values.all = values.all + [ v ] %}
> {% endfor %}
> {% set data = state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list %}
> {% for i in range(data | length) %}
> {% set v = ((-0.00905 + (0.001*(data[i] | float(0))*10)) | round(4)) %}
> {% set values.all = values.all + [ v ] %}
> {% endfor %}
> {% set values_30min = namespace(all=[]) %}
> {% for v in values.all %}
> {% set values_30min.all = values_30min.all + [v, v] %}
> {% endfor %}
> {{ values_30min.all[:48] }}
In Development tools status i see:
sensor.electricity_consumption_price_30min_forecast
unknown
In Development tools template i see:
48 values.
How I can solve this problem?
3 posts - 3 participants