dhogborg / off-peak

Analyze energy usage
GNU Affero General Public License v3.0
46 stars 10 forks source link

Plugin for Home Assistent? #9

Open nrehn opened 2 years ago

nrehn commented 2 years ago

Hi, I would like to have this as a plugin to Home Assistent. It shall have been cool to not only running the web service as is but also have the results as sensors. BR N..

dhogborg commented 2 years ago

Not familiar with Home Assistant, but I assume such a plugin would require an api to load data from? Since the majority of offpeak.se is run entirely in your browser and doesn't load or process your personal consumption data on our servers, such an API is not possible. You could however look at how the processing is done in this app and perform the same steps in the plugin. Here's the file with the function that aggregates the costs by profile: https://github.com/dhogborg/off-peak/blob/master/src/lib/dataprep.ts

JonasLibre commented 2 years ago

I found the API to get the data to compare the spotprice to: https://ei.entryscape.net/#view=dataset&resource=https://ei.entryscape.net/store/1/resource/129 Its from the Swedish "Energimarknadsinspektionen" and their open data.

With this someone may be able to build something for HA ( an integration in HACS? ). I can get the supplier, contract, contract_name, energy area (elområde/bid_area), date and price/kWh.

But i think its above my skill level. I can get the data thrue Curl Get, and probably import in to a sensor in HA. Thats it, and the problem is i cant get the date filtered to get the latest date(month) and price.

The price is with taxes (moms) and the certificate cost, so it will be compareble with the Tibber price. I have compared it to the prices of my former energy supplier ( in this case Skellefteå Kraft AB ), and it is correct.

Conclusion: all data is avaleble if you are a Tibber customer, to compare Tibber price with another suppliers "fixed"/"monthly" price. With energy consumpltion in HA ( in example extracted from Tibbers HA integration or other sources ) a calculation could be done how much savings for a period of time a spot price contract generates.

elden1337 commented 1 year ago

Havent checked all code here yet, but if it is resolved into an api, only two additional repos would be required (which is fairly straightforward i think); one pypi as an api-facade and one project being the real ha-component. This is since components aren’t supposed to handle outside reqs themselves.

I might have a go when there’s time if noone else takes this before me.

ZyberSE commented 1 year ago

Have this data in HA would be awesome, I would be happy with something simple like a 30-day percentage or perhaps "last day", then it would be easy to see what days you did good and what days you could improve.