Sensor with offset date

Hello,

I’m considering building an integration for GRDF, which is a French gas provider. They only have an API which returns aggregated data with a delay.
E.g.: Today, I can only read my gas energy consumption from 2 or 3 days ago.

I’d like to push this information to the Energy API in Home Assistant. Every day, I would pull the most recent data I can get from their API and add it to the measurements.

Does anybody have suggestions on how to implement this in an integration? I was thinking about a sensor but from what I can tell, it doesn’t seem possible to set the date of the last sensor update and this would offset all measurements in HA (my gas consumption from 3 days ago would be considered today by HA). Am I correct? Is there another way to push data to the Energy dashboard?

From what I have seen/read, it would require direct database update. The challenge will be to have both short_term and stats aligned. I am not sure if SQL integration allows to write, I know Nodered does but that just makes it even more complex as integration/

I am looking for a similar thing related to the EDF (MyED) integration which only gives yesterday but have not had the time to look at it as low prio (using linky).
I will follow your French thread as well :slight_smile:

EDIT: SQL won’t ‘insert’ with my mariadb recorder… looking at some other threads they use shell command (with mysql client installed) or python scripts, example…

How do I call an Insert SQL command to MariaDB addon? - Installation / Home Assistant OS - Home Assistant Community (home-assistant.io)