TTS - media_player state not updating, is this a bug?

It appears that the media_player component might not be working properly as the state of mine do not (always) update their state when playing.

I have been having some really irritating issues with TTS for some time. Often the message is cut significantly short and recently it usually doesn’t start until up to about a second into the message which at best is mildly annoying but at worst makes the message difficult to understand if it is short.

I think I have tracked down the reason that sometimes the message is being cut short. If I watch the state of the media_player it often doesn’t change from ‘paused’ to 'playing'.

Has anyone else noticed this?

Does anyone have any ideas why this is happening?

Does anyone know internally what causes a state change? I’d like to explore if it could be anything at my end, although I can’t think of anything. (I’m using Sonos. And hassio if that is relevant).


Here is my config which is very standard for TTS.

  announce:
    sequence:

    # Take a snapshot
    - service: media_player.sonos_snapshot
      data_template:
        entity_id: "{{ 'media_player.' ~ room }}"

    # Unjoin
    - service: media_player.sonos_unjoin
      data_template:
        entity_id: "{{ 'media_player.' ~ room }}"

    # Set volume
    - service: media_player.volume_set
      data_template:
        entity_id: "{{ 'media_player.' ~ room }}"
        volume_level: "{{ volume }}"

    # Say the message
    - service: tts.google_say
      data_template:
        entity_id: "{{ 'media_player.' ~ room }}"
        message: "{{ message | replace('\n',' ') | replace('   ',' ') | replace('  ',' ') }}"
   
    # Wait until Sonos starts playing
    - wait_template: >-
        {{ is_state('media_player.' ~ room , 'playing') }}
      timeout: '00:00:30'

    # Now wait until it has finished playing
    - wait_template: >-
        {{ is_state('media_player.' ~ room , 'paused') }}
      timeout: '00:02:00'

    # Restore from snapshot
    - service_template: >
        {% if last_message | default(True) %}
          media_player.sonos_restore
        {% else %}
          script.no_op
        {% endif %}
      data_template:
        entity_id: "{{ 'media_player.' ~ room }}"