Working with a Sonos Roam, that I regularly charge via wireless charger. When I place it on the charger I’d like to ungroup it, if it’s grouped, as it seems to charge faster when not playing.
I’ve figured out the trigger just fine, but having difficulty with the action. Primarily determining if the roam is in a group. Once I can programmatically determine that, I can ungroup it.
So the device is media_player.sonos_roam
, which has an attribute (when grouped) of:
group_members:
- media_player.bedroom
- media_player.sonos_roam
I’ve been playing with a template using an if is_state_attr('media_player.sonos_roam', 'group_members' ..
but haven’t gotten much farther. My logic is to count how many members there are in the group, and if it’s greater then 1, consider the speaker grouped, otherwise consider it ungrouped.
For example when a speaker is ungrouped, it also has the group_members
attribute, but it’s singular, such as group_members: media_player.living_room
.
Bit our of practice and could use some guidance; much appreciated!