Comments (10)
Yeah. All you need just a sensor that has a holiday attribut. The example i provided has dict of all holydays so you can format the datetime to a str and use a .get and check if the value is not None.
from nordpool.
The easiest way i can think is to check if utcnow and now is the same date. The integration patches now so it always in the context of the current hour. So if the day isnt the same its tomorrow.
from nordpool.
Does that mean that the additional cost template is evaluated per hour and takes date into account?
If that is the case I suppose my template should work as intended?
from nordpool.
Ah, no, it does not work.
To summarise… We receive prices for tomorrow at 13:00 here. This means that we need a way to check if tomorrow is a workday, which I currently am unable to see how is done. The workday status defines the level of taxes on electricity, so it is crucial to get a correct reading of the next day price level.
from nordpool.
Or does now()
always relate to the hour being evaluated? If that is the case, could it work to compare as_timestamp(now()) | timestamp_custom("%F")
against a list of known holidays?
from nordpool.
https://github.com/custom-components/nordpool#additional-costs
Yes, its patched so it always refer to the hour for the price.
from nordpool.
Instead if a static list of holydays you can use https://github.com/partofthething/next-holiday-sensor
from nordpool.
Oh, the list is not static, it is dynamically provided by the Holidays integration (https://github.com/bruxy70/Holidays). It seems it does much of the same as the one you suggest?
from nordpool.
Please post your solution so other can reuse it if they face the same issue.
from nordpool.
Sure! :-)
Within a "it works on my machine" scope, here is my template:
{# January to March - Weekend and holiday taxes #}
{% if (as_timestamp(now()) | timestamp_custom("%F")) in (state_attr('calendar.holidays','holidays') | list) and (now().month >= 1 and now().month <= 3) %}
{% set el_taxes = 0.3558 %}
{# April to December - Weekend and holiday taxes #}
{% elif (as_timestamp(now()) | timestamp_custom("%F")) in (state_attr('calendar.holidays','holidays') | list) and (now().month >= 4) %}
{% set el_taxes = 0.4393 %}
{# January to March - Dyatime taxes #}
{% elif (now().month >= 1 and now().month <= 3) and (now().hour >= 6 and now().hour <= 22) %}
{% set el_taxes = 0.4738 %}
{# January to March - Night taxes #}
{% elif (now().month >= 1 and now().month <= 3) and (now().hour >= 23 or now().hour <= 5) %}
{% set el_taxes = 0.3558 %}
{# April to December - Day taxes #}
{% elif (now().month >= 4) and (now().hour >= 6 and now().hour <= 22) %}
{% set el_taxes = 0.5573 %}
{# April to December - Night taxes #}
{% elif (now().month >= 4) and (now().hour >= 23 or now().hour <= 5) %}
{% set el_taxes = 0.4393 %}
{% endif %}
{% if current_price > 0.875 %}
{% set subs = (current_price - 0.875) * 0.9 %}
{% set additional_cost = el_taxes - subs %}
{% elif current_price <= 0.875 %}
{% set additional_cost = el_taxes %}
{% endif %}
{{ additional_cost | round(4) }}
I've also posted it in the HA community forums (HA Foums) and at Hjemmeautomasjon.no (Hjemmeautomasjon)
from nordpool.
Related Issues (20)
- LICENSE?
- New release HOT 4
- Strange negative character HOT 2
- Finnish prices went to EUR after HA update HOT 1
- Stopped working HOT 18
- Add `get_energy_prices` service call
- Q: Additional Cost based on date HOT 3
- VAT configuration seems to not working HOT 4
- A reliable way of triggering automations only when Nordpool price period changes HOT 9
- 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.
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.