This might help you… i was using media_player.turn_on too and i modified my template to the below…
- platform: template
switches:
front_room_television_template:
value_template: "{{ is_state('media_player.lg_tv_2', 'on') }}"
turn_on:
- service: wake_on_lan.send_magic_packet
data:
broadcast_address: 192.168.2.255
mac: 78:5D:C8:7D:23:71
turn_off:
service: media_player.turn_off
entity_id: media_player.lg_tv_2