If one OR second value

Hi, quick logical operator question. I want to trigger a service IF the state attribute of an entity is either value A or B (but not C, D, E, …)

How can I write that logically correct?

{% if or(is_state_attr('media_player.spotify', 'source', 'kitchen'),
is_state_attr('media_player.spotify', 'source', 'bedroom'))%}
Music at home
{% else %}
NO music at home
{%- endif %}
{% if is_state_attr('media_player.spotify', 'source', 'kitchen') or is_state_attr('media_player.spotify', 'source', 'bedroom') %}
Music at home
{% else %}
NO music at home
{%- endif %}
1 Like

haha, so simple. thanks! think I spent too much time in more complex programming languages :stuck_out_tongue:

1 Like