Statistics Card with Midnight values

Hi all!

HA is installed on a RASPI 4.
Is there a way to only show midnight values of a sensor in a line chart dashboard card?
Or use a custom SQL, like the following, for a chart?

SELECT strftime(‘%Y-%m-%d’, created_ts, ‘unixepoch’) as Date, avg(mean) as Weight FROM “statistics” where metadata_id = 60 and strftime(‘%H’, created_ts, ‘unixepoch’) = ‘00’ group by strftime(‘%Y-%m-%d’, created_ts, ‘unixepoch’)

Many Greetings!

You probably meant a “Statistics graph card” instead of “Statistics card” if you need a “line chart”.
Try with “daily” data - they are calculated every midnight if I am not mistaken.

The daily chart shows calculated values of the whole day, not the value at midnight.

Daily readings represent a calculation based on a whole day. If you select a few days interval, you will see splined graph for midnight values.

No, it’s not displaying midnight values. No matter the settings.

You’d have to use the SQL sensor with a proper SELECT that matches your database time. That’s the only way to get a value at midnight after it’s been collected.

You can always write a template entity that gets the value at midnight, however that does not work retroactively. Meaning the data is only collected when the trigger occurs and you have to wait for the trigger to occur to get your first piece of information.

What is displayed then instead?

There is a SQL Sensor? Where do I find that?

Thanks a lot! I will try with this.