How to query HA long term stats using influxDB

Hi all,

I am trying to do something that should be super simple. But can’t figure out where to look !

In HA → energy dashboard, long term statistics are retained :

Today we are april 1st, but I can see how much kWh I consumed in March. That means this value is stored somewhere in HA.

my issue is I’m using InfluxDB / grafana as electrical dashboard, and I have no clue what I have to query in order to build a nice daily, weekly, monthly bar chart.

Can someone let me know where HA stores these values ?

thanks !