does anyone knows a way to create a dynamic media player group ? Basically I want to create a group for all my google mini that are NOT playing anything when a message is brodcast so music is not stopped.
I checked Media Player Group, Universal Media Player and Media Player Template (HACS) but there’s no mention for my specific need.
Even a “no” would be a good response for me. I’m just asking if this is possible. I created a sensor that does it but it seems that I cannot use sensor domain for tts messages.
Here’s my code anyway :
sensor:
- platform: template
sensors:
media_player_google:
value_template: >-
{% if is_state('input_boolean.multiroom','on') %}
{%- set players = expand('group.media_player_google')|map(attribute='entity_id')|list %}
{{ states.media_player | selectattr('state','!=','playing') | selectattr('entity_id', 'in', players) | map(attribute='entity_id') | join(', ') }}
{% else %}
{%set domains=['media_player','group']-%}
{%for x in states if x.domain in domains and x.name|lower==states('input_select.notification_media_player_google')|lower-%}
{%if x.domain=='group'%}{{-x.attributes.entity_id|join(', ')-}}{%else%}{{-x.entity_id-}}{%endif%}{%endfor%}
{% endif %}
icon_template: >-
{% if is_state('input_boolean.multiroom','on') %}
mdi:speaker-multiple
{% else %}
{%set domains=['media_player','group']-%}
{%for x in states if x.domain in domains and x.name|lower==states('input_select.notification_media_player_google')|lower-%}
{%if x.domain=='group'%}mdi:speaker-multiple{%elif x.domain=='sensor'%}mdi:cast-audio{%else%}mdi:speaker{%endif%}{%endfor%}
{% endif %}
Well at least maybe “will” be possible somewhere in the future. I will love to do the same thing as " LukeDefeo" declared. Now I’m subscribed to that issue. Finger crossed and thank you for pointing me to it.
The join service is actually a create and join service.
you specify the master mediaplayer by “entity_id” that controls the slave mediaplayers specified by “group_members”
I am not sure what you want to achieve. And what service you want to call.
In case it is my “TT and continue” script, then no, you need not to start playback before calling the script. The script will set the media player back to same state after executing the TTS command as it was before. This should work whether the media player was playing or not.
If you are thinking of something else, please explain then I will try to give you my feedback on that.
@ghassan good morning, basically i want to join cast player as a group player ( which can be achieved native via Google Home ) however i want to realise this via HASS
my group.broadcast is a regular group, with all media_players I have. this script/automation auto selects only the available ones. In my player scripts, I use that group.broadcast_available
you mean if they play the same source in the exact same time? No, I havent explored that, as I dont use that at all.
In fact, I only use this for my intercom, and having it announce slightly out of sync has this nice eerie effect I kind of like Like an echo waving through the house…
just found that update. so you are saying it can group all cast devices but do not sync?
as i am using all Nest Audio Speaker and Google is capable of syncing, i assume this will work as well