Giter Club home page Giter Club logo

Comments (9)

Rotif avatar Rotif commented on June 2, 2024 1

Díky za okamžitou reakci.
Měl jsem dočíst popis až do konce, nicméně vyzkouším.

from homeassistant_cz_energy_spot_prices.

Rotif avatar Rotif commented on June 2, 2024 1

Dík, chodí

from homeassistant_cz_energy_spot_prices.

DavidNetron avatar DavidNetron commented on June 2, 2024

Dobrý den.
Integrace je super. Mam jednoduché zadání. Potřebuji sepnout rele integrovane v HA při nejnižší ceně . . Pokouším se o to už nějakou dobu, ale jsem začátečník. Mohl bych poprosit o nějaký jednoduchý vzor takové automatizace ? Tuším že se to nastaví skrze známky 1-24 jako atribut, ale stále mě to nechodí. Děkuji velice za odpověď

from homeassistant_cz_energy_spot_prices.

foxzqw avatar foxzqw commented on June 2, 2024

To řeší hodnota sensor.current_spot_electricity_hour_order
1 je nejlevnější atd.

Tohle by mělo fungovat:

alias: sepnout rele integrovane v HA při nejnižší ceně
trigger:
  - platform: state
    entity_id:
      - sensor.current_spot_electricity_hour_order
condition: []
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.current_spot_electricity_hour_order
        below: 2
    then:
      - type: turn_on
        entity_id: #relé, které chceš zapnout
    else:
      - type: turn_off
        entity_id: #zajistí vypnutí pokud neplatí podmínka výše
    enabled: true
mode: single

from homeassistant_cz_energy_spot_prices.

Rotif avatar Rotif commented on June 2, 2024

Dobrý den,
díky za super integraci.
Mám dotaz k automatizaci:
pro začátek bych chtěl vybíjet baterii do sítě ráno, kdy je špička většinou ve všední den v 8 nebo 9 hodin.
Dá se nějak vytvořit senzor current_spot_electricity_hour_order ale jen pro dopoledne?
Tím bych vybral nejvyšší cenu dopoledne.
Později bych využil to samé pro nabíjení a podobný senzor ale pro odpoledne.
Tím bych vybral nenižší cenu odpoledne/večer.
Děkuji moc

from homeassistant_cz_energy_spot_prices.

rnovacek avatar rnovacek commented on June 2, 2024

@Rotif Tady je příklad, jak najít nejlevnější hodinu v zadaném intervalu, to by Vám mohlo pomoct:

https://github.com/rnovacek/homeassistant_cz_energy_spot_prices#find-cheapest-hours-in-selected-interval

from homeassistant_cz_energy_spot_prices.

Rotif avatar Rotif commented on June 2, 2024

Senzory chodí bezvadně. Jde něco podobného udělat po 13:00 i pro příští den?
Dík

from homeassistant_cz_energy_spot_prices.

Rotif avatar Rotif commented on June 2, 2024

Nahradil jsem
{# Get value for that hour #}
{% set value = states.sensor.current_spot_electricity_hour_order.attributes.get(hour_dt.isoformat()) %}
tímto
{# Get value for that hour #}
{% set value = states.sensor.tomorrow_spot_electricity_hour_order.attributes.get(hour_dt.isoformat()) %}
ale nechodí mi to.
Senzor sensor.tomorrow_spot_electricity_hour_order není od 0:00 do 13:00 k dspozici a od 13:00 do 24:00 má hodnotu neznámé.

from homeassistant_cz_energy_spot_prices.

rnovacek avatar rnovacek commented on June 2, 2024

@Rotif

Takhle nějak by to asi šlo:

{# Define your intervals here as tuples (hour starting the interval, hour ending the interval (excluded)) #}
{% set intervals = [
  (0, 8),
  (8, 16),
  (16, 24),
] %}

{# We need to use namespace so we can write into it in inner cycle #}
{% set min = namespace(price=None, dt=None, cheapest_hours=[]) %}
{% set cheapest_hours = [] %}


{% for interval in intervals %}
  {# Reset min price from previous runs #}
  {% set min.price = None %}

  {# Go through all the hours in the interval (end excluded) and find the hour with lowest price #}
  {% for i in range(interval[0], interval[1]) %}
     {# Get datetime of current hour in current interval #}
     {% set hour_dt = (now() + timedelta(hours=24)).replace(hour=i, minute=0, second=0, microsecond=0) %}

     {# Get value for that hour #}
     {% set value = states.sensor.tomorrow_spot_electricity_hour_order.attributes.get(hour_dt.isoformat()) %}

     {# value is tuple (order, price), we'll use the price #}
     {% set price = value[1] %}

     {# Min price is not set or is higher than price of current hour => store the min price and hour #}
     {% if min.price is none or price < min.price %}
        {% set min.price = price %}
        {% set min.dt = hour_dt %}
     {% endif %}
  {% endfor %}

  {# Store cheapest hour in current interval #}
  {% set min.cheapest_hours = min.cheapest_hours + [min.dt.hour] %}
{% endfor %}

{# use this to get the cheapest hours #}
{{ min.cheapest_hours }}

Vypisuje to, která hodina v zadaném intervalu je nejlevnější. sensor.tomorrow_spot_electricity_hour_order má sice neznámou hodnotu, ale atributy fungují (když jsou k dispozici).

from homeassistant_cz_energy_spot_prices.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.