Thermostat - how to summarise heating time?

Im trying to find optimal heating temperature I should set when Im away.
So basically I wanted summarise time heating periods (shown in orange colour below) and see if reducing temp makes really sense. No I can judge that only visually looking on charts

I know SQL quite well.
I was looking into statistics tables but coudnt find any climate sensor nor relevant statistics.
I could only find information when I enabled or disabled thermostat using below qry.

Can someone please guide me how to archive that?


SELECT
state,
 strftime('%d-%m-%Y %H:%M', datetime(last_updated_ts, 'unixepoch'))  as last_updated_ts
FROM "states"
where entity_id = 'climate.termostat_salon'
order by 3 desc

obraz