Media player not consistent on automation

Hello,
I have a Sony tv model xbr_55x800h

I use it as media player.

When I use lovelace (media control card) to play sound with tts it’s work all the time.

When I use in automation, I have this:

 - service: media_player.turn_on
   entity_id: media_player.sony_xbr_55x800h
   
 - service: media_player.volume_set
   data:
      entity_id: media_player.sony_xbr_55x800h
      volume_level: 0.4
   
 - service: media_player.play_media   
   entity_id: media_player.sony_xbr_55x800h
   data:
       media_content_id: 'http://192.168.1.106:8123/local/mp3/doorbell.mp3'
       media_content_type: 'music'

Some times it’s work and some times not. May be the source is not selected ?
I have another tv and it work well.
With lovelace (UI) it’s work all the time.
Can somebody tell me what is the exact sequence on the media control card ?

I spend fiew days on it…
Many thanks for your help !!!

Best regards

TVs take some time to turn on. Is this the problem?

not realy.
Somtimes it work like a charme and sometimes it start the tv but don’t play the song

But with the media card it work all the time…

regards

Hello,
Is that possible a delay is needed between turn off the tv and play mp3 ?
It 's just strange because sometimes it’s work well…

Regards

With a try using a delay.