Mediaplayer doesn't turn on when running script

Hi there,

I have a script, that turns on power, lift up the tv but doesn’t turn on the tv. It works, when I trigger the step manually - but not at script-runtime.
Any idee or hint for me?

Thanks a lot!

alias: scr_einschalten_TV
sequence:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.fernsehschrank_switch
  - wait_for_trigger:
      - platform: template
        value_template: >-
          {{ states('switch.tvlift_up') != "unavailable" and
          states('switch.tvlift_up') != "" }}
    continue_on_timeout: false
  - service: switch.turn_on
    data:
      entity_id: switch.tvlift_up
  - service: media_player.turn_on
    entity_id: media_player.sony_kdl_42w815b
mode: single
icon: mdi:television-ambient-light

Shouldn’t it be as below?

  - service: media_player.turn_on
    target:
      entity_id: media_player.sony_kdl_42w815b

And/or…what does the automation trace show you on details? (often not much)

I tried a lot of variations, even this one. The result is always the same: works, when trigger step by step, but not when running inside script. The logs doesn’t show any helpful. Also try to switch on the mediaplayer before lift up - player doesn’t start.

Seems that the Bravia itself need more time… Insert another 5-second-delay and now it work as expected.