Media_player.turn_on in automation is not working

Hi

I have just got my LG WebOs tv to work with wake on lan via the UI. Im also able to turn it off via the UI. However what I would like to do know is to turn the TV on with automation with a MQTT switch. I use a binary MQTT switch,which is working fine. But when I try and turn the tv on with the switch then nothing happens. Please find my automation script below.

Any idea of what is wrong here ?

- alias: "Turn the TV on"
  trigger:
    - platform: state
      entity_id: binary_sensor.tv_power
      to: 'on'
  action:
    service: media_player.turn_on
    entity_id: media_player.lg_tv_i_stuen

format your code properly. Instructions are in blue at the top of the page. Do not copy and paste from your post. Edit your post, highlight and press the format code button.

Thank you for the information, now it looks correct.

I want to add that it seems like using the media_player.turn_on does not work does not work in my case, maybe because my turn on action in the WebOs configuration is wake_on_lan ?

Anyway I’ve decided to go with a wake_on_lan switch instead. However this switch does not work even though I have confirmed that wake_on_lan works within my WebOs configuration.

This is how my wake_on_lan switch looks like in configuration.yaml

switch WOL:
  - platform: wake_on_lan
    host: "192.168.0.212"
    mac_address: "secret mac adress"
    broadcast_adress: "192.168.0.255"

Btw i run Hassio in docker, but i believe that should not be an issue since wake_on_lan is working with the WebOs component.