Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106736

Statistics integration for a sensor with max_age what is actual time window?

$
0
0

Here is the idea:

I want to collect max\min values for two temperature sensors:

  • weather forecast
  • balcony sensor

It’s better to have max\min values collected daily: 1 day or 24 hours.

The idea (click for more details)

Here is the code. It is working just fine:

# https://www.home-assistant.io/integrations/statistics/
sensor:
  - platform: statistics
    name: "Balkony t max last 24h"
    unique_id: "stats_temp_balkony_max_24h"
    entity_id: sensor.humid_4_temperature
    state_characteristic: value_max
    max_age:
      days: 1
  - platform: statistics
    name: "Balkony t min last 24h"
    unique_id: "stats_temp_balkony_min_24h"
    entity_id: sensor.humid_4_temperature
    state_characteristic: value_min
    max_age:
      days: 1
  - platform: statistics
    name: "Weather t max last 24h"
    unique_id: "stats_temp_weather_max_24h"
    entity_id: sensor.pirate_weather_temperature
    state_characteristic: value_max
    max_age:
      days: 1
  - platform: statistics
    name: "Weather t min last 24h"
    unique_id: "stats_temp_weather_min_24h"
    entity_id: sensor.pirate_weather_temperature
    state_characteristic: value_min
    max_age:
      days: 1

But there is the question:

  • when does HA count the period’s start or end: 24 hours or 1 day?

Does 24 hours mean:

  • count 24 hours from the last reboot\YAML reload?

Does 1 day mean:

  • count from 01.01.2025 00.00.00.0000 till 02.01.2025 00.00.00.0000

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 106736

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>