Hi,
I got following reusable template:
{% macro in_car() %}
{% set device = "XX:XX:XX:XX:XX:XX (MY_CAR)" %}
{{ device in (state_attr('sensor.phone_bluetooth_connection', 'connected_paired_devices') | list) }}
{% endmacro %}
Which works great in the development tools section:
{% from 'bt_auto.jinja' import in_car %}
{{ in_car() }}
This returns:
Resulttype: boolean
false
However, when I try to use this in an if-else statement, it always executes the ‘True’ branch
{% from 'bt_auto.jinja' import in_car %}
{% if in_car() %}
Connected
{% endif %}
Resultaattype: string
Connected
How should I make the reusable templates work in if-else statements ?
Thx in advance !