Deep down in the setting under “energy saving” there is an option to turn off screen. Using the voice control with “turn off screen” would turn off the screen. Is there a way to turn off the screen using HA? I searched online with no luck and I wonder does anyone in the community would be able to achieve that.
There is a command you can use in a script that also should work:
alias: Turn off TV
sequence:
- service: webostv.command
data:
entity_id: media_player.lg_tv
command: com.webos.service.tvpower/power/turnOffScreen
mode: single
Tried the script, but it does not work for me
What model do you have? I believe it/some of the commands only work with the newer models (>C9)
I have a C9
Where did you find this command? i was never able to find an official source for these commands
There is a link in the documentation.
I can’t get this specific command to work.
Others from the documentation do work, like audio/volumeUp
This refuses to work:
Am I missing something?
I also tried to get the turnOffScreen working.
I think the problem is that HA still uses “aiopylgtv==0.3.3” but the command to turn off the screen has been introduced in version “0.4.0”. Therefore I think we need to wait until the component has been updated. However I also don’t know how to push this or when it will happen.
I see, thanks for the info.
For now i put “screen off” as a shortcut in the minimal settings list and use it from there
You’re absolutely right. Currently they are refactoring some of the code to enable front end setup - the upgrade to 0.4.0 would force us to reauthenticate the TVs yet again, so they try to do both at the same time to save us some hassle.
That’s the important information
I came up with this, until a direct command is available.
Edit up the “mini” settings menu with the Turn screen off option down at the end (over the edit icon)
Then in home assistant run this script:
script:
lg_tv_turn_off_screen:
alias: Turn off tv screen
sequence:
#3 times back, just in case the tv is left in some menu or whatever (could be omited i guess)
- service: webostv.button
data:
entity_id: media_player.up_lr_lg_tv
button: "BACK"
- service: webostv.button
data:
entity_id: media_player.up_lr_lg_tv
button: "BACK"
- delay: 00:00:01
- service: webostv.button
data:
entity_id: media_player.up_lr_lg_tv
button: "BACK"
- delay: 00:00:01
- service: webostv.button
data:
entity_id: media_player.up_lr_lg_tv
button: "MENU"
- delay: 00:00:03
- service: webostv.button
data:
entity_id: media_player.up_lr_lg_tv
button: "UP"
- delay: 00:00:01
- service: webostv.button
data:
entity_id: media_player.up_lr_lg_tv
button: "UP"
- delay: 00:00:01
- service: webostv.button
data:
entity_id: media_player.up_lr_lg_tv
button: "ENTER"
This can be edited accordingly, if you place the option in another position.
Hi
I have tried the workaround but somehow when the script gives one ‘DOWN’ the TV makes two ‘DOWN’…
any idea about this ?
Luj
No idea, never had to troubleshoot it. It just worked at once.
Just rearrange your TV quick menu to match the commands and don’t spend any more time I guess?
Or add an UP command to fix it?
This works fine
- platform: template
switches:
tv_screen:
turn_on:
- service: webostv.command
data:
entity_id: media_player.lg_webos_smart_tv
command: com.webos.service.tvpower/power/turnOnScreen
turn_off:
- service: webostv.command
data:
entity_id: media_player.lg_webos_smart_tv
command: com.webos.service.tvpower/power/turnOffScreen
Just replace the entity id of your TV. Has worked since LG TV component updated to “aiopylgtv==0.4.0” in the HA release 2021.4
indeed, it works great for me too !
switch:
- platform: template
switches:
living_room_screen_off:
value_template: '{{ states("input_boolean.living_room_screen_off") }}'
friendly_name: 'living_room_screen_off'
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.living_room_screen_off
- service: webostv.command
data:
{
"entity_id": "media_player.living_room",
"command": "com.webos.service.tvpower/power/turnOffScreen"
}
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.living_room_screen_off
- service: webostv.command
data:
{
"entity_id": "media_player.living_room",
"command": "com.webos.service.tvpower/power/turnOnScreen"
}
Weirdly this still does not work for me. In my logs I have the following error:
2021-05-17 18:44:20 ERROR (MainThread) [homeassistant.components.webostv.media_player] Error calling async_command on entity media_player.lg_tv: PyLGTVServiceNotFoundError('404 no such service or method')
in node red i just use media player turn_off and then the entity of my tv. that works fine for both my lg tvs (2 diff models)