Condition evaluating to true even when it isn't

Using the following value-template as a condition and it keeps evaluating to true and I can’t understand why.

conditions:
  - condition: template
    value_template: >-
      {{ states('sensor.lumi_lumi_weather_temperature')|float >
      states('basement_a_c_setpoint')|float}}
sequence:
  - device_id: f72926b1288a04b870c22d108cac0b5a
    domain: climate
    entity_id: climate.basement_ac
    type: set_hvac_mode
    hvac_mode: cool

basement_a_c_setpoint is a number helper that’s currently set to 88. 'sensor.lumi_lumi_weather_temperature' is 73.6 as shown in the trace under Changed Variables.

  platform: state
  entity_id: sensor.lumi_lumi_weather_temperature
  from_state:
    entity_id: sensor.lumi_lumi_weather_temperature
    state: '73.4'
    attributes:
      unit_of_measurement: °F
      friendly_name: Basement Sensor temperature
      device_class: temperature
    last_changed: '2021-06-03T18:03:53.114759+00:00'
    last_updated: '2021-06-03T18:03:53.114759+00:00'
    context:
      id: 1291bcb22becb9b56eb8f728c5a3d81b
      parent_id: null
      user_id: null
  to_state:
    entity_id: sensor.lumi_lumi_weather_temperature
    state: '73.6'
    attributes:
      unit_of_measurement: °F
      friendly_name: Basement Sensor temperature
      device_class: temperature
    last_changed: '2021-06-03T18:09:55.966598+00:00'
    last_updated: '2021-06-03T18:09:55.966598+00:00'
    context:
      id: 3e921c92ebffccb1dcba9a606b79ef5a
      parent_id: null
      user_id: null
  for: null
  attribute: null
  description: state of sensor.lumi_lumi_weather_temperature
  id: '1'

73.6 > 88 should be false right?

What might be going on here?

You are missing the domain (input_number) in the 2nd states() call.

1 Like

Hahaha… That was it. Thank you. Changed it to {{ states('sensor.lumi_lumi_weather_temperature')|float < states('input_number.basement_a_c_setpoint')|float}} and it works fine now.