My first thought was the statistics sensor, but this only gives you the average for the previous number of minutes, and I think you might want something more specific.
@robo and @weado, did you ever find a solution? If you haven’t and you’re willing to install a custom component, I can show you how to do it with my variable component.
- platform: sql
scan_interval: 600
queries:
- name: Mean
query: SELECT AVG (state) as state FROM states WHERE entity_id = 'sensor.temp' AND last_updated > datetime('now','start of day');
column: 'state'
unit_of_measurement: '°C'
value_template: "{{ ' %0.1f' % value }}"
If you find how can I select the record 1 day before, I take it… (I would like to have a an sensor with my record from yesterday at the same to compare the two values)