[82_LGTV_WebOS.pm] Modul für LG TV's mit WebOS

Begonnen von CoolTux, 08 Februar 2017, 00:02:58

Vorheriges Thema - Nächstes Thema

eisman

#1395
bis jetzt schaut es gut aus, ich beobachte das nochmal 10 min

state on 2022-01-05 18:51:17 18:57 keine Meldung state on
1x FHEM Debian, Homematic,ZigBee,FS20 / 1X Raspberry, ConBee / 5x ESP
1x FHEM Debian, Homematic,ZigBee         / 1X Raspberry, ConBee / 5x ESP
1x FHEM Debian,MQTT                               / 1X Raspberry, i2c,onewire,gpio
1x auf Windows 2012 Hyper-V-S

CoolTux

Zitat von: mumpitzstuff am 05 Januar 2022, 18:40:21
Habe ich gemacht. Bringt leider nichts. Ich muss mich jetzt um die Kinder kümmern und probiere nachher noch mal weiter rum.

Ich danke Dir.
Habe an der Funktion sonst eigentlich nichts geändert.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

eisman

On wurde jetzt nochmal neu gesetzt 19:01
sonst nichts auffälliges
1x FHEM Debian, Homematic,ZigBee,FS20 / 1X Raspberry, ConBee / 5x ESP
1x FHEM Debian, Homematic,ZigBee         / 1X Raspberry, ConBee / 5x ESP
1x FHEM Debian,MQTT                               / 1X Raspberry, i2c,onewire,gpio
1x auf Windows 2012 Hyper-V-S

Invers

ok, lassen wir das Thema Ein/Aus erst einmal aussen vor.
Geht nun übrigens wieder, dauert aber verdammt lange. Vorsichtshalber habe ich dir mal das Log mit Verb.4 angehängt.
Zo gross für Forum, daher Datei
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

Invers

Vergiss es, scheint wieder normal zu laufen. Sonderbar.
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

mumpitzstuff

#1400
$tmp = "PING 192.168.178.59 (192.168.178.59) 56(84) bytes of data.\n64 bytes from 192.168.178.59: icmp_seq=1 ttl=64 time=0.739 ms\n64 bytes from 192.168.178.59: icmp_seq=2 ttl=64 time=0.689 ms\n\n---\n192.168.178.59 ping statistics ---\n2 packets transmitted, 2 received, 0% packet loss, time 9ms";

if ( defined($tmp) && $tmp ne "" ) {

    chomp $tmp;
   
    if (($tmp =~ /\d+ [Bb]ytes (?:from|von)/ && $tmp !~ /[Uu]nreachable/x)) {
      $response = "present";
    } else {
      $response = "absent";
    }
}

print $response;


sub LGTV_WebOS_PresenceRun {
    my $string = shift;
    my ( $name, $host ) = split( "\\|", $string );

    my $tmp;
    my $response = "$name|";

    $tmp = qx(ping -c 3 -w 2 $host 2>&1);

    if ( defined($tmp) && $tmp ne "" ) {

        chomp $tmp;
        Log3( $name, 4,
            "LGTV_WebOS ($name) - ping command returned with output:\n$tmp" );

        if (($tmp =~ /\d+ [Bb]ytes (?:from|von)/ && $tmp !~ /[Uu]nreachable/x)) {
            $response .= "present";
        } else {
            $response .= "absent";
        }

        Log3( $name, 4,
            "LGTV_WebOS ($name) - response:\n$response" );
    }
    else {

        $response = "$name|Could not execute ping command";
    }

    Log3( $name, 4,
"Sub LGTV_WebOS_PresenceRun ($name) - Sub finish, Call LGTV_WebOS_PresenceDone"
    );

    return $response;
}


Damit gehts bei mir jetzt. In dem Testscript oben kann ich auch unreachable in den String schreiben und dann wird aus present absent.

CoolTux

Oh Man. Manchmal sieht man den Wald vor lauter Bäumen nicht. Vielen Dank für Deine Hilfe.
Ich habe eine neue Version ins Git geladen. Magst Du sie testen?
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

mumpitzstuff

Leider nur fast. Das eine x hinter dem ersten regex muss noch weg, dann gehts.

aus dem:

( $tmp =~ /\d+ [Bb]ytes (from|von)/x && $tmp !~ /[Uu]nreachable/x )

muss das werden

( $tmp =~ /\d+ [Bb]ytes (from|von)/ && $tmp !~ /[Uu]nreachable/x )

CoolTux

Zitat von: mumpitzstuff am 05 Januar 2022, 21:09:41
Leider nur fast. Das eine x hinter dem ersten regex muss noch weg, dann gehts.

aus dem:

( $tmp =~ /\d+ [Bb]ytes (from|von)/x && $tmp !~ /[Uu]nreachable/x )

muss das werden

( $tmp =~ /\d+ [Bb]ytes (from|von)/ && $tmp !~ /[Uu]nreachable/x )

OK. Vielen Dank. Ich ändere es gleich morgen früh und lade das dann noch mal ins Git.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

Invers

Diese Version schreibt mein Log wieder voll, Meldung alle 1ß Sekunden. Fernseher ist aus.
Habt ihr das nicht?
2022.01.05 21:22:00.594 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:00.595 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:10.598 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf
2022.01.05 21:22:10.700 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:10.701 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:20.705 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf
2022.01.05 21:22:20.807 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:20.807 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:30.811 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf
2022.01.05 21:22:30.913 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:30.914 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:40.915 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf
Pi3B+ mit SSD/ Bullseye | FB7590 AX | 12 x Dect200 | CUL433+868 | SDuino | HM-LAN | 3 x Heizung FHT + FKontakte | KeyMatic + 4 FB | HM Wandtaster 2-fach m. LED | 6 x Türkont. TFK-TI | HM-Bew.-Melder innen | 3 x Smoked. HM-SEC-SD-2

mumpitzstuff

Ist bei mir nicht, habe grad noch mal den Fernseher ausgeschaltet...

CoolTux

Zitat von: Invers am 05 Januar 2022, 21:26:27
Diese Version schreibt mein Log wieder voll, Meldung alle 1ß Sekunden. Fernseher ist aus.
Habt ihr das nicht?
2022.01.05 21:22:00.594 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:00.595 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:10.598 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf
2022.01.05 21:22:10.700 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:10.701 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:20.705 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf
2022.01.05 21:22:20.807 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:20.807 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:30.811 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf
2022.01.05 21:22:30.913 4: LGTV_WebOS (meinLGTV) Couldn't connect to 192.168.178.76:3000
2022.01.05 21:22:30.914 3: LGTV_WebOS (meinLGTV) - KeepAlive It looks like there no Data more response
2022.01.05 21:22:40.915 4: LGTV_WebOS (meinLGTV) - Baue Socket Verbindung auf


Gib mal bitte ein list
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

eisman

habe mal die version genommen

Internals:
   DEF        192.168.1.101
   FD         67
   FUUID      61d5c5f2-f33f-793a-ce44-e605324556dca28c
   FVERSION   82_LGTV_WebOS.pm:v3.4.1-s25389/2021-12-30
   HOST       192.168.1.101
   LAST_RECV  1641416265.53515
   NAME       UM7100PLB
   NR         521
   PARTIAL   
   STATE      on
   TYPE       LGTV_WebOS
   VERSION    v3.4.1
   READINGS:
     2022-01-05 17:23:31   3D              off
     2022-01-05 17:23:31   3DMode          2d
     2022-01-05 21:59:46   channel         15
     2022-01-05 22:00:21   channelCurrentEndTime 2022-01-06 21:55:00
     2022-01-05 22:00:21   channelCurrentStartTime 2022-01-06 21:00:00
     2022-01-05 22:00:21   channelCurrentTitle Law & Order: Special Victims Unit
     2022-01-05 21:59:46   channelMedia    Satellite Digital TV
     2022-01-05 21:59:46   channelName     NITRO
     2022-01-05 22:00:21   channelNextEndTime 2022-01-06 22:45:00
     2022-01-05 22:00:21   channelNextStartTime 2022-01-06 21:55:00
     2022-01-05 21:59:58   channelNextTitle Law & Order: Special Victims Unit
     2022-01-05 17:23:33   extInput_AV     connect_0
     2022-01-05 17:23:33   extInput_HDMI   1 connect_0
     2022-01-05 17:28:42   extInput_HDMI_1 connect_0
     2022-01-05 17:28:42   extInput_HDMI_2 connect_0
     2022-01-05 17:23:33   extInput_Komponente connect_0
     2022-01-05 17:23:33   extInput_Samsung connect_0
     2022-01-05 17:23:29   input           -
     2022-01-05 21:59:46   lastResponse    ok
     2022-01-05 19:13:25   launchApp       TV
     2022-01-05 17:23:19   lgKey           0260be4c970c3a3d77818fbeed7076cd
     2022-01-05 17:23:25   mute            off
     2022-01-05 21:59:46   pairing         paired
     2022-01-05 21:59:42   state           on
     2022-01-05 18:56:42   volume          10
   helper:
     lastResponse 1641416627
     wsKey      MTY0MTQxNjM4MS41MDIxMw==

     device:
       registered 1
       runsetcmd  0
       channelguide:
         counter    2
       inputapps:
         com.webos.app.externalinput.av1 AV
         com.webos.app.externalinput.component Komponente
         com.webos.app.hdmi1 HDMI_1
         com.webos.app.hdmi2 HDMI_2
         com.webos.app.hdmi3 Samsung
       inputs:
         AV         com.webos.app.externalinput.av1
         HDMI_1     com.webos.app.hdmi1
         HDMI_2     com.webos.app.hdmi2
         Komponente com.webos.app.externalinput.component
         Samsung    com.webos.app.hdmi3
Attributes:
   alexaName  Fernseher
   alexaRoom  Wohnzimmer
   alias      Fernseher
   channelGuide 1
   cmdIcon    on:general_an off:general_aus channelDown:rc_MINUS channelUp:rc_PLUS volumeDown:rc_VOLMINUS volumeUp:rc_VOLPLUS
   devStateIcon on:it_television@red:off off:it_television@gray:on
   genericDeviceType media
   group      Multimedia
   homebridgeMapping Mute=mute,cmd=mute,ValueOn=on,ValueOff=off,cmdOn=mute+on,cmdOff=mute+off
ChannelController:reading=channel,cmd=channel
   icon       it_television@#008000
   room       Wohnzimmer,device-Alexa,multimedia
   stateFormat state
   verbose    4
   webCmd     on:off


bei mir keine sichtbaren probleme
1x FHEM Debian, Homematic,ZigBee,FS20 / 1X Raspberry, ConBee / 5x ESP
1x FHEM Debian, Homematic,ZigBee         / 1X Raspberry, ConBee / 5x ESP
1x FHEM Debian,MQTT                               / 1X Raspberry, i2c,onewire,gpio
1x auf Windows 2012 Hyper-V-S

CoolTux

Ich habe soeben noch einmal eine Version zum testen hochgeladen. Bitte einmal schauen.

Vielen Dank
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

mumpitzstuff

Ich habe in den Änderungen gesehen, das keepAliveCheck freezes verhindern soll, wenn keine Daten mehr kommen. Werden diese freezes zufällig von sysread verursacht? Falls ja, gäbe es dafür eine Lösung mit IO::Select und der Funktion can_read.