I would appreciate any help with the template yaml below. The entity sensor.mySensor correctly appears on a dashboard but the condition block has no effect on the sensor output which updates whenever the trigger fires (every 30s here)
Any thoughts on what I am doing wrong?
The Jinja2 template editor shows the same behaviour: the output still updates even though the condition evaluates as ‘False’
The functionality to include conditions with triggers has recently been added to template sensors in Home Assistant. Has anyone else experienced problems with making the new functionality work correctly?
My version: Core
2025.3.3
Supervisor
2025.03.2
Operating System
14.2
============================================
YAML
template:
- trigger:
trigger: state
entity_id: sensor.solar_load_power
condition:- condition: template
value_template: >
{{ (states.input_boolean.mytoggle.state == “on”) }}
- condition: template
- sensor:
- name: “mySensor”
unit_of_measurement: “kWh”
state: >
{% set result = states(‘sensor.solar_load_power’) | float(0) %}
{{(result)}}
- name: “mySensor”
1 post - 1 participant