Comments (9)
I use pyscript custom component. I have a numeric sensor which controls amount of hours I want to heat the house. The triggered function runs every 10 minutes. It calculates lowest x prices and checks if current hour is included in this lowest x prices array. Depending on that it turns on/off climate sensor that controls if heating should be turned on or off.
from nordpool.
Just use the state change.
The integration uses self._attr_force_update = True
meaning if will force a state change regardless if the value is identical
from nordpool.
Thanks for clarifying that the integration updates its status even when the value is identical. This is very great!
However, there is still an issue that the integration state changes for other reasons as well. I need only trigger for price period changes and I have no way of filtering these other state changes away.
In the attached picture the price is right at midnight. The switch is turned on and the price is removed from the "right prices list". Then the switch is turned immediately off again at midnight, because there is another state change and trigger and the price is not anymore in the "right price list" because it is assumed to be used.
My guess would be that the other state change is related to housekeeping where tomorrow data is copied to today and other stuff.
Another case is when new tomorrow data becomes available. The integration creates a state change trigger which is not related to price period change.
from nordpool.
I use pyscript custom component. I have a numeric sensor which controls amount of hours I want to heat the house. The triggered function runs every 10 minutes. It calculates lowest x prices and checks if current hour is included in this lowest x prices array. Depending on that it turns on/off climate sensor that controls if heating should be turned on or off.
This works almost all times. There are edge cases, though. If heating is wanted for 2 cheapest hours and the price array is like [10, 10,10,0], then the heater is on for all four hours with this simple approach... I intend to use this to charge EV, so practically in this scenario batttery would become full almost certainly from the first three most expensive allowed hours and the cheapest one in the end would have little use.
Not the most common scenario, sure, but it would be nice to take this situation into account as well.
from nordpool.
No, it works correctly all the time =). Otherwise, that would be a bug in algorithm.
Here is the code:
import datetime
import zoneinfo
def n_lowest(n, candidates: dict):
candidates_clean = filter(lambda x: x["value"] is not None, candidates)
return sorted(candidates_clean, key=lambda x: x["value"])[:n]
def find_price(dt, candidates):
for x in candidates:
if x["start"] <= dt < x["end"]:
return x
def filter_today(candidates):
return filter(lambda x: x["start"].day == datetime.date.today().day, candidates)
@service
def update_heating(entity_id):
current_hour = datetime.datetime.now(tz=zoneinfo.ZoneInfo(key='Europe/Tallinn'))
candidates = sensor.nordpool_kwh_ee_eur_3_095_02.raw_today + sensor.nordpool_kwh_ee_eur_3_095_02.raw_tomorrow
hours_to_heat = int(float(input_number.hours_to_heat))
today_candidates = filter_today(candidates)
cheap_hours = n_lowest(hours_to_heat, today_candidates)
should_heat = find_price(current_hour, cheap_hours) is not None
if should_heat:
climate.turn_on(entity_id=entity_id)
else:
climate.turn_off(entity_id=entity_id)
from nordpool.
I have reread your message, and you are correct. The last hour of charging consumes much less power as well.
from nordpool.
Split hours into more slots. Per 5/10 minutes. If you know exactly how long you need to charge, then you can calculate how many slots you need.
from nordpool.
Split hours into more slots. Per 5/10 minutes. If you know exactly how long you need to charge, then you can calculate how many slots you need.
I'm afraid I don't quite get what are you aiming at by "splitting hours". For me, it is quite enough to tell something "charge 2 cheapest hours"
My original problem is, that when the cheap price is marked as "used", an extra trigger from Nordpool integration in this period will stop charge as the price is marked as "used" when starting the period. This kind of situation will happen if the price is cheap at midnight or the moment when new day data is fetched.
Prices need to be marked as used. Another scenario when this would be needed is, if the prices are all the same. Like 0,0,0,0,0,0. Now the two cheapest hours are both 0. All zero prices are charged, which I propably do not wan't. This too is not quite common situation, I agree, but robust system should take this kind of situations also into account.
from nordpool.
Please reopen this. I made a test case, where I made a test template sensor which is set to trigger when nordpool changes and then log the trigger time. Last night there were two consecutive identical prices and the second one did not create trigger for my automation, so no indication that the price period had changed.
I use this as my trigger. If I remove "from: null", it also fires on housekeeping updates like when new data becomes available.
- trigger:
- platform: state
id: "interval_change"
entity_id:- sensor.nordpool_kwh_fi_eur_3_10_024
from: null
- sensor.nordpool_kwh_fi_eur_3_10_024
- platform: state
from nordpool.
Related Issues (20)
- Q: Additional Cost based on date HOT 3
- VAT configuration seems to not working HOT 4
- Negative values to additional_costs HOT 1
- Detected blocking call to open inside the event loop (HA 2024.6) HOT 26
- Not updating, exceptions logged related to new_data_cb(...), handle_new_day and more HOT 17
- Not getting values from Nordpool after latest HA-Update HOT 9
- 'nordpool' calls async_forward_entry_setup for integration HOT 1
- Detected blocking call to open inside the event loop by custom integration 'nordpool' at custom_components/nordpool/aio_price.py HOT 1
- VAT for Finland will increase from 0.24 to 0.255 starting from 1.9.2024 HOT 3
- Detected blocking call event loop again in misc.py
- Integration errors blocking system reboots HOT 3
- Detected blocking calls HOT 1
- Warning Message; To be solved before HA 2025.1 update.
- missing example APEX chart
- Detecting a blocking call HOT 2
- Nordpool takes over 10 seconds to start HOT 1
- 0.0.15b1 not showing tomorrows prices
- 0.0.15.b1 tomorrows prices gone after restart HOT 21
- async_forward_entry_setup is deprecated and will stop working in Home Assistant 2025.6 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nordpool.