Guten Abend
Da es Probleme mit dem FHEM Modul für LG webOS TV (82_LGTV_WebOS.pm) mit neuer Firmware gibt. Habe ich ein rudimentäres Modul ,,70_LGWebosPY.pm" auf Basis der Python Implementierung geschrieben. Mit dem Status update muss man spielen. Wird der TV zu oft abgefragt um auch die Fernbedienung abzufangen, blockt der TV. Ist halt KI.
Warnung!!! Nur für ,,Käpsele". Implementierung nicht einfach.
How to proceed:
# first enter the directory of fhem
# cd /opt/fhem/
# then open a terminal in this directory and create a new directory
# mkdir VPyFHEM
# then create a virtual python instance
# python3 -m venv VPyFHEM
# open the virtual python environment
# source VPyFHEM/bin/activate
# then install LG Webos TV module
# pip install lgtv-cli
# copy 70_LGWEBOSpy.pm to fhem/FHEM
#
# change the rights for the directory VPyFHEM and file accordingly
#
# define the TV with a long interval for update status, because it takes a long time
# and to read the status to often, will block the TV
# define name LGWEBOSpy IP 60 5
#
# confirm with your remote control on TV
Gruß
Hans-Jörg
Anbei das Modul: siehe Anhang
Die permanente Statusabfrage wird bei TV off automatisch abgeschaltet. Der ping dauert einfach zu lange. Kann mit status_on wieder eingeschaltet werden.
Evtl. hat jemand eine bessere Idee?
Update am 11.03.2026: Jetzt mit non-blocking call. Define mit "define <name> LGWEBOSpy IP 40 10" läuft relativ stabil und sollte für alle LG TVs mit webOS funktionieren.
Update vom 14.03.2026: Befehle wurden erweitert. Modul läuft stabil, Aber zu kurzfristig aufeinander folgende Befehle werden teils durch das existierende Python Modul ignoriert. Auf jeden Fall können über diesen Weg neue LG webOS TVs jetzt wieder in FHEM integriert werden.
Update vom 16.08.2026: Weitere Befehle hinzugefügt und läuft stabiler.
Leider funktioniert diese Methode ab WEBOS 26 auch nicht mehr.
LG ändert den Zugang zu oft. Diese Marke ist für Hausautomatisierung nicht zu empfehlen.
Gruß Hans-Jörg
Ab WEBOS 26 gibt es ein neues Python command line tool (lgtvremote-cli.py). Die Installation ist ein ticken komplexer als oben. Das Pairing erfordert eine interaktive PIN Eingabe.
Die Einbindung in FHEM läuft sehr stabil. Falls Interesse besteht, kann ich meine "70_LGWebosPY.pm" Testeinbindung anpassen und hier bereitstellen.
Gruß Hans-Jörg
Hallo Hans-Jörg,
vielen Dank für die Info. An Deiner Integration habe ich Interesse.
Grüße Jörg
Anbei die Anleitung zur Nutzung des Python command line tools für LG WEBOS TVs in FHEM.
How to proceed:
Feste IP für den LG TV vergeben.
dann:
first enter the directory of fhem
cd /opt/fhem/
then open a terminal in this directory and create a new directory
mkdir VPyFHEM evtl. existierendes Directory löschen
then create a virtual python instance
python3 -m venv VPyFHEM
open the virtual python environment
source VPyFHEM/bin/activate
then install LG Webos TV module
pip install lgtvremote-cli
copy 70_LGWEBOSpy.pm to fhem/FHEM
change the rights for the directory VPyFHEM and file accordingly (fhem)
Dann Terminal auf dem FHEM Computer am besten im Dir. /opt/fhem starten und folgen Befehl eingeben (damit wird gleich der Zugriff auf Python getestet:
VPyFHEM/bin/lgtv add <IP> [--name <Name>] oder
VPyFHEM/bin/lgtv scan
AM TV sollte dann ein PIN Code angezeigt werden. Diesen bitte eingeben.
Im Hintergrund wird die Konfiguration im Dir. ".config/lgtvremote/devices.json abgelegt. Vermutlich unter root.
Pfad inklusive .config nach /opt/fhem kopieren und Rechte anpassen.
Einrichtung unter FHEM
define the TV with a long interval for update status, because it takes a longer time
and to read the status to often, will block the TV
define name LGWEBOSpy IP 40 10
Bisher habe ich noch keine Idee das Pairing, die PIN Abfrage und Eingabe, in FHEM zu integrieren.
Dann sollte es laufen. Viel Glück
Gruß Hans-Jörg
Hallo Hans-Jörg,
vielen Dank für das Tutorial. Funktioniert.
Grüße Jörg