There are some issues with Nordpool, causing the next day not to be visible once in a while (restarting HA will get the correct prices but that is only a work around). This has nothing to do the the apexcards. I updated the apexcards because there was a new release, no other reason.
Nevermind, it seems there was probably some error in 2022.5, that they fixed in 2202.5.1, all is working again.
After updating to the latest May release Nordpool integration fails here.
Setup failed for custom integration nordpool: Unable to import component: cannot import name āEVENT_TIME_CHANGEDā from āhomeassistant.constā (/usr/src/homeassistant/homeassistant/const.py)
# The price result of the additional_costs template expects this additional cost to be in kWh and not cents as a float
Can someone please clarify, what this sentence means?
āā¦additional costs to be in kWhā means in other words that the units of currency and energy are the same (ācurrency = kWhā), which of course cannot be.
āā¦and not cents as a floatā ???
Basically I need to to know, whether additionals costs are per kWhs or are they per hour type of things? The senttence above probably takes some position in that, but I donāt undestand the sentence at all.
I also need to insert both kWh -based and hour -based fixed costs, so how is this done?
nordpool integration has some nasty bug - it cannot do properly dynamic delivery cost calculation for future use. It will add only currently active price.
Thus I made external proper calculation:
input_number:
sadales_tikls_day:
name: "Sadales tīkls dienas tarifs (Eur/kWh)"
initial: 0.051
min: 0
max: 10.00
step: 0.001
mode: box
sadales_tikls_night:
name: "Sadales tīkls brivdienu un nakts tarifs (Eur/kWh)"
initial: 0.027
min: 0
max: 10.00
step: 0.001
mode: box
- platform: template
sensors:
electricity_price:
friendly_name: "Nordpool + Sadales TÄ«kls"
icon_template: mdi:currency-eur
unit_of_measurement: "EUR/kWh"
value_template: '{% if now().weekday() < 5 and ("07" | int <= now().hour | int < "23" | int) %}{{state_attr("sensor.nordpool_kwh_lv_eur_4_08_0", "current_price") + states("input_number.sadales_tikls_day")|float }}{% else %}{{state_attr("sensor.nordpool_kwh_lv_eur_4_08_0", "current_price") + states("input_number.sadales_tikls_night")|float }}{% endif %}'
attribute_templates:
today: >
{%- set y = states.sensor.nordpool_kwh_lv_eur_4_08_0.attributes.today -%}
{%- set ns = namespace (z=[]) -%}
{%- for i in states.sensor.nordpool_kwh_lv_eur_4_08_0.attributes.today -%}
{%- if loop.index0 >= 7 and loop.index0 < 23 and now().weekday() < 5 -%}
{%- set ns.z = ns.z + [(y[loop.index0]|float+ states('input_number.sadales_tikls_day')|float)|round(4)] -%}
{%- else -%}
{%- set ns.z = ns.z + [(y[loop.index0]|float+ states('input_number.sadales_tikls_night')|float)|round(4)] -%}
{%- endif -%}
{%- endfor -%}
{{ ns.z }}
electricity_price_today_low_1h:
friendly_name: "Lowest 1h price today"
value_template: >
{%- set sorted_prices = state_attr('sensor.electricity_price','today')|sort %}
{{ states('sensor.electricity_price')|float <= sorted_prices[0]|float }}
electricity_price_today_low_2h:
friendly_name: "Lowest 2h price today"
value_template: >
{%- set sorted_prices = state_attr('sensor.electricity_price','today')|sort %}
{{ states('sensor.electricity_price')|float <= sorted_prices[1]|float }}
electricity_price_today_low_3h:
friendly_name: "Lowest 3h price today"
value_template: >
{%- set sorted_prices = state_attr('sensor.electricity_price','today')|sort %}
{{ states('sensor.electricity_price')|float <= sorted_prices[2]|float }}
.......
Then it is a matter to craft and automation based on those lowest x hour True or False status.
Okā¦ Brand new home assistant user here. With the current energy prices I realized I had to do something about the energy consumption scheduling in my house (I have some humidity control equpiment in the basement which use a LOT of powerā¦), and found home assistant. Im not yet very familiar with stuff you veterans think is obvious, so hope I donāt ask too silly questions
Iāve setup a home assistant and installed HACS, then I installed the nordpool integration. Then I installed a sensor (nordpool_kwh_se4_sek_3_10_025) and now I think Iām good to go to actually start to use it (?).
My goal is to know the X number of cheapest hours today/tomorrow, and only allow the equpiment to run those cheap hours. I donāt yet know X, since that depends on the humidity in the basement (which I also already monitor via home assistant actually).
My next step is to create aā¦ what? (Where I can do some calculation and output if the current hour is among the cheapest known)
I havenāt yet understood the work flow for these things, so if someone is kind enough to just describe the overall concept what the steps are it would help a lot
In the end I conceptually think I want multiple inputs for the basement equipment, like ācurrent price is okā (itās amont the lowest X), āhumidity is not okā (overrides price check so it runs anyway) and so on.
Hi Daffy951
Controling based on Nordpool price can be hard based on the need.
Say example that you are expecting to have car fully charged in the morning and that takes say 3 houres. Then you know that you need to find the 3 lowest houres.
If doing the same for say a heating system or in youre case humidity there will be more varibels. Maby some critical upper limmit that the equipment should run no mater the cost. Say that its raining outside you might need to run the controller 8h that day, and some othere days just 1 houre.
If you like to start with somthing less complicated you should be able to use the attribute āaverageā to compare the current price with the average. Supplie energy if current is lower then average.
This would give that the controller atlest have power during several of houres a day and avoiding the most expensive houres.
I know that this is not really what you asked about. You might be able to build what you are asking about, however I think you need to do logic to first find out how many houres a day that the equipent needs to run and what varibles is effect that amount of houres from day to day.
To do above you need to look into allot of template and logic (Templating - Home Assistant), you can test this out in under ādevelopment toolsā ā ātemplateā
I have a similar need for which I created a template sensor for. I want to run my pool pump on the cheap hours, and I want it to run for 12 hrs a day with no longer pauses that 10 hrs.
For this I created a template sensor which state contains the median, and have a few attributes that can be used for automations: tomorrow, tomorrow_valid, below_median_now, unit_of_measurement: friendly_name
This sensor I use in my automations to turn on/off the pool pump. I use a āprotectionā automation that ensures that the pump are not off for too long, simply by checking āfor 10 hoursā
You can likely build upon this sensor for your needs:
I have made an attempt to control my pool heating to use the cheapest hours. Based on the weather forecast and old heating data, i made a forecast how much heating needed to keep the pool temperature on the desired level. Then I used the Nordpol price info for the next day to figure out exactly which hours to heat my pool.
This system worked quite well. However, I couldnāt see any real advantage compared to a much simpler algorithm where I just avoid to heat during expensive hours. This control system is a implemented as a Phyton script. I plan to implement this in Home Assistant as well and I will definitely go for the simple solution. I have already implemented this algorithm to control floor heating in my house, so I will just extend this to include the pool heating as well.
I started to very complicated algorithms but eventually i ended up using 36h price if tomorrows prices are released.
Because nordpool sensor sometimes gives tomorrow valid due timezone differnece im checking if tomorrow 5th price is validā¦
36h
if todays prices are cheaper then tomorrows, il using more today, and when tomorrow is cheaper, then stop using today
It would be nice to have an average, min and max for today, tomorrow and total (today and tomorrow if it is available).
I would think it is not too difficult to implement in the integration.
Or are there good reasons why not to do this?
Hi Marcus. This seems to fit my needs exactly. Can you please show me the protection automation as well?
Iām a newbie and struggling to find out how to do things
I just tried your template above and it works like a charm
//Magnus
Guys, been reading through this thread - what you do with templating are amazing!
I could need some assistance.
Iāve made 4 sensors based on utility_meter for energy used last hour, so far today, so far this week and so far this month.
Now I would like to create 4 new sonsors telling me the total cost based on my Nordpool tariff for the same; total cost spent last hour, so far today, so far this week and so far this month.
Thank you very much for sharing! This works perfectly as well.
I hope you can help me some moreā¦
My next question is, how do you deal with starting/stopping in your automation based on the values mentioned earlier, nordpool_e04_median etc. I do not really understand what you mean with this and where (configuration.yaml?) you enter it
{% set HRS_ON = 11 %}
{% set M1 = HRS_ON - 1 %}
{% set M2 = M1+1 %}
{{average((state_attr('sensor.nordpool_kwh_se4_sek_3_095_025', 'today') | sort())[M1],
(state_attr('sensor.nordpool_kwh_se4_sek_3_095_025', 'today') | sort())[M2]) |
round(3)