I’m using the teamtracker integration via HACS and trying to trigger an automation when my sports team’s game ends, with a condition.
Following the traces, I can see the that the trigger is firing but the condition is failing. For the condition I’m reading an attribute of an entity which can read true, false, or null, with the condition requiring a true to pass. However, the condition is failing every time, see image below.
I guess the issue is the mismatch in the quotes ( true vs ‘true’ ) but I’m using true without quotes in the automation editor. How can I resolve this?
This is an annoying quirk of the Automation Editor… edit the automation in YAML to remove the quotes or use a template condition:
condition: template
value_template: "{{ state_attr('sensor.phillies', 'team_winner') }}"
I’m not sure what it means when the sensor is null
or what integration is providing this sensor, but generally things that can be either true or false should be binary sensors. Depending on the exact meaning of null
, that state could be modelled as unavailable
or unknown
.
If that were a binary sensor, then your condition would be easier to author in the UI without the true
vs 'true'
problem you’ve run into.
Anyway, if it’s a template sensor or something else you have control over, consider changing it to a binary sensor. Otherwise, hopefully Didgeridrew’s suggestion solves your problem.
Thank you! I will give this a shot
The sensor is from the Teamtracker integration (via HACS)