I still can’t manage to pass the parameter to my TV
Hey did you have any luck in the end? I have an oled b7 and having the same issue as you. I see the pop up but no change in picture mode.
I still can’t manage to pass the parameter to my TV
Hey did you have any luck in the end? I have an oled b7 and having the same issue as you. I see the pop up but no change in picture mode.
No still no luck…
Dude, I just found your solution, this was so helpful to me, thanks a buch for this!
Here’s the updated version for the latest Home Assistant:
First: sudo apt-get install netcat-traditional
then add to configuration.yaml
:
command_line:
- switch:
name: "LG Picture Mode ECO"
unique_id: "lgtv_pict_eco"
command_on: "echo \"luna-send -n 1 luna://com.webos.settingsservice/setSystemSettings '{\\\"category\\\": \\\"picture\\\", \\\"settings\\\": {\\\"pictureMode\\\": \\\"eco\\\"}}' & exit\" | nc 192.168.0.120 23"
command_off: "echo \"luna-send -n 1 luna://com.webos.settingsservice/setSystemSettings '{\\\"category\\\": \\\"picture\\\", \\\"settings\\\": {\\\"pictureMode\\\": \\\"normal\\\"}}' & exit\" | nc 192.168.0.120 23"
command_state: "echo \"luna-send -n 1 luna://com.webos.settingsservice/getSystemSettings '{\\\"category\\\": \\\"picture\\\", \\\"keys\\\": [\\\"pictureMode\\\"]}' & exit\" | nc 192.168.0.120 23 | grep -c eco"
- switch:
name: "LG Picture Mode Cinema"
unique_id: "lgtv_pict_cinema"
command_on: "echo \"luna-send -n 1 luna://com.webos.settingsservice/setSystemSettings '{\\\"category\\\": \\\"picture\\\", \\\"settings\\\": {\\\"pictureMode\\\": \\\"cinema\\\"}}' & exit\" | nc 192.168.0.120 23"
command_off: "echo \"luna-send -n 1 luna://com.webos.settingsservice/setSystemSettings '{\\\"category\\\": \\\"picture\\\", \\\"settings\\\": {\\\"pictureMode\\\": \\\"normal\\\"}}' & exit\" | nc 192.168.0.120 23"
command_state: "echo \"luna-send -n 1 luna://com.webos.settingsservice/getSystemSettings '{\\\"category\\\": \\\"picture\\\", \\\"keys\\\": [\\\"pictureMode\\\"]}' & exit\" | nc 192.168.0.120 23 | grep -c cinema"
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:
- alias: lg_smart_tv_select_picture_mode_eco
trigger:
- platform: state
entity_id: input_select.lg_smart_tv_picture_mode
to: eco
action:
- service: script.lg_webos_smart_tv_picture_mode
data:
picture_mode: eco
#----------------------------------------
- service: script.turn_on
target:
entity_id: script.script_audio_input
data:
variables:
audiofile: /share/Speech_On.wav
#----------------------------------------
mode: single
and script wich is yours:
lg_webos_smart_tv_picture_mode:
sequence:
#----------------------------------------
- service: script.turn_on
target:
entity_id: script.script_audio_input
data:
variables:
audiofile: /share/Speech_On.wav
#----------------------------------------
- service: webostv.command
data:
entity_id: media_player.lg_webos_smart_tv
command: system.notifications/createAlert
payload:
message: >-
{{ picture_mode }}
modal: false
buttons:
- label: "ok"
focus: true
buttonType: "ok"
onClick: "luna://com.webos.settingsservice/setSystemSettings"
params:
category: "picture"
settings:
pictureMode: >-
{{ picture_mode }}
type: "confirm"
isSysReq: true
- delay: 0.6
- service: webostv.button
data:
entity_id: media_player.lg_webos_smart_tv
button: ENTER
Error message in logs when reloading automations:
** 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…
Hi Eddy. I think the problem is about the indentation in you automation code.
it should be:
- service: script.lg_webos_smart_tv_picture_mode
data:
picture_mode: eco
Now HA complains about missing picture_mode
value, it’s caused by wrong formatting
Jacek, you saved me
No more error in logs but i’ll have to wait a few hours to check with my LG TV, i’m still at work
Thanks !
Eddy
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
{
“method”: “getSystemSettings”,
“params”: {
“category”: “picture”,
“keys”: [
“brightness”
],
“subscribe”:true
}
},
Which returns
{
“method”:“getSystemSettigns”,
“settings”: {
“brightness”: “50”
},
“category”: “picture”,
“dimension”: {
“input”: “comp1”,
“pictureMode”: “normal”,
“_3dStatus”: “2d”
},
Do you think it’s possible to make a call to ‘getSystemSettings’ with something like keys: [pictureMode]?
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.
Thanks Jacek for responding. Good to know I wasn’t going mad, as I was struggling to get it to work
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.
Great tips in this post!
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!
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
- 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:
- 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
This is a wonderful idea, you inspired me to see if I can get from Home Assistant which app an AppleTV is running and change the game accordingly.