Here’s my switch yaml:
- platform: template
switches:
family_room_lgtv:
friendly_name: 'Family Room TV'
value_template: "{{ is_state('media_player.family_room_tv', 'playing') }}"
turn_on:
service: media_player.turn_on
data:
entity_id: media_player.family_room_tv
turn_off:
service: media_player.turn_off
data:
entity_id: media_player.family_room_tv
for this config
media_player:
- platform: webostv
host: !secret lgtv_ip
name: Family Room TV
turn_on_action:
service: wake_on_lan.send_magic_packet
data:
mac: !secret lgtv_mac
customize:
sources:
- Amazon Prime Video
PS To paste code either use the </> in the toolbar above where you type, or use four ` marks to delimit.