How to use input_number in an above condition

Hello,

I wonder how to use input number in an above condition?
Int the following code the problematic line is line 22 (if i hardcode the value it is working)

- platform: template
 20    switches:
 19      ga_heating:
 18         # if one of the furnes is on. We are ON
 17         value_template: "{{ (is_state('binary_sensor.ga_kazan_chpump', 'on') or is_state('switch.ga_kazan_relay_4', 'on') ) }}"
 16         turn_on:
 15           - if:
 14               #- alias: "none of the kazan on"
 13               - condition: and
 12                 conditions:
 11                    - condition: state
 10                      entity_id: binary_sensor.ga_kazan_chpump
  9                      state: "off"
  8                    - condition: state
  7                      entity_id: switch.ga_kazan_relay_4
  6                      state: "off"
  5             then:
  4               - if:
  3                   - alias: "temperature is more then input_number.kazan_on_temperature"
  2                     condition: numeric_state
  1                     entity_id: sensor.ga_kazan_temperature_4_pump_furnace
22                      above: "{{ states('input_number.kazan_on_temperature') | float }}"
  1                 then:
  2                   - alias: "turn on the furnece"
  3                     service: switch.turn_on
  4                     target:
  5                       entity_id: switch.ga_kazan_relay_4
  6                 else:
  7                   - alias: "turn on the GAS furnece"
  8                     service: switch.turn_on
  9                     target:
 10                       entity_id: switch.ga_kazan_relay_1
 11         turn_off:
 12           service: switch.turn_off
 13           target:
 14             entity_id: switch.ga_kazan_relay_1

i am getting a following error message:

Invalid config for [switch.template]: expected float for dictionary value @ data['switches']['ga_heating']['turn_on'][0]['then'][0]['if'][0]['above']. Got "{{ states('input_number.kazan_on_temperature') | float }}". (See ?, line ?).

I am wonder what i am doing wrong here?

Thank you

The Numeric State Condition’s above option doesn’t support templates. Use a Template Condition.

               - if:
                   - alias: "temperature is more then input_number.kazan_on_temperature"
                     condition: template 
                     value_template: >
                       {{ states('sensor.ga_kazan_temperature_4_pump_furnace') | float(0) > states('input_number.kazan_on_temperature') | float(0) }}
                 then:

Or, even easier, reference the input_number entity directly in the Numeric State Condition’s above option because it does support that.

               - if:
                   - alias: "temperature is more then input_number.kazan_on_temperature"
                     condition: numeric_state
                     entity_id: sensor.ga_kazan_temperature_4_pump_furnace
                     above: input_number.kazan_on_temperature
                 then:
1 Like

Ahh yes i really overcomplicated this.

Thank you very much!

1 Like