Adjust Jinja template slightly to allow for another condition

{% if is_state("group.bobby", "home") %}
Home
{% else %}
{{state_attr("sensor.bobby","place_name")}}{%- endif %}

I currently use the above template sensor in my front end, but I’d like to include another possibility that is used for if the place_name is ‘Hounslow’ then it should be overridden to ‘Gym’

Anyone know how to do this? I had a play with elif but all I got was errors!
Thanks

{% if is_state("group.bobby", "home") %}
Home
{% elif is_state_attr("sensor.bobby","place_name", "Hounslow") %}
Gym
{% else %}
{{state_attr("sensor.bobby","place_name")}}{%- endif %}
1 Like