Sensor automation does not respect condition

I have made a sensor automation that always executes its action even when the condition is not fullfilled. Currently the automation looks like this (it is not the final form, but I have tried various things to make it work):

- id: '1776119340778'
  alias: Scooteropladning-check
  trigger:
    - platform: time
      at: "21:09:00"
  conditions:
  - condition: numeric_state
    entity_id: sensor.scooteroplader_power_max_2
    above: 9.5
  - condition: template
    value_template: >
      "{{ states('sensor.scooteroplader_power_max_2') | float(0) > 95 }}"
  action:
    - service: notify.notify
      data:
        title: "Scooteroplader"
        message: "Er scooter tilsluttet oplader? {{ states('sensor.scooteroplader_power_max_2') }}"   

The sensor should have been a max statistics sensor, but apparently the statistics sensor has no value, if its input has not changed for a while, so instead I use this:

template:
- sensor:
  - default_entity_id: sensor.scooteroplader_power_max_2
    state: "{{ states('sensor.scooteroplader_power_max') if 'sensor.scooteroplader_power_max' | has_value else states('sensor.scooteroplader_power') }}"
    name: scooteroplader_power_max_2

And the statistics sensor is:

sensor:
  - platform: statistics
    entity_id: sensor.scooteroplader_power
    name: "Scooteroplader power max"
    unique_id: "scooteroplader_max"
    state_characteristic: value_max 
    max_age:
      minutes: 15

Both the statistics sensor and the template sensor seem to work fine and I can see nice graphs over their values during the last days.
But when the automation triggers, then I get a trace like this:

Udført: 24. maj 2026 kl. 09.37.59
Resultat:
params:
  domain: notify
  service: notify
  service_data:
    title: Scooteroplader
    message: Er scooter tilsluttet oplader? 8.44
  target: {}
running_script: false

As you can see, the value is 8.44 which is too low for both the 9.5 and the 95 thresholds in the conditions, but the message is sent anyway.
I have tried to ask the Claude AI, but it is totally lost and suggest random, not related changes.
I have similar automations on "real" entities that work without problems. What can be wrong?

Are you testing the automation by waiting for its Time Trigger to trigger at 21:09:00 or are you manually executing the Run command?

The Run command skips the automation's triggers and conditions. It only executes the automation's actions.

Troubleshooting Automations

In the three dots menu in the automation list or automation editor UI, select the Run actions button. This will execute all the actions, while skipping all triggers and conditions. This lets you test the full sequence of actions, as if the automation was triggered and all conditions were true.

Thanks, that helped. I did not know that the conditions are not executed when the automation is started manually, partly because I usually have my conditions in the action part and partly due to the mismatch between my danish UI ("handlinger") and the english yaml keywords ("actions").
I have now moved the condition into the action part and now it seems to work.

You're welcome!

Please consider marking my post above with the Solution tag. It will help others find answers to similar questions.

You could have left it in the conditions section and tested the automation using the automation.trigger action. It can optionally test conditions.

This action will trigger the action of an automation. By default it bypasses any conditions, though that can be changed via the skip_condition attribute.