barisdemirdelen / homeassistant-greenchoice

This is a Home Assistant custom component that connects to the Greenchoice API
MIT License
23 stars 5 forks source link

Add an option to fetch hourly data #7

Open Borales opened 6 months ago

Borales commented 6 months ago

Not sure since when exactly, but greenchoice allows you to (explicitly) enable hourly data in the dashboard.

By default this integration fetches the daily data, but would it be possible to add an option for hourly too?

Thanks

Screenshot 2024-01-07 at 22 14 17
dedmen commented 4 months ago

Hourly data can be fetched via API https://mijn.greenchoice.nl/api/consumption?interval=hour&start=2024-03-06&end=2024-03-07 It returns hourly and total consumption. You can test it by logging in on the webinterface (to set the cookies) and just going to that URL in browser, its a simple GET request.

That is the API endpoint used by the web interface shown in above screenshot. But the python code of this integration uses a different api. Something /microbus/

Using that endpoint instead seems simple. But it would also need #8 to insert the information at the correct dates. Sadly I don't have the python experience to implement that

dedmen commented 4 months ago

I ended up implementing all of it in C# https://github.com/barisdemirdelen/homeassistant-greenchoice/issues/8#issuecomment-2002218471