Api to get Energy data from "Energy dashboard"

Hello,

Is there a way to retrieve the data from the energy dashboard using an API? I’m developing a custom mobile application for a client to connect to their custom domotic system. They would like to integrate the energy dashboard directly into the application without having to open another app/browser. They already have Home Assistant installed in every house where they’ve implemented domotic systems.

I couldn’t find any information about accessing this data. Is it even possible? If it is possible with an API, I could fetch the data and create my own charts.

Thank you.
Matthieu

As far as I know you would have to interrogate the recorder database statistics table(s).

There are a few websocket api’s that I use e.g. for my container + addon
recorder/list_statistic_ids
recorder/clear_statistics
recorder/import_statistics

I was joping to have a service-call for them but no(t yet)

Have a look at hass_ws.py
gazpar_2_mqtt/app at main · vingerha/gazpar_2_mqtt (github.com)