Hi,
I’m trying to create a script that will toggle my LG TV power state.
So far this is what I configured:
configuration.yaml:
##########################################################
# swtich for WOL LG TV
##########################################################
switch:
platform: wake_on_lan
name: lg
mac: !secret lg_mac_address
##########################################################
# LG smart TV
##########################################################
webostv:
host: !secret lg_host
name: Living Room TV
#other settings
turn_on_action:
service: switch.turn_on
entity_id: switch.lg
customize:
sources:
- Mi Box
- youtube
- netflix
- PS4
- makoTV
You can also remove the WOL switch and add it directly to the webos config, make sure to add the broadcast address that suits you LAN (not the IP of your TV)
I’ve tried removing the first line and then I get the following error:
Error executing script. Invalid data for call_service at pos 2: required key not provided @ data[‘command’]
For the first 2, in your scripts, first turn on the TV, then you’ll probably need a delay to wait for the TV to power up and be ready, then call the media_player.play_media service as described here:
For the 3rd, do the same but just turn on your shield
Before i added the select source, i could use the script to turn on / off
How will that react now?
Cause i added the select source, or doesnt it do any harm?
If its state is off now, it will turn on and select source netflix
if its state is on now, it will turn off and select the source too ?
It should be OK, depending on whether the TV turns back on when the select source is called ?
Problem is if you run this and netflix is playing, then you run another script to watch another source, it will turn the TV off
You may need a turn and and off script.
You could either have separate buttons to call them or you could set up a template switch to run the on and off actions
Thats true.
When tv is on, and i run script to watch netflix it will turn off instead of switching sources
However, if the tv is on (source tv or netflix) we will probablhy dont use the script to change sources, once the tv is on
i’m not sure yet
For now i’m still struggling with the source he doesnt select, propably the delay is too short
So how would you do it? A turn on/off sciprt, or having separate buttons or with a template switch
Whats the best route to go
Turning on/off we will mostly use google to call the script,