Neues Modul VestelTVs für verschiedene TVs (Telefunken, Graetz, Toshiba, Medion)

Begonnen von eki, 04 Januar 2021, 18:56:19

Vorheriges Thema - Nächstes Thema

eki

Das Modul kann TVs steuern, die auf Basis bestimmter Boards der Firma Vestel aufgesetzt sind. Dazu zählen verschiedene eher preiswerte Hersteller wie Telefunken, Graetz, Toshiba, Medion, OK, Techwood, Finlux, Luxor, Vestfrost.

Installation geht erst mal per Kopieren der Datei in's FHEM Verzeichnis und reload in FHEM.

Das Ganze läuft bei meinem Telefunken soweit, ist allerdings noch Beta, daher erst mal auch mit FHEM Abstürzen rechnen.

Mich würde interessieren, inwieweit das auch mit TVs der anderen oben genannten Marken klappt, also gern intensiv testen und hier berichten.

Ein Beispiel für das Anlegen von Devices wäre define <name> VestelTVs BasicVestel <URL> [interval]

Nutzung ist in der Device Help beschrieben (allerdings noch nicht alles was implementiert ist, daher für die Parameter und Readings am besten mal schauen, was das Modul so anbietet)

LuckyDay


eki

 :-[ Ups, das ist tatsächlich ein bisschen wenig (kommt davon wenn man Forenbeiträge mit dem iPad erstellt). Jetzt sollte es passen (siehe oben).

Hornsk001

Hallo, das ganze funktioniert alles mit den alten Vestelboards. Bei den das Port 1986 offen ist. Bei den neuen TVs sind die neuen Vestelboards zb. mb211s mb230 ist das Port 1986 geschlossen und wird nicht funktionieren. Für die neuen Vestelboards empfehle ich die Fernbedienung von hier im Forum, kopernikus hat hier im forum eine gute Beschreibung bereitgestellt.

LG Hornsk

eki

Der Teil mit den Keyboard Funktionen ist auch in dem Modul implementiert Das Modul nutzt sowohl den TCP Port als auch HTTP mit dem Port 56789 (und auch den könnte man konfigurieren).
Falls Du zu den neuen Vestel Boards weitere Informationen hast (gibt es einen anderen Port, das könnte man per attribut bzw. per neuem TV Type einstellen), lass es mich wissen, ob es offene Ports gibt, und welche, könnte man auch über einen Portscan heraus bekommen.

Hornsk001

Ja hab ein Portscan gemacht siehe Anhang, das ist von einen Vestel mb211s wo es bis heute auch noch nicht möglich war über irgend ein Port Telnet frei zu schalten wie es bei den alten über 1986 möglich war.

eki

über attr tcp_port kannst Du angeben, welchen Port das Modul für die Anfragen per tcp nutzt. Eventuell einfach mal alle offenen Ports ausprobieren. Es gibt wohl auch noch eine Möglichkeit per Websocket zu horchen, das ist im Modul aber aktuell lahmgelegt. Klappen denn die Kommandos wie volumeUp, die per http weiter gegeben werden?

Hornsk001

Ja was ich vorher schon geschrieben habe mit der Fernbedienung in fhem über das Port 56789. Damit kann ich alles am TV steuern .

eki

Klar, das geht und ist auch OK, wenn Du nur fernsteuern willst. Allerdings ist das eine Einbahnstraße, Du bekommst nicht mit, was der Status des TVs ist etc. das kann das Modul. Es holt den Status vom TV und bindet das als Readings in FHEM ein.
Daraus kann man dann z.B. das Ganze in FTUI einbinden. Siehe Beispiel.
Ich habe auch noch mal eine neue Version oben eingefügt, die noch ein paar weitere Readings kann.

benedikt-wue

Hi,
würde das Modul gerne mit meinem Toshiba Tv ausprobieren. Die Datei habe ich in /opt/fhem/FHEM veschoben... durch reload 82_VestelTVs 2.pm bekomme ich aber eine Fehlermeldung und ich kann den define - Befehl nicht ausführen...
Wo liegt mein Fehler?

eki

Das ist beim Anhängen ein Fehler passiert. Bitte benenne das herunter geladene Modul in 82_VestelTVs.pm um und lade es mit

reload 82_VestelTVs.pm

sorry. Ich werde das oben korrigieren.

benedikt-wue

Ah okay, Danke! Leider funktioniert das Modul bei meinem Modell (Toshiba 40L7363D) nicht, aber dafür kann ja das Modul nichts :-D

eki

Was heißt denn "funktioniert nicht". Was Du mal schauen kannst, ist, ob die "remot control" Befehle gehen (z.B. volumeUp, volumeDown).

benedikt-wue

im CSTATE steht, dass FHEM nicht verbinden konnte mit der IP... laut einem Portscanner ist wohl auch nur Port 8080 offen... ein Aufruf im Browser scheitert ebenso... evtl ist der TV zu alt? Konnte über google jetzt auch nichts herausfinden, welches Vestel - Board verwendet wird. remote - Befehle funktionieren dementsprechend auch nicht.
edit: bin mir nicht ganz sicher, aber der Port 51589 scheint auch offen zu sein... zumindest kann ich da im Browser etwas öffnen, was aber mit einer Steuerung auch nichts zu tun hat :-)

Media Renderer Administration

Change Service Friendly Name
Changing the Friendly Name will automatically restart the Service. Restarting the service may terminate any playback in progress.

Note: You can use the %hostname% variable as a placeholder for the actual device hostname.

New Friendly Name:


Restart Service
Restarting the service may terminate any playback in progress.


Der Aufruf 102.x.x.x:18784 bringt folgendes:

https://front-eu.tsbctv.com/tc-osk-tv/ckeyboard.html
file:///applications/MWB/html/ui/watching-tv/watching-tv.html
https://front-eu.tsbctv.com/tc-front-tv/cindex.html#hidden
about:blank
file:///applications/MWB/html/ui/common/middle/default.html#
file:///applications/MWB/html/ui/common/top/top.html
file:///applications/MWB/rootApp.html
http://hbbtv.redbutton.de/service/redbutton.php?brand=p7de


karpate

Hallo,
ich habe einen Telefunken D32H289N4CW (Vestel).

Leider zeigt nach
define Telefunken VestelTVs BasicVestel 192.168.XXX.XXX 60

CSTATE Couldn't connect to 192.168.XXX.XXX:1986

Im Log finde ich folgende Meldungen
2021.01.20 16:03:20 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at ./FHEM/82_VestelTVs.pm line 755.
2021.01.20 16:03:20 1: PERL WARNING: Use of uninitialized value $buf in string ne at ./FHEM/82_VestelTVs.pm line 760.

Installiert und aktuell sind die Module libio-socket-ssl-perl und iputils-ping die anscheinend die Modul IO::Socket::INET und NET::Ping ersetzen.

Jemand einen Tipp?
Danke und Gruß
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Die Meldungen sind nicht kritisch, nur Warnungen (da habe ich vergessen einen Fall richtig abzufangen).

Um das Ganze einzugrenzen, folgende Frage:
Hast Du mal probiert, ob die "Fernbedienungsbefehle wie z.B. VolumeUp VolumeDown etc. etwas bewirken?
Wird das Statusreading erzeugt und beim Ein-/Ausschalten aktualisiert?

Hintergrund: Das Modul kommuniziert auf zwei (oder sogar drei) Weisen mit dem TV.

  • Erstens indem Anfragen auf einen tcp Port (Standardmäßig 1986) und entsprechende Antworten verarbeitet werden (zu Readings im Allgemeneinen). Das geht über ein Socket und benutzt IO::Socket::INET (das muss also installiert sein)
  • Zweitens indem über HTTP auf einem anderen Port Befehle geschickt werden (dort gibt es kein Feedback). Das sind die Befehle, die die normalen Fernbedienungskommandos simulieren. Das geht über die in FHEM implementierten HTTPUtils
  • Es werden pings auf die IP Adresse geschickt, um den Status des TVs abzufragen. Das geht über NET::Ping und daher muss für den Status auch das installiert sein.

karpate

Hallo eki,
schnelle Rückmeldung: VolumeUp VolumeDown wird nicht ausgeführt, sowie keine Aktualisierung des Status beim Ein/Auschalten.

Gruß Ingo
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Das hinterlässt mich etwas ratlos. Du könntest mal einen Portscan auf die IP des TV machen, um zu sehen, ob überhaupt, und welche Ports offen sind.

karpate

Hallo eki,

der Portscan sagt, das eine Netzwerkkarte [Vestel Elektronik San ve Tic. A.S.] eingebaut ist und folgende Ports geöffnet sind:
2870,4660,4725,7382,7681,9080,34016

Gruß Ingo
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Dann kannst Du mal versuchen, die Ports mit

attr <Name> http_port <Portnummer>

bzw.

attr <Name> tcp_port <Portnummer>

zu setzen und dann schauen (am besten auf DEF bei den Internals clicken und das dann per modify DEF abspeichern), ob sich was tut. Beim http immer volumeUp oder so probieren, bei den tcp Ports immer warten, ob sich der Status bzw. CSTATE ändert.

karpate

Danke für die Tipps:
egal welchen tcp_port ich setze, der status wird aktualisiert und der TV wird als connected angezeigt.
Bei http_port ist egal welchen Port ich setze, bei keinem hat ein Volume Up/Down funktioniert.
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Um mal grundsätzlich zu schauen ob der TV überhaupt irgendwas in der Richtung unterstützt, könntest Du mal die Telefunken Smart Remote App ausprobieren.

karpate

Ich habe diese App https://play.google.com/store/apps/details?id=com.telefunken.SmartRemote&hl=de&gl=US installiert. Den TV hat sie automatisch anhand der IP gefunden und eine Verbindung hergestellt. Grundsätzlich scheint das zu funktionieren.
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki


karpate

# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Was ich noch anbieten könnte, wäre, mal das websocket interface noch mal zu aktivieren, vielleicht funktioniert das ja bei Deinem TV, bei mir hat das nicht funktioniert und deshalb habe ich es lahmgelegt. Das kann ich aber bie mir nicht testen, deshalb würde ich es nur machen, wenn Du lust hast da ein bisschen zu "forschen". Das heiißt, ich probiere ein paar Sachen im Code und Du testest es an Deinem TV und sagst mir was passiert. Das wäre zugegeben ziemlich remote und würde sicher auch nicht gleich zum Erfolg fürhren. Ich mache das aber nur, wenn Du Lust hast (braucht womöglich ein bisschen Geduld und Durchhaltevermögen  ;)). Wenn Du keine Lust hast, bin ich auch nicht  böse.

karpate

ja gerne, wenn du eine Chance siehst den TV anzubinden würde ich dich gerne unterstützen.
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Na dann probiere mal die angehängte Version. Wenn irgendetwas mit dem Websocket klappt, dann sollten Informationen in ein Reading "ws_answer" laufen. Der verwendete Port kann mit attr <name> ws_port <nummer> geändert werden.

karpate

angehängte Version habe ich neu geladen mit
reload 82_VestelTVs.pm

anschließend kam gleich die Meldung
Bareword "TV" not allowed while "strict subs" in use at ./FHEM/82_VestelTVs.pm line 665.
syntax error at ./FHEM/82_VestelTVs.pm line 666, near "now
my "
Global symbol "$client" requires explicit package name (did you forget to declare "my $client"?) at ./FHEM/82_VestelTVs.pm line 666.
Global symbol "$client" requires explicit package name (did you forget to declare "my $client"?) at ./FHEM/82_VestelTVs.pm line 668.
Global symbol "$client" requires explicit package name (did you forget to declare "my $client"?) at ./FHEM/82_VestelTVs.pm line 670.


Im Log wurden folgende Warnungen protokolliert:
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Initialize redefined at ./FHEM/82_VestelTVs.pm line 174.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Define redefined at ./FHEM/82_VestelTVs.pm line 214.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Cleanup redefined at ./FHEM/82_VestelTVs.pm line 257.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Shutdown redefined at ./FHEM/82_VestelTVs.pm line 263.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Undef redefined at ./FHEM/82_VestelTVs.pm line 278.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Get redefined at ./FHEM/82_VestelTVs.pm line 293.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Set redefined at ./FHEM/82_VestelTVs.pm line 325.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Attr redefined at ./FHEM/82_VestelTVs.pm line 451.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Notify redefined at ./FHEM/82_VestelTVs.pm line 493.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_ResetNotifies redefined at ./FHEM/82_VestelTVs.pm line 531.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_TryPorts redefined at ./FHEM/82_VestelTVs.pm line 546.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_SendKey redefined at ./FHEM/82_VestelTVs.pm line 592.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_GetTVSetting redefined at ./FHEM/82_VestelTVs.pm line 616.
2021.02.01 09:56:39 1: PERL WARNING: Subroutine VestelTVs_Callback redefined at ./FHEM/82_VestelTVs.pm line 627.


Ich habe alle Ports (2870,4660,4725,7382,7681,9080,34016) als "attr ws_port" durchprobiert. Bei keinem wurde ein Readings "ws_answer" erzeugt....
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Ups sorry, ich habe ein # zu viel entfernt. Neue Version anghängt. Die Warnungen im Log sind normal, kommen vom reload.

karpate

ok, ich bekomme im Log jetzt diese Fehlermeldungen. Liegt es daran das ich IO::Socket::INET nicht installiert habe?

2021.02.01 12:01:29 3: FHEMWEB WEB CSRF error: csrf_178160564574627 ne csrf_129642894740473 for client WEB_192.168.X.XXX_55464 / command modify TelefunkenTV BasicVestel 192.168.X.XXX 60. For details see the csrfToken FHEMWEB attribute.
Can't locate object method "new" via package "AnyEvent::WebSocket::Client" (perhaps you forgot to load "AnyEvent::WebSocket::Client"?) at ./FHEM/82_VestelTVs.pm line 666

# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki


karpate

Sorry, bin erst heute wieder dazu gekommen...

Zunächst cpan installiert mit
cpan App::cpanminus
anschließend websocket:client installiert mit
cpanm AnyEvent::WebSocket::Client

Nach Reload reload 82_VestelTVs.pm kommt im Log diese Meldung und fhem startet neu:

Can't locate object method "new" via package "AnyEvent::WebSocket::Client" (perhaps you forgot to load "AnyEvent::WebSocket::Client"?) at ./FHEM/82_VestelTVs.pm line 666.


Muss ich den Server neustarten (momentan nicht möglich) oder irgendwie laden?
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Grrr. Sorry, ich hatte noch vergessen eine Zeile wieder zu aktivieren. Anbei die korrigierte Version.

karpate

kein Problem, habe die angehängte Version mit allen Ports mit attr "ws_port" durchprobiert und jeweils ein VolumeUp versucht. Leider nirgends eine Reaktion. Das "Positive" ist, ich habe auch keine Fehlermeldungen im Log...

Dann habe ich Verbose=5 eingestellt. Vielleicht kommst du mit den Meldungen weiter....
Gruss

2021.02.08 16:43:58 5: Telefunken: Event received from device global (events are: ATTR Telefunken verbose 5)
2021.02.08 16:44:19 5: Telefunken: Event received from device Telefunken (events are: chlist_loaded: 0)
2021.02.08 16:44:19 4: VestelTVs (Telefunken) - connecting TCP with 192.168.6.18:7382
2021.02.08 16:44:19 5: Telefunken: Event received from device Telefunken (events are: state: on)
2021.02.08 16:44:19 4: VestelTVs (Telefunken) - connecting websocket via AnyEvent::WebSocket::Client=HASH(0x556d97718130) with 192.168.6.18:34016
2021.02.08 16:44:19 5: VestelTVs (Telefunken) - WriteFn called
2021.02.08 16:44:19 5: VestelTVs (Telefunken) - GETVOLUME
2021.02.08 16:44:19 5: VestelTVs (Telefunken) - ReadFn started IO::Socket::INET=GLOB(0x556d978249d8)
2021.02.08 16:44:19 1: PERL WARNING: Wide character in print at fhem.pl line 992.
2021.02.08 16:44:19 4: VestelTVs (Telefunken) - Read from IO::Socket::INET=GLOB(0x556d978249d8) returned &)%)")')()!)V
)� ))), with length 440
2021.02.08 16:44:19 5: Telefunken: Event received from device global (events are: MODIFIED Telefunken)
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Tja, das Log zeigt zumindest, dass auf dem TCP socket etwas passiert und dass der TV auch etwas antwortet. Da scheint aber nichts lesbares zu sein sondern nur irgendwelche komischen Zeichen. Ich versuche mal über mögliche Gründe nachzudenken.

Auf dem Websocket scheint erstmal nichts zu passieren, oder entdeckst Du ein Reading mit Namen ,,ws_answer"?


karpate

Zitat von: eki am 08 Februar 2021, 17:35:27
Auf dem Websocket scheint erstmal nichts zu passieren, oder entdeckst Du ein Reading mit Namen ,,ws_answer"?

Sorry, habe ich vergessen zu erwähnen. Es wurde keine neuen Readings angelegt auch nicht "ws_answer"
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Irgendwie ist das alles ein bisschen viel geraten.

Hast Du schon mal Wireshark benutzt? Falls ja, könntest Du mal Deinen Netzwerkverkehr aufzeichnen während Du das remote tool aus dem appstore nutzt (das ging ja, hattest Du gesagt), das dann auf die IP des TVs filtern (Quell- und Zieladresse) und das gefilterte Ergebnis aus Wireshark exportieren und mir das dann per PM schicken (natürlich nur, falls Du das willst, private Infos würde ja durch das Filtern entfernt).

karpate

ok, werde ich versuchen zu protokollieren. Werde aber vorraussichtlich erst am Freitag dazu kommen....ich melde mich wieder...Danke für die Geduld und Durchhaltevermögen ;)
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

karpate

Ich bin erst heute dazu gekommen mit Wireshark zu versuchen den Netzwerkverkehr zu protokollieren. Vermutlich mache ich etwas falsch, da ich im Protokoll keine Einträge mit der IP des TVs entdecken konnte auch wenn ich mit der Telefunken App Programm wechsel, Volume Up/Down, Stumm schalte...
# Pi3 (BBB;FB7390)
# TCM310, CUL V4, HM-CFG-LAN,JeeLink,Tradfri,ESP32-Cam@MQTT: Wasseruhr

eki

Dazu kann ich aus der Ferne nicht so viel sagen. Du musst schauen, dass Du die Traces auf der richtigen Schnittstelle sammelst (also die Schnittstelle, über die auch der TV kommuniziert In dem Fall wahrscheinlich WLAN).

ryonchev

Hallo eki,

Ich habe JVC TV model LT-32V750 (by Vestel). Ich habe das Modul ausprobiert und alles funktioniert.
Ports: tcp (default-1986), http (56791)

... Entschuldigung, aber mein Deutsch nicht so gut ist, so auf English  :-[

I noticed the following:
1. Key codes (0-9) in my case are 1000, 1001.... 1009. Your module sends codes 0000 to 0009. Probably this could be also chosen via attributes.
2. After turning TV off, there is no way to wake it through FHEM. After waking TV from remote control - no problem, everything is ok.
3. It will be good if you can add automatic generation of remote control and corresponding notify in your script. It is hard to work with dropdown menus

Otherwise all is perfect, i.e. Sehr Gut gemacht  ;D

Gruss

eki

Nice to hear that it works with your TV. I will check how to realize the mentioned changes. For the wake up I have to check. Does your TV support WOL (wake on LAN)?

ryonchev

The TV is on WiFi not on LAN. Probably this is the problem. But I also have another TV - Philips, also on WiFi and there is no  problem to wake it from FHEM (module 70_PHTV). Of course this doesn't mean that Vestel have the same function, but there is walk around - I can use remote (smart) wall-plug (I have a lot of them) to power on/off TV so that's actually not so big issue

PS. Remote control - the module 70_PHTV automatically generates remote control and notify when you define your TV. Probably you can use the same code with some modifications of course :)

eki

I have attached a new version which contains 2 changes:

1. Correction of the key values (this was simply a mistake and did not even work on my TV  :-[)
2. The Module now adds 2 layouts to remotecontrol devices. In order to get a remotecontrol you have to do the following:

Reload the Module (reload 82_VestelTVs.pm)
Create a remotecontrol (e.g. defmod myRemote remotecontrol)
Set the layout of the remotecontrol device (set myRemote layout VestelTVs_TV)
Connect the remotecontrol with the TV (set myRemote makenotify myTV) where "myTV" is the name of your TV device.

Could you check if this works for you and provide me feedback.

ryonchev

Creation of remote control and notify works perfect. One suggestion to layout - volume down is "vol -" and volume up is "speacker +" - it will be better if both are with vol or with speacker, i.e. "vol -"/ "vol +" or alternatively "speacker -" / "speaker +"

Buttons youtube and netflix are empty here - obviously no icons - where I can get them?

Sending of commands - unfortuntely it doesn't work. I even cant send commands from the dropmenu of TV object. I'm not so much familiar with perl but looking your code I found this:

   foreach my $command (sort keys %VestelTVs_commands) {
      next if ($opt eq "on" and ReadingsVal($name,"status","off") eq "on");      # omit command if TV is already on
      next if ($opt eq "off" and ReadingsVal($name,"status","off") eq "off");      # omit command if TV is already off
      if ($command eq $opt) {
         my $key = $VestelTVs_commands{$command};
         Log3 $name, 5, "$name - Key: $key";
         VestelTVs_SendKey($hash,$key);
      }
   }
   if ($opt eq '_keydirect') {
      VestelTVs_SendKey($hash,$value);
   }

   return undef;

This is at the end of VestelTVs_Set($@). I think if statement should be before foreach and when it is before there should be also "return undef;" inside if statement.
Maybe it is not correct - as I said - not so familiar with perl

Will try to figure out what is happening tomorrow with "event monitor" and log...

eki

I tested the version with my TV and it worked. So I doubt that it has something to do with that part of the code. I can do some more checks tomorrow.

One more question: Did it work before at all in the direction of sending commands to the TV (this is done in a complete different way compared to getting TV status information).

ryonchev

I never managed to get TV status information, but before at least sending of commands was working. In general this is enough for me.
Last night when I tested the new file from you I was not able to send commands, but I saw notifications are correct.
I think there is some issue with the ports...
In google play store there is app Smart Remote Control for Vestel. I discovered it autodetects TV as soon as TV is turned on. I decompiled the application and found class TVDetector. It seems it posts some data to port 1900 and/or port 4950 (although these ports are reported closed by nmap) and from the response it takes the correct ports. I will try this later today.
I also found python program on Github for this TV - http port is the same which I use - 56791, but status port is 56792 and the guy reads from this port file named dd.xml - the same thing I found and in android apk

Will make additional tests and will post the results

PS: Thank you for the fast implementation of key codes correction and automatic remote control generation :)

eki

I know the software you are referring to. The python program more or less was the initial part I was starting with when I did the module. I tried also the websocket connection but it was not working on my TV and so I deactivated it. The detection on Port 1900 is something I did not try, I would be interested in your findings and I can try to adapt the module accordingly.
There is a function in the Module called VestelTVs_TryPorts this function configures the connectivity to all known ports (the ones that I got when doing nmap with root rights) and tries a connection. You could set a high verbose level, run this function (set <name> tryports) and send me the resulting log, may be I find something in there.

ryonchev

Hallo eki,

1. Probably it was my mistake while testing your new module - today without doing anything the module works perfectly, remote control also. Probably after reload of the module manual disconnect/connect should be done also - not sure, but today wotks. Im still not able to get TV status. Definitely http port in my case is 56791. If I change it to something else remote control and commands from drop down menu stop to work.
2. To receive TV status I suppose tcp port should be correct. I tried all ports available but without success. Yes I tried your port scanner but not so much info (Log of this try attached). While testing I also tried a file few posts above not the one from the first page. I suspect there was something left from web sockets because I received some readings  like mute ON/OFF and energysaving, but only this. This module was working fine for about few hours then (probably when I turn on my TV) FHEM server continuously restarted because Anyevent module was not installed. I installed it, but in the same moment I saw your new module and decided to test it... So probably my TV works via web socket.
3. Android apk - I converted it to jar file which is better readable with jd-gui, reading smali files is not my favorite :). Will attach jar file and jd-giu (windows). Inside jar file you can take a look in com->vestel.supertvcommunicator->TVDetector. What I found there is interesting but doesn't work with my TV (I tried this with curl). However if app is running on your phone or tablet, few seconds after Vestel TV is turned on it displays the IP address of the TV. This will be good feature for your module and I will continue to work on this, since this could solve all problems with ports :)


Edit: After some more tests -
Zitat
Offline eki
Developer
Hero Member
****
Posts: 1275
View Profile Personal Message (Offline)

Antw:Neues Modul VestelTVs für verschiedene TVs (Telefunken, Graetz, Toshiba, Medion)
« Reply #29 on: 01 February 2021, 11:40:00 »
Quote
Ups sorry, ich habe ein # zu viel entfernt. Neue Version anghängt. Die Warnungen im Log sind normal, kommen vom reload.
* 82_VestelTVs.pm (49.41 kB - downloaded 2 times.)

with this version of the module I receive some readings, but only after execution of the command. Now I have installed module Anyevent and FHEM does not restart anymore. I saw, you commented almost everything connected with websocket - will uncomment everything and will try it tomorrow

eki

When you want to "activate" websocket, you have to uncomment line 44 and remove lines 747 (=a) and 785 (=cut) in the latest version of the module. If websocket provides any information, there should appear a reading called ws_answer. It would be interesting if on your TV such a reading appears with websocket activated and what kind of content the reading has. You can also play around with the port by setting the attribute ws_port.

ryonchev

Some more tests done. I think there is something wrong with the module:
1. I enabled web socket connection in VestelTVs_Connect (and uncommented line 44 also). I run tryports. In this case web socket connects, but read function is always tcp reading. I cannot find reading function for web socket in the module.
2. I disabled tcp connection in VestelTVs_Connect and run again tryports and of course reading was not possible anymore

According to android apk the TV can be either tcp or web socket, but cannot be both. Also according to the same app remote control commands are always send via http. So I suggest you if ws_port is set always establish ONLY web socket connection. If ws_port is not set always establish tcp connection. Of course read function for web socket also should be added



Meanwhile I figured out how auto TV detection works:
1. We are asking the network if host with ip 239.255.255.250 is known. If yes this could be Vestel TV model MB100 (this MB seems to be internal Vestel's designation of models). Then message "M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: \"ssdp:discover\"\r\nMX: 10\r\nST: urn:dial-multiscreen-org:service:dial:1\r\n\r\n" is sent to http://239.255.255.250:1900. I don't know how this works because I don't have such TV and I don't know whether phone (or tab) changes wifi network, but it seems this model TV makes his own access point - the answer from the TV (if any) is compared if starts with "ap0". If there is an answer probably it contains some important info. If there is no answer - not Vestel TV
2. The app scans all clients on current network and tries to establish Telnet connection on port 1986. This means that all Vestel TVs should allow such connection on this port. If no connection - no Vestel TV. If connected simple command like GETVOLUME is isuued. If there is response - TCP Vestel TV. If there is no response the TV is tested for MB90 model - message "vr_query_tv_version_782" is posted to http://ipaddress:4950. If there is response it is MB90 model. I dont know what response contains - I don't have such TV either. If there is no response the TV is tested for web socket TV - it seems the port is always 7681, but I cannot be sure until more people confirm it
3. IP addresses which are not Vestel TVs are stored in something like "blacklist". The app continuously scan for new ips (TV just switched on) and performs steps 1 and 2 above. IPs from blacklist are never scanned again. Blacklist is not stored on sdcard, just in memory, so if you restart app it will scan again all clients of current network - this solves the problems with DHCP and TV can change ip address.

If your TV is TCP you should be able to establish telnet connection via PuTTY (for instance) on port 1986 and then in the command line to give directly commands to TV.

If more people can confirm my findings will be perfect.

So finally eki, according to the above algorhytm my TV should b web socket and not TCP. As I wrote above TV is either TCP or web socket, but never both, so either TCP connection should be established or web socket, but not both.

I hope this will help :)

PS. I forgot to explain, but all probing described above should be timeouted in case post command is successful but there is no answer. For those who like to test here are messages using curl:

For MB100:
curl -v -X POST -d "M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: \"ssdp:discover\"\r\nMX: 10\r\nST: urn:dial-multiscreen-org:service:dial:1\r\n\r\n" http://239.255.255.250:1900

For MB90:
curl -v -X POST -d "vr_query_tv_version_782" http://ipaddress:4950
Change "ipaddres" accordingly.

For TCP TV - just use PuTTY (windows) or telnet. When connected try GETVOLUME - if no response - not TCP TV

The conclusion is (according to the app and for this moment - I don't know what Vestel will do in future :) ): It seems that TCP TV's are always on port 1986 and web socket TV's are always on port 7681, but this should be proved by more users. At least it is firm that telnet connection on port 1986 should be always available. HTTP connection is another issue, but usually http ports are the high ports (above 50000) so it is easy to try them.

eki

OK, I think I have to digest all the information (thanks for finding out all this).

Just for your information, what the standard module does currently:

1. It sends pings to the IP address of the TV (the one you specify when you define the module in FHEM) regularly (when INTERVAL is greater than 0 every <INTERVAL> seconds the default for INTERVAL is 300 so every 5 minutes). When it gets a positive answer for the ping, it assumes the TV to be on else off and sets the according reading. This means that even without all the stuff you mention, the module should be able to at least check if the TV is on or off (maybe you have to change the interval attribute to get a fast answer).

2. When you enter a remote control command (like volumeUp) it sends the key behind this command via HTTP (on port 56789 by default but can be changed by setting attribute http_port). This is done instantaneously, no relation to the interval setting here. This should normally work independantly from the other connections.

3. It regularly at the same timing as for the pings establishes a TCP connection (tcp socket connection) (on port 1986 by default, but can be changed by attribute tcp_port) and sends requests for information to the TV over this connection. When there is a valid reply it converts the information into reading status information (e.g. current channel etc.). As the commands for this question and answer game I use the information at (https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiYiLDun5TvAhXC6qQKHYFcA3cQFjAAegQIARAD&url=https%3A%2F%2Fwww.vestelvisualsolutions.com%2Ffiles%2Fvestel-visual-solutions-rs232-lan-customer-control-v1-1-d13c7b454990_9ABE26049440.pdf&usg=AOvVaw0ZGGRuN-heUOnX3AonTjoo)

4. If you uncomment the websocket part, it additionally activates a websocket connection (on port 7681 by default but can be changed with the attribute ws_port). It listens to this port and currently, whenever there is a message on this port received, it enters the result in the reading ws_answer. In the websocket case there is no question/answer game, the socket is open and whenever there is a message, a callback is entered (line with code "$connection->on(each_message => sub {" ) so there is no "reading function". I would need to parse the result and transfer it to readings, but I do not have any information how yet (would need at least an example of any answer).

I think http, tcp and ws connections can be open in parallel, but if the TV is either/or tcp and websocket respectively, it will only get results from one or the other. If there is a kind of blocking of tcp and websocket and vice versa, you could try to only activate websocket   by commenting out the lines 728 to 740.

ryonchev

ok. I see your logic and it seems correct unless tcp port and web socket port are one and the same, but as I already know this is not the case, so it should work. I have the same document (the link you posted) so I know this part is correct.
Independently I made simple tests with telnet and websocat on all ports. Both are not connecting on high ports (above 50000), so these are definetely http ports. websocat do not connect on port 2870 also, but connects to all other ports. On each connection I try the command GETVOLUME (telnet & websocat connection). Unfortunately there is no answer anywhere.

The problem is that according to android apk web socket connection with TV is secured (wss://). Probably due to this reason I don't have an answer. In the jar file which I posted yesterday - look into com->vestel.supertvcommunicator->WebSocketClient.class

Also it seems that request which should be posted is not plain text. WebSocketClient uses HybiParser and on first look the request (and an answer also) is in binary form as array of bytes.
But connect function of WebSocketClient is very interesting!

PS. As I mentioned in one of my previous posts working remote control is enough for me. If you think it is good to dig more and more and make module better I can help - unfortunately writing code on perl is not my strong side, but can help with debuging, testing, reverse engineering of known soft etc.

ryonchev

After more tests I discovered there is no way to receive TV status with android apk (not supported), so probably my TV just doesn't support this function regardless tcp or web socket connection...
But somehow I received some answers for some events (see the attached picture). Im not able to reproduce these events right now... I don't know what is going on..

But Im happy with the module. I just added to define function calls to remote control generation and notify generation. in my case the missing name/parameter is "RC".$name, so now when you define TV additionally remote control and notify are generated automatically.

eki, I still stand behind my previous post and if I should help with something - just tell me how.

eki

ZitatBut somehow I received some answers for some events (see the attached picture). Im not able to reproduce these events right now... I don't know what is going on..

As said, the status reading (on/off) is updated based on the ping as well. The chlist_loaded reading is also entered by the module. The others might come from settings you made, whenever you set some parameter with the set command, this value is entered in a reading as well, even when no status messages are received from the TV.

KölnSolar

Hallo Eki,
ich grätsch hier mal rein. Vielleicht hast Du ja mitbekommen, dass ich gerade versuche das Thema UPnP in FHEM zu vereinheitlichen. Insbesondere TVs verfügen in der Regel über das UPnP "subset" DLNA. Damit lässt sich hervorragend das Thema "presence" und in der Regel Volume-Steuerung und Streaming bedienen. Darüber hinaus gehende "features"(wie z.B. remotecontrol) sind in der Regel herstellerspezifisch und müssen in spezifischen Modulen wie Deinem realisiert werden.

In meinem Thread kann man aktuell das Medion-Bsp. verfolgen. Bisher funktioniert scheinbar presence u. Status-Meldungen. Gerade hakt es bei den actions.(das aber nur als Randinfo).

Auch hier im Thread wird ja DLNA angesprochen
ZitatWe are asking the network if host with ip 239.255.255.250 is known. If yes this could be Vestel TV model MB100 (this MB seems to be internal Vestel's designation of models). Then message "M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: \"ssdp:discover\"\r\nMX: 10\r\nST: urn:dial-multiscreen-org:service:dial:1\r\n\r\n" is sent to http://239.255.255.250:1900.
und ich sah, dass Du presence per ping prüfst.

Wenn Du Dir mein SamsungAV anschaust, siehst Du wie ich in einem 1. Ansatz versucht habe das unter einen Hut zu bringen: Definition im herstellerspezifischen SamsungModul mit dem optionalen DLNARenderer-device. Dadurch kann der User in DLNA-Standard streamen. Genervt hat "aktuell" auch bei mir die presence-Prüfung. Ein periodischer ping ist da nichts Halbes u. nichts Ganzes. Deshalb wollte ich auch dafür DLNA nutzen, denn es ist doch viel schöner, wenn der TV FHEM sagt in welchem state er sich befindet, als dass wir in mühsam u. zeitlich ungenau "befragen".  Wie so oft kam es etwas anders und ich hab mich nun auf den weiten Weg gemacht, UPnP in Gänze aufzuarbeiten/vereinheitlichen, den DLNARenderer damit abzulösen u. als letzten Schritt dann mein Samsung-Modul auf Vordermann zu bringen.

Da Deine Modulentwicklung noch relativ jung ist, fänd ich es prima wenn Du einen ähnlichen Weg einschlagen würdest bzw. mal meine UPnP-Neuentwicklung austestest, denn mit dem UPNPController bekommt man einfach u. schnell eine erste Information, was ein TV mit DLNA unterstützt. Kannst ja ggfs. in meinem UPnP Thread antworten, um diesen Thread nicht mit "Technik" zu "belasten". ;)

Schönes WE
Markus
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-GT-TMBBQ-01e-CUL868-FS20-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty_Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)-zigbee2mqtt

eki

Danke Markus für die Info. Ich schau mir das mal an, klingt vielversprechend. Kann aber ein bisschen dauern weil ich aktuell nicht an den TV rankomme.

ryonchev

Hallo eki,

I continue with the tests with my TV to get status, but for now no success. Probably not supported - my TV is 2015 model... If there is something new will inform you.

About remote control - can you tell me where I can find these files: black_btn_YOUTUBE.png and black_btn_NETFLIX.png - they are empty here. I searched the net but no success. Please send a link if you have. And if you have them probably will be easier to post them here - will appreciate.

Thank you, Danke!