Template Conditions not working for me

I’m trying to use a template condition for a conditional card but am not having success. The docs say that this YAML should work as the conditions list:

conditions: "{{ (state_attr('device_tracker.iphone', 'battery_level')|int) > 50 }}"

but I get an error with an even simpler setup:

If I fall back to another example from the docs:

  - "{{ (state_attr('device_tracker.iphone', 'battery_level')|int) > 50 }}"

I get a different error:

Using the full syntax throws a third distinct error:

Did I get the syntax wrong in all three cases or is something else amiss?

Template conditions are not one of the available condition type options for Conditional Cards.

Shoot, I missed that. Looks like the same restriction applies to the newly released ‘visibility’ field. I guess I’ll have to make a template sensor as a proxy. Thanks!

You can use a Numeric State condition for the example you showed.

Apparently it doesn’t do attributes… You are correct, you’ll have to use a template sensor or binary sensor.

Yeah, my actual use case was an attribute, so a template sensor makes sense to me. Would be nice if the restriction on template conditions was resolved in the future though.