Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105795

Trigger with condition to control template sensor update

$
0
0

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”) }}
  • sensor:
    • name: “mySensor”
      unit_of_measurement: “kWh”
      state: >
      {% set result = states(‘sensor.solar_load_power’) | float(0) %}
      {{(result)}}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>