TheBrain8791 / ha_awattar

Adds Awattar energy cost data to Home Assistant.
Other
11 stars 1 forks source link

Show Forecast Data in Grafana #4

Open CaptainXRay opened 1 year ago

CaptainXRay commented 1 year ago

Hey, Thanks for the easy to use integration!

Is it somehow possible to use the daily provided forecast dataset, that is given in the state attrebute 'data' and feed it in InfluxDb or show it in Grafana?

Second question: aWATTar also has a monthley changing price for their "sunny" tariff. is it possible to get the data from the api too?

regards Norbert

mf76130 commented 1 year ago

Hi, I started looking into it and found a post about calculating average value of a forecast (https://community.home-assistant.io/t/calculating-average-from-a-forecast/518023) and started playing with it.

This calculates the average of the actual attributes, now its just to write each data to a template and then maybe add things like the deviation from the minimum etc

`{% set ns = namespace(sum = 0, count = 0) %}

{% for item in state_attr('sensor.awattar_at_price', 'data') -%} {% if as_datetime(item.start_time).date() == now().date() %} {% set ns.sum = ns.sum + item.price_ct_per_kwh %} {% set ns.count = ns.count + 1 %} {% endif %} {%- endfor %}

{{ ns.count }} {{ ns.sum }} {{ ns.sum/ns.count }}`

mf76130 commented 1 year ago

thats the template for the average cost, highest and lowest price

mf76130 commented 1 year ago

Found a post on home assistant community: https://community.home-assistant.io/t/epex-spot-and-awattar-electricity-prices/519151/4

That Apex card can do it all