rnovacek / homeassistant_cz_energy_spot_prices

Home Assistant integration that provides current Czech electricity spot prices based on OTE.
Apache License 2.0
75 stars 17 forks source link

trigger: rozdíl noční/ranní ceny vyšší než 2,9 Kč #15

Closed 02curls closed 1 year ago

02curls commented 1 year ago

dobrý den, hluboce děkuji za vaši skvěle funkční, užitečnou, rodinný rozpočet šetřící integraci! Jsem lama. Základ YAMLu zvládám jen díky ChatGPT. Rozchodil jsem tak automatizaci tlumení a boostování tepelného čerpadla podle aktuální spotové ceny. A dále automatizaci povolování discharge FVE baterky ve spotově dražších hodinách. Na tohle ale zatím nemám: mořím se s automatizací, která by: když se mezi 00:01 - 5:59 hodinou ranní vyskytuje hodina s cenou (nízkou) X a když se mezi 6:01 - 8:59 hodinou ranní vyskytuje hodina s cenou o více než 2,9 Kč vyšší než cena X, tak se nabije FVE baterka ze sítě za onu nízkou cenu a v onu pozdější ranní hodinu se spotovou cenou o těch více než 2,9 Kč vyšší se začne vybíjet. Lze vubec takovou logiku nasadit do configuration.yaml + automations.yaml nebo by to žádalo nový sensor/y ve vaší integraci? díky Ivo

jen pro pobavení přikládám, jak se lama radí s ChatGPT, je tam asi problém se zamířením na atribut(y) časů/cen v sensor.current_spot_electricity_price

mé pokusné zadání ChatGPT: I need help with home assistant configuration.yaml and automations.yaml: I have a sensor with the following attributes: timestamps as keys (example: 2023-03-13T00:00:00+01:00) and prices as values (example: 1,64) I need to code a sensor, which reads the timestamps and the prices in the following time window A: 00:00 - 05:59. I need to code a sensor, which reads the timestamps and the prices in the following time window B: 06:01 - 08:59. If there is a price found in time window B which is higher by more than 2,9 than a price in time window A, then I need to create 2 following time entities: time_of_2_9lower_price_within_0000_0559 time_of_2_9higher_price_within_0601_0859

odpověď ChatGPT:

To accomplish this task, you can define two Template Sensors in your configuration.yaml file to filter the data from the sensor with timestamps and prices. Then, you can define two Automations in your automations.yaml file to check the conditions and create the two time entities if necessary. Here is an example of how you can define the Template Sensors in your configuration.yaml file:

Note that you need to replace your_sensor_name with the actual name of your sensor entity. The Template Sensors use the value_template to extract the prices in the specified time windows from the attributes of the sensor entity. They return a string with the timestamps and prices found, or a message indicating that there are no prices in the corresponding time window. Next, you can define two Automations in your automations.yaml file to check the conditions and create the time entities:

automation:

02curls commented 1 year ago

vše vyřešeno díky https://homeassistant-cz.cz/viewtopic.php?p=5823#p5823