Condition doesn't work correctly in automation

Hello,

I have added this in my automation:
condition: "{{ (state_attr('climate.toon_thermostaat', 'temperature')|float) > 17.0 }}"

But it still fires when the temperature equals 17.0 while it should fire when it’s over 17.0.
How is this possible?

It could be a rounding error as it is cast as a float. Have you considered this:

condition: "{{ (state_attr('climate.toon_thermostaat', 'temperature')|float | round(1)) > 17.0 }}"

check the values in the developer tools.

It is really strange, as I already checked it with the developer tools.

{{ (state_attr('climate.toon_thermostaat', 'temperature')|float) > 17 }}
{{ (state_attr('climate.toon_thermostaat', 'temperature')|float|round(1)) > 17.0 }}

This produces False and False. However the automation runs even with these conditions being False.
Currently this is my trigger and condition.

  trigger:
  - platform: time
    at: '15:00'
  condition: "{{ (state_attr('climate.toon_thermostaat', 'temperature')|float|round(1)) > 17.0 }}"

Currently it doesn’t even work when the temperature is set at 16.5…
Does anyone have any idea why it doesn’t work as expected?

Show the full automation. There might something else than the bits you focus on.

- id: '1796441963042'
  alias: Notify - Verwarming uit
  description: ''
  trigger:
  - platform: time
    at: '15:00'
  condition: "{{ (state_attr('climate.toon_thermostaat', 'temperature')|float|round(1)) > 17.0 }}"
  action:
  - alias: Set up variables for the actions
    variables:
      cv_17: '{{ ''CV_17_'' ~ context.id }}'
  - alias: Ask to set the heating
    service: notify.mobile_app_telefoon_x
    data:
      message: 'Kan de verwarming naar 17°C? Nu ingesteld op: {{ state_attr(''climate.toon_thermostaat'',''temperature'')|float
        }}°C'
      data:
        actions:
        - action: '{{ cv_17 }}'
          title: 17°C
  - alias: Wait for a response
    wait_for_trigger:
    - platform: event
      event_type: mobile_app_notification_action
      event_data:
        action: '{{ cv_17 }}'
  - alias: Perform the action
    choose:
    - conditions:
      - condition: template
        value_template: '{{ wait.trigger.event.data.action == cv_17 }}'
      sequence:
      - service: climate.set_temperature
        data:
          temperature: 17
        target:
          entity_id: climate.toon_thermostaat
  mode: single

This is the complete one!
Everything works, except the condition…

Also show the values from the developer tools.
Sometimes there is a thing that makes it fail, like some European sensors that report values with a comma instead of a dot as a decimal indicator.

This:

{{ state_attr('climate.toon_thermostaat', 'temperature') }}
{{ (state_attr('climate.toon_thermostaat', 'temperature')|float|round(1)) > 17.0 }}

Shows:

20.0
True

Or

17.0
False

So this shows exactly what I want, but doesn’t work like I want…

So, why doesn’t this work as expected?

I agree that it should work. Maybe for further troubleshooting look at the trace of the automation execution next time it fails under Configuration >> Automations >> (the clock rewind button next to your Notify - Verwarming uit automation. Also see if there are any error messages in the log.