Hi,
I use Heos players around the house.
I created a nice little dashboard and some cards visibility are linked to Helpers value.
My goal is to identify if a player is in a group but NOT the group leader. In this case, I hide its card as it is linked to a group leader and I don’t need to change anything to it.
For instance, for “kitchen”, here are the different possibilities for “group_members” value
- group_members: media_player.kitchen, media_player.office, media_player.workshop
=> result should be FALSE as it is leader of the group (first in the list) - group_members: media_player.office, media_player.kitchen, media_player.workshop
=> result should be TRUE as it is member of a group BUT not the leader. - group_members: null
=> Result should be FALSE as it is not member of a group.
To do so, I tried this :
{% set m = ‘media_player.kitchen’ %}
{% set g = state_attr(m, ‘group_members’) | list %}
{{ m in g and g|first|default(‘’) != m }}
It nearly works
It gives me the correct answer BUT, if the device is not a group member at all, “group_members” is null and my test fails.
I might have some kind of variable declaration issue where the test can not evaluate the content of a null list. If it set g as a string, it works when the string is null (but fails if the string is actually a list).
Any suggestion ?
Thanks a lot !