Aktuelles TV-Programm in FHEM

Begonnen von Kuzl, 20 Oktober 2014, 20:41:43

Vorheriges Thema - Nächstes Thema

Mario67

Hallo,

da ich die Aktualisierung der Anzeige des aktuellen Programms fast ausschließlich durch das Neusetzen der Definition in der Detail-Ansicht der beiden HTTPMOD-Devices auslösen konnte, habe ich versucht die Ursache dafür zu finden.
Im Beitrag http://forum.fhem.de/index.php/topic,29269.msg220319.html habe ich beschrieben, woran mein Problem liegen könnte. Nachdem ich die dort beschriebene Änderung direkt im Modul vorgenommen habe (und natürlich ein reload 98_HTTPMOD.pm), aktualisiert sich die Anzeige gemäß dem verwendeten Intervall (und ich komme ohne Scripte und lokale Webserver aus).
Ich hoffe, dass es eine Lösung für die reguläre Version des Moduls geben wird.
Die Wahl des Wertes für den Timeout muss noch optimiert werden. 60 s sind schon ziemlich lang.
FHEM auf Raspberry Pi 4 mit CUL868, WMBUS,
FS20 ST, FS20 AS4-3, FS20 SU-2, FS20 DF, 1-Wire + RS-232: AB Electronics Com Pi RS232, Brandmelder + Fenster: AB Electronics IO Pi 32
BUDERUS GB142 über EMS/AVR-NET-IO, WESTAFLEX WAC250 über RS232, MySensors
mit fhem.cfg & includes glücklich

Kuzl

Scheinbar ist ja schon eine neue Version unterwegs und sollte all unsere Probleme lösen :)

Tommy82


Zitat von: Kuzl am 18 November 2014, 09:59:50
Scheinbar ist ja schon eine neue Version unterwegs und sollte all unsere Probleme lösen :)

Wie und wo?:-)
Fhem Cubitruck  Armbian Buster with Linux 5.3.9-sunxi
HM-CC_RT-DN, HM-Sec-RHS,HM-Sec-SD, HM-Sec-SCo,IT1500,1xIT GRR-3500 Fritz!Dect200,Powerline546E,Enigma2 Modul mit 3 Vu+,Wol Modul für WinServer2016 und WinServer 2019,FB6590
Allnetl Wandtablett mit FTUI

RoBra81

Zitat von: Tommy82 am 16 November 2014, 15:34:21
So, habs jetzt nochmal so abgeändert, jetzt klappt das normale Umschalten wieder, allerdings das Umschalten auf das "next" Programm geht nicht

Kannst du das nochmal probieren:

############################################
sub
switchChannel($)
{
  my %channellist = (
    pro7 => 'ProSieben_HD',
    rtl => 'RTL',
ard => 'Das_Erste_HD',
    kabel_1 => 'kabel_eins_HD',
sat1 => 'SAT.1_HD',
    rtl2 => 'RTL_II',
sport1 => '',
    vox => 'VOX',
zdf => 'ZDF_HD',
  );
 
  my $TVDevice = 'VU_Ultimo';

  my ($channel) = @_;
  $channel =~ s/_time//g;
  my $lcchannel = lc $channel;
  my $next = 0;
  if ($channel =~ /_next/)
  {
    my @array = split(/_next/, $channel);
    $channel = $array[0];
    $next = 1;
  }
  my $command = '';
 
  $command = 'set '.$TVDevice.' channel '.$channellist{$lcchannel};

  if ($command ne '')
  {
    if ($next == 1)
    {
      $command =~ s/;/;;/g;
      fhem('delete '.$TVDevice.'.Senderwechsel.at');
      fhem('define '.$TVDevice.'.Senderwechsel.at at '.ReadingsVal('TV_Programm.dann', $channel.'_next_time', '00:00').' '.$command);
      fhem('attr '.$TVDevice.'.Senderwechsel.at room Wohnzimmer');
    }
    else
    {
      fhem($command);
    }
  }
  else
  {
    Log(1, 'Channelnumber not found for channel: '.$channel);
  }
}


Zitat von: Tommy82 am 16 November 2014, 15:34:21
Bekomme im Log dann diesen Fehler:
2014.11.16 15:33:29.303 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at ./FHEM/99_myUtils.pm line 130.
2014.11.16 15:33:29.322 3: delete VU_Ultimo.Senderwechsel.at : Please define VU_Ultimo.Senderwechsel.at first


Die erste Meldung sollte nur kommen, wenn er den Sender nicht findet (sollte jetzt funktionieren) und die zweite kommt immer, wenn noch kein at definiert ist, da ich das erstmal pauschal lösche bevor ich es definiere...

Ronny

Kuzl

Zitat von: Tommy82 am 18 November 2014, 10:04:47
Wie und wo?:-)
Wenn der Entwickler damit fertig ist per update ;)
sollte nicht mehr zu lange dauern denke ich

Tommy82

@Ronny
Danke teste ich heute Abend und heb dann besxheid

@Kuzl
Soll das Ganze als Modul kommen oder wie muss ich das verstehen? Hb ich hier was verpasst?:-)
Fhem Cubitruck  Armbian Buster with Linux 5.3.9-sunxi
HM-CC_RT-DN, HM-Sec-RHS,HM-Sec-SD, HM-Sec-SCo,IT1500,1xIT GRR-3500 Fritz!Dect200,Powerline546E,Enigma2 Modul mit 3 Vu+,Wol Modul für WinServer2016 und WinServer 2019,FB6590
Allnetl Wandtablett mit FTUI

Mario67

@Tommy82:
Schau mal in den Link den ich in Beitrag #255 hinterlegt hatte. Es geht um HTTPMOD.

Grüße,
Mario
FHEM auf Raspberry Pi 4 mit CUL868, WMBUS,
FS20 ST, FS20 AS4-3, FS20 SU-2, FS20 DF, 1-Wire + RS-232: AB Electronics Com Pi RS232, Brandmelder + Fenster: AB Electronics IO Pi 32
BUDERUS GB142 über EMS/AVR-NET-IO, WESTAFLEX WAC250 über RS232, MySensors
mit fhem.cfg & includes glücklich

Tommy82

Ah danke, hatte nicht gesehen das es da einen Kommentar gibt. Das super danke
Fhem Cubitruck  Armbian Buster with Linux 5.3.9-sunxi
HM-CC_RT-DN, HM-Sec-RHS,HM-Sec-SD, HM-Sec-SCo,IT1500,1xIT GRR-3500 Fritz!Dect200,Powerline546E,Enigma2 Modul mit 3 Vu+,Wol Modul für WinServer2016 und WinServer 2019,FB6590
Allnetl Wandtablett mit FTUI

Tommy82

Hi Ronny,
geht leider immer noch nicht, im Log kommt dann:
2014.11.18 21:36:13.468 5: TV_Programm: no longer visible, ignoring notify
2014.11.18 21:36:13.725 5: TV_Programm: not on any display, ignoring notify
Fhem Cubitruck  Armbian Buster with Linux 5.3.9-sunxi
HM-CC_RT-DN, HM-Sec-RHS,HM-Sec-SD, HM-Sec-SCo,IT1500,1xIT GRR-3500 Fritz!Dect200,Powerline546E,Enigma2 Modul mit 3 Vu+,Wol Modul für WinServer2016 und WinServer 2019,FB6590
Allnetl Wandtablett mit FTUI

RoBra81

Die Meldungen kommen jetzt aber meiner Meinung nach nicht von meiner Funktion...

RoBra81

Kannst du denn noch auf die aktuelle Sendung umschalten? Wird für die nächste Sendung das at angelegt? Wie sieht das aus?

Tommy82

#266
Zitat von: RoBra81 am 18 November 2014, 22:37:56
Kannst du denn noch auf die aktuelle Sendung umschalten? Wird für die nächste Sendung das at angelegt? Wie sieht das aus?

Ja die aktuelle Sendung kann ich umschalten

Dieses at gibt es
Internals:
   CFGFN
   DEF        00:00 set VU_Ultimo channel
   NAME       VU_Ultimo.Senderwechsel.at
   NR         264
   STATE      Next: 00:00:00
   TRIGGERTIME 1416438000
   TRIGGERTIME_FMT 2014-11-20 00:00:00
   TYPE       at
   VOLATILE   1
Attributes:
   room       Wohnzimmer


Hätte normal jetzt um 19:40 Umschalten sollen, da ich auf next geklickt hab, allerdings kein erfolg.

Im Log findet sich nur
2014.11.19 19:43:12.914 3: HTTPMOD got error in callback: connect to http://www.tvmovie.de:80 timed out
2014.11.19 19:43:12.924 3: HTTPMOD got error in callback: connect to http://www.tvmovie.de:80 timed out


Hatte jetzt nochmal auf next 19:45 ARD gekklickt, und mal im EventMonitor geschaut, da kommt dann das:
2014-11-19 19:45:11.465 ENIGMA2 VU_Ultimo snrdb: 65
2014-11-19 19:45:11.465 ENIGMA2 VU_Ultimo snr: 65
2014-11-19 19:45:11.465 ENIGMA2 VU_Ultimo ber: 1096449641
2014-11-19 19:45:11.465 ENIGMA2 VU_Ultimo acg: 69
2014-11-19 19:45:13.529 ENIGMA2 VU_Ultimo eventremaining: 1759
2014-11-19 19:45:13.529 ENIGMA2 VU_Ultimo eventcurrenttime: 1416422711.41
2014-11-19 19:45:13.529 ENIGMA2 VU_Ultimo eventcurrenttime_next: 1416422711.48
2014-11-19 19:45:13.529 ENIGMA2 VU_Ultimo eventcurrenttime_hr: 19:45:11
2014-11-19 19:45:13.529 ENIGMA2 VU_Ultimo eventcurrenttime_next_hr: 19:45:11
2014-11-19 19:45:13.529 ENIGMA2 VU_Ultimo eventremaining_hr: 00:29:19
Fhem Cubitruck  Armbian Buster with Linux 5.3.9-sunxi
HM-CC_RT-DN, HM-Sec-RHS,HM-Sec-SD, HM-Sec-SCo,IT1500,1xIT GRR-3500 Fritz!Dect200,Powerline546E,Enigma2 Modul mit 3 Vu+,Wol Modul für WinServer2016 und WinServer 2019,FB6590
Allnetl Wandtablett mit FTUI

RoBra81

So, da ich nicht vor deinem Rechner sitze  ;), habe ich mal reichlich Logging eingebaut - irgendwie werden wir den Fehler schon finden:

############################################
sub
switchChannel($)
{
  my %channellist = (
    pro7 => 'ProSieben_HD',
    rtl => 'RTL',
ard => 'Das_Erste_HD',
    kabel_1 => 'kabel_eins_HD',
sat1 => 'SAT.1_HD',
    rtl2 => 'RTL_II',
sport1 => '',
    vox => 'VOX',
zdf => 'ZDF_HD',
  );
 
  my $TVDevice = 'VU_Ultimo';

  my ($channel) = @_;
  Log(3, "switchChannel: Parameter channel: ".$channel);
  $channel =~ s/_time//g; 
  my $lcchannel = lc $channel;
  Log(3, "switchChannel: Lowercase channel: ".$lcchannel);
  my $next = 0;
  if ($channel =~ /_next/)
  {
    my @array = split('_next', $channel);
    $channel = $array[0];
    Log(3, "switchChannel: Next found, new channel: ".$channel);
    $next = 1;
  }
  my $command = '';
 
  $command = 'set '.$TVDevice.' channel '.$channellist{$lcchannel};
  Log(3, "switchChannel: Switching command: ".$command);
 

  if ($command ne '')
  {
    if ($next == 1)
    {
      $command =~ s/;/;;/g;
      fhem('delete '.$TVDevice.'.Senderwechsel.at');
      fhem('define '.$TVDevice.'.Senderwechsel.at at '.ReadingsVal('TV_Programm.dann', $channel.'_next_time', '00:00').' '.$command);
      fhem('attr '.$TVDevice.'.Senderwechsel.at room Wohnzimmer');
    }
    else
    {
      fhem($command);
    }
  }
  else
  {
    Log(1, 'Channelnumber not found for channel: '.$channel);
  }
}


-> Einfach mal ersetzen, einmal jetzt schalten und einmal auf eine zukünftige Sendung klicken und dann den Logauszug posten...

Tommy82

Erstmal vielen Dank für deine Hilfe.

Hab den Code ersetz und dann JETZT umgeschaltet, klappt problemlos, im Log kommt dann:
2014.11.19 20:10:10.574 3: switchChannel: Parameter channel: Sat1
2014.11.19 20:10:10.577 3: switchChannel: Lowercase channel: sat1
2014.11.19 20:10:10.578 3: switchChannel: Switching command: set VU_Ultimo channel SAT.1_HD
2014.11.19 20:10:10.582 2: ENIGMA2 set VU_Ultimo channel SAT.1_HD
2014.11.19 20:10:17.349 3: switchChannel: Parameter channel: Pro7
2014.11.19 20:10:17.350 3: switchChannel: Lowercase channel: pro7
2014.11.19 20:10:17.351 3: switchChannel: Switching command: set VU_Ultimo channel ProSieben_HD
2014.11.19 20:10:17.355 2: ENIGMA2 set VU_Ultimo channel ProSieben_HD
2014.11.19 20:10:21.745 1: PERL WARNING: substr outside of string at /mod/external/usr/share/fhem/fhem.pl line 627.


In der fhem.ol Line 627 steht
     $hash->{$wbName} = substr($wb, $ret);

Dann hab ich NEXT RTL 20:15 angeklickt dann kommt das im Log
2014.11.19 20:11:15.412 3: switchChannel: Switching command: set VU_Ultimo channel
2014.11.19 20:11:20.352 3: switchChannel: Parameter channel: RTL_next
2014.11.19 20:11:20.354 3: switchChannel: Lowercase channel: rtl_next
2014.11.19 20:11:20.355 3: switchChannel: Next found, new channel: RTL
2014.11.19 20:11:20.356 3: switchChannel: Switching command: set VU_Ultimo channel


Im EventMonitor erscheint dann
2014-11-19 20:14:48.560 readingsGroup rg_VU_Ultimo VU_Ultimo.power: on
2014-11-19 20:14:48.581 ENIGMA2 VU_Ultimo presence: present
2014-11-19 20:14:48.581 ENIGMA2 VU_Ultimo power: on
2014-11-19 20:14:48.581 ENIGMA2 VU_Ultimo on
2014-11-19 20:14:50.636 ENIGMA2 VU_Ultimo volume: 100
2014-11-19 20:14:50.636 ENIGMA2 VU_Ultimo mute: off
2014-11-19 20:14:50.874 ENIGMA2 VU_Ultimo snrdb: 65
2014-11-19 20:14:50.874 ENIGMA2 VU_Ultimo snr: 65
2014-11-19 20:14:50.874 ENIGMA2 VU_Ultimo ber: 1096449641
2014-11-19 20:14:50.874 ENIGMA2 VU_Ultimo acg: 69


allerdings wird nicht umgeschaltet, im Log steht dann
2014.11.19 20:14:41.915 3: HTTPMOD got error in callback: connect to http://www.tvmovie.de:80 timed out
2014.11.19 20:14:42.078 3: HTTPMOD got error in callback: connect to http://www.tvmovie.de:80 timed out


Nochmal danke für deine Hilfe
Fhem Cubitruck  Armbian Buster with Linux 5.3.9-sunxi
HM-CC_RT-DN, HM-Sec-RHS,HM-Sec-SD, HM-Sec-SCo,IT1500,1xIT GRR-3500 Fritz!Dect200,Powerline546E,Enigma2 Modul mit 3 Vu+,Wol Modul für WinServer2016 und WinServer 2019,FB6590
Allnetl Wandtablett mit FTUI

RoBra81

So, jetzt geht's (vielleicht):

############################################
sub
switchChannel($)
{
  my %channellist = (
    pro7 => 'ProSieben_HD',
    rtl => 'RTL',
ard => 'Das_Erste_HD',
    kabel_1 => 'kabel_eins_HD',
sat1 => 'SAT.1_HD',
    rtl2 => 'RTL_II',
sport1 => '',
    vox => 'VOX',
zdf => 'ZDF_HD',
  );
 
  my $TVDevice = 'VU_Ultimo';

  my ($channel) = @_;
  Log(3, "switchChannel: Parameter channel: ".$channel);
  $channel =~ s/_time//g; 
  Log(3, "switchChannel: Lowercase channel: ".$lcchannel);
  my $next = 0;
  if ($channel =~ /_next/)
  {
    my @array = split('_next', $channel);
    $channel = $array[0];
    Log(3, "switchChannel: Next found, new channel: ".$channel);
    $next = 1;
  }
  my $lcchannel = lc $channel;
  my $command = '';
 
  $command = 'set '.$TVDevice.' channel '.$channellist{$lcchannel};
  Log(3, "switchChannel: Switching command: ".$command);
 

  if ($command ne '')
  {
    if ($next == 1)
    {
      $command =~ s/;/;;/g;
      fhem('delete '.$TVDevice.'.Senderwechsel.at');
      fhem('define '.$TVDevice.'.Senderwechsel.at at '.ReadingsVal('TV_Programm.dann', $channel.'_next_time', '00:00').' '.$command);
      fhem('attr '.$TVDevice.'.Senderwechsel.at room Wohnzimmer');
    }
    else
    {
      fhem($command);
    }
  }
  else
  {
    Log(1, 'Channelnumber not found for channel: '.$channel);
  }
}


Ansonsten wieder Log posten :-|