Help with my TTS script please

Hi all
New to HA and playing around with writing YAML. I can get the simple script to say something to my google device, but am trying a fix to remove the annoying casting icon that stays on after. I have the below but get the following error and have no clue what to correct (and neither does MS copilot :stuck_out_tongue: )
Any help would be appreciated.
Alan

Error on save:
Message malformed: Unable to determine action @ data[‘sequence’][0]

script:
  tts_test:
    alias: "Testing text to speech"
    sequence:
      - service: tts.speak
        data:
          media_player_entity_id: media_player.gh_chef
          message: "Testing 1 2 3"
      - wait_template: "{{ is_state('media_player.gh_chef', 'idle') }}"
      - service: media_player.turn_off
        target:
          entity_id: media_player.gh_chef

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

Sorry, formatting was correct when writing the post but didn’t use the proper syntax and I see it changed on the actual post. I have corrected that now.

You have not specified your TTS entity:

script:
  tts_test:
    alias: "Testing text to speech"
    sequence:
      - service: tts.speak
        target:
          entity_id: tts.somethimg # e.g. tts.home_assistant_cloud
        data:
          media_player_entity_id: media_player.gh_chef
          message: "Testing 1 2 3"
      - wait_template: "{{ is_state('media_player.gh_chef', 'idle') }}"
      - service: media_player.turn_off
        target:
          entity_id: media_player.gh_chef
1 Like

Thanks a lot. I see each service needs to specify the entity. I thought there was one that could be used for the entire script. At least that is what google led me to believe :stuck_out_tongue: . I learn through doing so thanks for giving me the steer