How to LG TV power off via KODI power off


#1

Scope:

  • This script will turn off LG TV (> 2011) when you turn off the TV box (via KODI power menu, remote controller or button on the box).
  • LG smart TVs are very known for their very bad implementation of HDMI CEC protocol, at least old TV models <2015 (does not support power off via CEC command)

Requirements:

  • LG TV >2011
  • TV connected to the same network as TV BOX
  • Mecool KIII PRO (S912), CoreELEC 8.90
  • Putty or similar SSH software

Integration process: scripts.zip (1.4 KB)

  1. Copy service file shutdown_with_net.service to folder /storage/.config/system.d/
  2. Put your shutdown script shutdown_with_net.sh to folder /storage/.config/
  3. Put your python script lg_tv_control_lan.py to folder /storage/.config/
  4. Edit python script lg_tv_control_lan.py and set TV ip address and paring key
  5. Pairing key could be found also by running script sh shutdown_with_net.sh with TV IP address and pairing random key, once executed in the shell, TV displays pairing your key
  6. Set permissions for the service and scripts chmod 755 shutdown_with_net.sh and chmod 755 lg_tv_control_lan.py and chmod 755 shutdown_with_net.service
  7. Start the service, systemctl enable shutdown_with_net.service
  8. Restart the box

Reference readings which lead to functional script:


#2

Does this mean I can press the power off button on the remote control, while in kodi, and it will also power off my LG TV? If so, will it also power on my LG TV when I press the power key on my remote control to power on my CE box?


#3

Did you read the first line in the How To?


#4

Yes and I saw that line clearly says it will turn OFF the LG TV. However, where will I find the information if it will turn ON the TV.


#5

It will not (or it would say power on and off )
Once the box is off, how can this shutdown script (hint) do anything else? :thinking:


#6

@Habibie, as Poida said, script is just for powering OFF LG TV. It has no influence to power on sequence.

For power ON LG TV via TV BOX, this does not work now for me in CoreELEC but it does work with Android stock 7.1.1 firmware KIII PRO. So I am expecting either wrong config of CEC driver for LibreELEC / CoreELEC or wrong system setup on my side (I was not able to power on the TV even by using cec client commands). I am planning to make a test to go back to Android image again and re-run clean CoreELEC and LibreELEC from SD card in order to verify if it works or not.

I did mention the issue in the forum but no feedback so far. https://discourse.coreelec.org/t/lg-tv-power-on-issue-via-hdmi-cec/1034


#7

OK and that is understood.