Sorry if this is a very basic question, as relatively new to HA. Where does the script go, and how can it be triggered - for example in an automation? (I’ve tried adding to scripts.yaml but can’t find a way to trigger it). Thanks.
Edit: Ah I think all this code can be put into the automation itself when formatted correctly.
Hi Jacek,
i’m not able to get your script working with my 55C6V but the problem seems to come from HA having problem with calling the script from the automation.
I have also another automation+script for input selection that is working fine.
** Automation with alias 'lg_smart_tv_select_picture_mode_eco' could not be validated and has been disabled: extra keys not allowed @ data['action'][0]['picture_mode']. Got 'eco' template value is None for dictionary value @ data['action'][0]['data']. Got None*
Thank you for any help
Eddy, Belgium
PS: The audio script is just there temporarily to “ear” if the script runs…
The script with command and luna, as above, doesn’t work with my 55C6V.
Instead, i just tried with button and it’s ok. Example below. I usually just switch eco and cinema mode, so with a left or right button.
- alias: lg_smart_tv_select_picture_mode_eco
trigger:
- platform: state
entity_id: input_button.lg_tv_mode_eco
action:
- service: webostv.button
data:
entity_id: media_player.lg_webos_smart_tv
button: MENU
- delay: 0.7
- service: webostv.button
data:
entity_id: media_player.lg_webos_smart_tv
button: DOWN
- delay: 0.9
- service: webostv.button
data:
entity_id: media_player.lg_webos_smart_tv
button: ENTER
- delay: 0.7
- service: webostv.button
data:
entity_id: media_player.lg_webos_smart_tv
button: LEFT
- delay: 0.7
- service: webostv.button
data:
entity_id: media_player.lg_webos_smart_tv
button: BACK
mode: single
Looks like the TV has to be rooted to pass luna commands… ? Has someone a good tuto to root a LG without to much risk… ?
Ok, no way, my 55C6V is on 3.4.2 firmware so i can’t…
Thanks,
Eddy
I’ve been using this for a while now, and it’s been working really well.
I was wondering, is there an option to ‘get’ the current ‘picture_mode’.
The reason I ask is, I mainly use this to switch the LG C8 to game mode when I’m using the Xbox.
By default it works a treat on the dashboard. However if a game is in HDR or DV, I have to manually change to HDR or DV game mode as well.
My thinking is, if I can monitor the current picture more, I could do something like.
If picture_mode changes & input = xbox
if picture mode like Dolby Vision, call script, set Dolby Vision Game mode (or whatever the command is)
if picture mode like HDR, call script, set dolbyHdrGame
Edit: Looking through the API doc, there’s a batch example that has
Hi. I think it isn’t possible using scripts or available services. Maybe when webostv.command service will be able to return values, so far it doesn’t support this.
Since HA 2023.7 it is possible but i wasn’t implemented so far in webos integration.
Speaking of, is there a way to get info if currently playing content is HDR/DV or not? I’d like to control LED strip on the back of my TV depending on it.
Does anyone know if we can turn on/off the “eye comfort mode” using the integration (without using UP, LEFT, RIGHT etc)? I’ve been searching the web but has not seen any mentionings of it.
After scouring the web to find the right command for the “blue light filter,” I was finally able to get it working on my LG C1 with this script by setting eyeComfortMode
sequence:
- service: webostv.command
data:
entity_id: media_player.lg_webos_smart_tv
command: system.notifications/createAlert
payload:
message: Setting blue light
modal: false
buttons:
- label: ok
focus: true
buttonType: ok
onClick: luna://com.webos.settingsservice/setSystemSettings
params:
category: picture
settings:
eyeComfortMode: on
type: confirm
isSysReq: true
- delay:
milliseconds: 40
- service: webostv.button
data:
entity_id: media_player.lg_webos_smart_tv
button: ENTER
Thanks for posting this @sblatz! This solved a long running problem for me, I’m now able to change to “Game” mode automatically when Android TV Remote integration see’s I’m running SteamLink or Moonlight.
That’s a weird hack to get it to run a luna command by making it part of an onClick event and then sending the click. Nothing even shows up on my screen, it just works!
Script to change TV picture mode based on a variable
alias: Living Room TV Change Picture Mode
sequence:
- service: webostv.command
data:
entity_id: media_player.living_room_tv_webos
command: system.notifications/createAlert
payload:
message: Setting Game Mode
modal: false
buttons:
- label: ok
focus: true
buttonType: ok
onClick: luna://com.webos.settingsservice/setSystemSettings
params:
category: picture
settings:
pictureMode: "{{ pictureMode }}"
type: confirm
isSysReq: true
- delay:
milliseconds: 40
- service: webostv.button
data:
entity_id: media_player.living_room_tv_webos
button: ENTER
mode: single
icon: mdi:gamepad
fields:
pictureMode:
selector:
text: null
name: pictureMode
description: Picture Mode of the TV
required: true
Automation to capture running app_id and run script
- id: Game Mode On
alias: Game mode on
trigger:
platform: state
entity_id: media_player.shield_android_tv
attribute: app_id
to:
- com.valvesoftware.steamlink
- com.limelight
action:
- service: script.living_room_tv_game_mode
data:
pictureMode: game
I have one that restores “normal/standard” after I’ve exited those:
Automation to change TV to “normal/standard” picture mode
- id: Game Mode Off
alias: Game mode off
trigger:
platform: state
entity_id: media_player.shield_android_tv
attribute: app_id
from:
- com.valvesoftware.steamlink
- com.limelight
action:
service: script.living_room_tv_game_mode
data:
pictureMode: normal