Helper config MIN/MAX

How does this work ? I want daily Min. temp , but I only get present temp

image

It might help if you tell up which helper type that is.

1 Like

The Min/Max integration consumes the state from other sensors to determine the current minimum, maximum, latest (last), mean, median, range and sum of their collected states. It doesn’t find the minimum of a single sensor or the minimum over time.

For a sensor that tells you the minimum daily value of two sensors you have a couple options.

  1. For each source sensor, a Statistics sensor to find its minimum over the last 24 hours. Then, add a Template sensor to find the minimum of those two.

  2. A trigger-based template sensor can be used to get the current day’s minimum from multiple source sensors.

template:
  - trigger:
      - platform: time
        at: "00:00"
        id: reset
      - platform: state
        not_to:
          - unknown
          - unavailable
        entity_id:
          - sensor.example_1_temperature 
          - sensor.example_2_temperature
    sensor:
      - name: Daily Min Temperature of 1 and 2
        unique_id: daily_min_temp_1_2_001
        unit_of_measurement: "°F"
        state: |
          {% set source = expand(
            ('sensor.example_1_temperature',
            'sensor.example_2_temperature') 
            | select('has_value')) 
          | map(attribute='state') | select('is_number') | map('round', 1) | min %}
          {% if trigger.id == 'reset' %}
            {{ source }}
          {% else %}
            {% set current = (this.state or trigger.to_state.state) | float %}
            {{ [source, current] | min }}
          {% endif %}
  1. Beyond those, I’m sure someone with enough experience could design a SQL query that would find the desired value as well.
1 Like