I came across this python script by @rodpayne that you can combine with an automation to help do this. Trying to keep the “Default Media Receiver” synced up is tricky but this should provide a good starting point.
#==================================================================================================
# python_scripts/set_state.py
#==================================================================================================
#--------------------------------------------------------------------------------------------------
# Set the state or other attributes for the entity specified in the Automation Action
#--------------------------------------------------------------------------------------------------
inputEntity = data.get('entity_id')
if inputEntity is None:
logger.warning("===== entity_id is required if you want to set something.")
else:
inputStateObject = hass.states.get(inputEntity)
inputState = inputStateObject.state
inputAttributesObject = inputStateObject.attributes.copy()
for item in data:
newAttribute = data.get(item)
logger.debug("===== item = {0}; value = {1}".format(item,newAttribute))
if item == 'entity_id':
continue # already handled
elif item == 'state':
inputState = newAttribute
else:
inputAttributesObject[item] = newAttribute
hass.states.set(inputEntity, inputState, inputAttributesObject)
And for the automation.
#==================================================================================================
# packages/gmusic_player/sync_default_receiver.yaml
#==================================================================================================
automation:
- alias: 'gmusic_sync_to_speakers'
hide_entity: True
trigger:
platform: template
value_template: "{{ is_state('sensor.gmusic_receiver', 'playing') }}"
for:
seconds: 2
action:
- service: python_script.set_state
data_template:
entity_id: "{{ state_attr('media_player.gmusic_player', '_player_id') }}"
entity_picture: "{{ state_attr('media_player.gmusic_player', 'entity_picture') }}"
media_title: "{{ state_attr('media_player.gmusic_player', 'media_title') }}"