Comments (5)
Ja mám v plánu pár vylepšení, ale nemám na to čas
Snad v příštím týdnu.
Na některé věci jde udělat šablonu. Na něco bude potřeba změna kódu.
from homeassistant_cz_energy_spot_prices.
Ano, chápete to správně. Není ale těžké vyrobit senzor který najde blok X nejlevnějších hodin.
Řeším pro sebe výpočet se zapojením distribučních cen a HDO času. To bude trochu složitější. Pokud z toho něco bude pošlu sem výsledek.
from homeassistant_cz_energy_spot_prices.
Me to furt nejak nedochazi:( Muzu poprosit o vetsi nakopnuti, jak najit napr. 5 nejlevnejsich hodin v intervalu 0:00 - 12:00?
Diky moc
from homeassistant_cz_energy_spot_prices.
Tohle jsem řešil nedávno, zde je verze pro 2 nejlevnější hodiny v intervalu.
Mělo by to jít snadno upravit pro libovolný počet hodin úpravou této podmínky {% if min.min_hours|length < 2 %}
- sensor:
- name: "two cheapest hours in interval"
unique_id: two_cheapest_hours_in_interval
state: >
{# Define your intervals here as tuples (hour starting the interval, hour ending the interval (excluded)) #}
{% set intervals = [
(0, 8),
(8, 18),
(18, 24),
] %}
{# We need to use namespace so we can write into it in the inner cycle #}
{% set min = namespace(min_hours=[], dt=None, cheapest_hours=[]) %}
{% set cheapest_hours = [] %}
{% set min_hours = [] %}
{% for interval in intervals %}
{# Initialize a list to store the two cheapest hours for the current interval #}
{% set min.min_hours = [] %}
{# Go through all the hours in the interval (end excluded) and find the two hours with the lowest prices #}
{% for i in range(interval[0], interval[1]) %}
{# Get datetime of the current hour in the current interval #}
{% set hour_dt = now().replace(hour=i, minute=0, second=0, microsecond=0) %}
{# Get value for that hour #}
{% set value = states.sensor.current_spot_electricity_hour_order.attributes.get(hour_dt.isoformat()) %}
{# Skip if not found #}
{% if value is not defined %}
{% break %}
{% endif %}
{# value is tuple (order, price), we'll use the price #}
{% set price = value[1] %}
{# Add the hour to the list of two cheapest hours if it has a lower price #}
{% if min.min_hours|length < 2 %}
{% set min.min_hours = min.min_hours + [(hour_dt.hour, price)] %}
{% else %}
{% set min.min_hours = min.min_hours|sort(attribute=1) %}
{% if price < min.min_hours[1][1] %}
{% set min.min_hours = min.min_hours[:1] + [(hour_dt.hour, price)] %}
{% endif %}
{% endif %}
{% endfor %}
{# Store two cheapest hours in the overall list #}
{% set min.cheapest_hours = min.cheapest_hours + min.min_hours %}
{% endfor %}
{{ now().hour in min.cheapest_hours | map(attribute=0) }}
from homeassistant_cz_energy_spot_prices.
@rnovacek je tu už několik vytvořených issue na téma hledání jedné nebo více hodin v nějakém intervalu. Na kratší intervaly, které nejdou přes půlnoc se dá většinou použít ta vzorová šablona pro jednu hodinu, případně pro víc hodin v komentáři nahoře.
Bohužel to má nevýhodu v tom, že to nejde používat moc dynamicky (např, v automatizaci, kde si spočítám kolik hodin mi bude trvat nabití auta, nebo nahřátí bojleru a hledám nejlevnější tak velký interval) a také to nejde používat přes půlnoc, kdy definice intervalu nefunguje.
Nešlo by vygenerovat něco jako current_spot_electricity_hour_order
pro daný interval (typicky noc)?
from homeassistant_cz_energy_spot_prices.
Related Issues (20)
- entities dont show on/off values when creating automation HOT 6
- Aktuální cena není aktuální po update na 2023.9 HOT 13
- template sensor "Find cheapest hours in selected interval" HOT 3
- Median value HOT 3
- Item has no "Price" child or is empty
- Electricity Is Cheapest Looking X Hours Forward HOT 6
- device_class: monetary HOT 12
- Current Spot Electricity Hour not matching the hour of the day HOT 4
- Timeout fetching prices HOT 1
- Error requesting CZE spot prices HOT 3
- Config flow could not be loaded: {"message":"Invalid handler specified"} HOT 1
- Tamplate sensor spravný zápis do config. Vyřešeno
- Dvoutarifní sazba D25d - řešení ceny HOT 5
- Cheapest X hours blocks - strange behavior HOT 5
- Prices shifted by one hour HOT 5
- incorrect electricity prices HOT 3
- Vzorové řešení reálných nákupních cen u dvoutarifních sazeb HOT 5
- Zaokrouhleni ceny HOT 4
- Spatne zobrazeni cen (+1 hodina) HOT 3
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 homeassistant_cz_energy_spot_prices.