Using min/max values of an input_number in a template

I have an automation that controls humidity, and a helper 'input_number.house_winter_humidity.
The helper has the concept of min/max values for this input_number, and I’d like to able to use the min/max values in a template as a crude form of hysteresis.

I cannot find an example of how to access the min/max (attribute?) of the helper.

I know I could create separate minx/max helpers, just trying not to -)

trigger:
  - platform: numeric_state
    entity_id: sensor.windhamvt_humidity_in
    for:
      hours: 0
      minutes: 5
      seconds: 0
    id: Living Room Humidity Too High
    above: input_number.house_winter_humidity
  - platform: numeric_state
    entity_id: sensor.windhamvt_humidity_in
    for:
      hours: 0
      minutes: 5
      seconds: 0
    id: Living Room Humidity Too Low
    below: input_number.house_winter_humidity

Thanks in advance

Use a template.

{{state_attr('input_number.house_winter_humidity','max')}}
{{state_attr('input_number.house_winter_humidity','min')}}

You could then use a whole template trigger instead.

trigger:
  - platform: template
    value_template: >-
      {{states('sensor.windhamvt_humidity_in') >
      state_attr('input_number.house_winter_humidity','max')}}
    for:
      hours: 0
      minutes: 5
      seconds: 0

That’s what I was missing, thank you!

1 Like