Add Statistics end point to the HA REST API

According to the documentation (REST API | Home Assistant Developer Docs ) an endpoint exists for the history of an entity state, but unfortunately I verified that this only pulls the data from the states table, thus limiting to the db flush period.

Can we add a api for the statistics table also so it’s possible to get long term data?

//Joacim

+1 that feature would be very useful! I was looking for it and never even expected it to be missing as it seems like a very fundamental feature to me.

@bdraco Hi, looking in the Github logs I can see that you have built parts of this API. I am currently working on a private project to calculate the ROI of solar cells. Home assistant has many integrations for different Solar Inverters like mine the Kostal brand and would be a very good source to be able to retrieve this history. I’ve tried to look at the code to see if I could do a PR myself but as I’m a Dont Net guy I feel it’s a little too difficult to solve this myself.

What I’m looking for is to be able to have the same API as
/api/history/period/
but get information from the Statistics tables in the database.

//Thanks Joachim