Average temperature during the specific date interval

Yes :

  - 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)

1 Like