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?