Hi all
I need help to create a sensor based on the output from nordpool sensor that shows when the price comes under the average. The nordpool sensor shows the price level for each hour for the day.
i would like to show, if the time is 12.00 and the price goes under average between 14.00 to 17.00 i would like the sensor to indicate that. so it will allways shows when is the next period of time the price level is under average. this will help to plan when i need to use power. I hope someone can help me making a template for this due to it is to advanced for me.
You need something like this, substitute the XXXX part with your sensor name from nordpool.
This just prints out the times when price is right. If you need to do some calculations, automation etc, you need to tweak this as needed, but in general this is how to get the prices you want from NP sensor data into a list and go through the list items one by one and compare to some value needed.
Average price today is: {{ state_attr('sensor.nordpool_XXXX', 'average') }}
Hours today with price at or below average are at:
{% set list=state_attr('sensor.nordpool_XXXX', 'raw_today') %}
{% for i in range(24) %}
{% if (list[i-1].value <= state_attr('sensor.nordpool_kwh_ee_eur_4_095_02', 'average')) %}
{{ list[i-1].start}} - {{ list[i-1].end}}
{% endif %}
{% endfor %}
I’m pretty beginner when it comes to automation using templates in Home Assistant. I use the Nordpool sensor and have tested @KristjanA 's code with interest. Is it possible to create a trigger based on when the current power price is higher than average based on Data from Nordpool? It can then be easily changed to 3% or 5% higher if needed. I want some heating cables to change to eco-mode when this occurs. I have tried to customize your code to give me what I want but are not sure how this can be used in an automation. I need some help to get on with this.
Yes, thanks! - in the meantime I found that the trigger could be quite simple after some testing in Dev.Tools. I found your post very useful to handle the price-spikes each morning and afternoon - by dynamically turn off some floor heating for a while. Many thanks!