[10_CUL_HM] Warnungen nach 'get ActionDetector status'

Begonnen von Ellert, 11 August 2020, 16:41:49

Vorheriges Thema - Nächstes Thema

Ellert

Es gibt ja schon einige Meldungen zu 10_CUL_HM, hier eine Weitere.
Nach einem Neustart und dem erstmaligen jedem Aufruf von get ActionDetector status mit Version 10_CUL_HM.pm 22563 2020-08-09 09:59:55Z martinp876

Zitat2020.08.11 16:31:49.573 1: PERL WARNING: Use of uninitialized value $2 in multiplication (*) at ./FHEM/10_CUL_HM.pm line 9564.
2020.08.11 16:31:49.574 1: PERL WARNING: Use of uninitialized value $3 in multiplication (*) at ./FHEM/10_CUL_HM.pm line 9564.
2020.08.11 16:31:49.574 1: PERL WARNING: Use of uninitialized value $4 in multiplication (*) at ./FHEM/10_CUL_HM.pm line 9564.
2020.08.11 16:31:49.575 1: PERL WARNING: Use of uninitialized value $5 in multiplication (*) at ./FHEM/10_CUL_HM.pm line 9564.
2020.08.11 16:31:49.575 1: PERL WARNING: Use of uninitialized value $6 in addition (+) at ./FHEM/10_CUL_HM.pm line 9564.

noansi

Hallo Ellert,

... und die Ausgabe passt auch nicht zum Zustand.
Liegt am geänderten Zeitformat von .protLastRcv, das in CUL_HM_ActInfo() noch nicht berücksichtigt wurde.

Gruß, Ansgar.

martinp876


noansi

Hallo Martin,

bis auf die Tabellenformatierung oder die Ausgabe von last in der Tabelle von get status.
(und einem überlüssigen, weil doppelten Match in Zeile 9575)

Gruß, Ansgar.

noansi

#4
Hallo Martin,

der letzte Fix zu get status beim ActionDetector hat leider nicht ganz hingehauen (in CUL_HM_ActInfo() Zeile 9572ff):

      my ($Y,$M,$D,$H,$M,$S) =  unpack 'A4A2A2A2A2A2',$tLast;
     
      my @t = localtime($tod - $tSec); #time since when a trigger is expected

      my $y =  $M*30*24*3600 + $D*24*3600 + $H*3600 + $M*60 +$S -


zwei mal $M und perl meckert nicht darüber. Daher wird falsch gerechnet.

So rechnet es richtig:
      my ($Y,$Mo,$D,$H,$Mi,$S) =  unpack 'A4A2A2A2A2A2',$tLast;
     
      my @t = localtime($tod - $tSec); #time since when a trigger is expected

      my $y =  $Mo*30*86400 + $D*86400 + $H*3600 + $Mi*60 + $S -


und die Tabellenüberschrift passt nicht mit dem neuen .protLastRcv Format.
  return sprintf ("%-8s %-14s %s %s\n\n","state"
                                              ,"last"
                                              ,"next     h:mm:ss"
                                              ,"name").
         join("\n", sort @info);

sieht besser aus.
Alternativ das Datum wieder um -, , und : für die Rückgabe ergänzen.

Gruß, Ansgar.

Edit: Danke Frank, hab ich glatt im Log übersehen.

frank

Zitatzwei mal $M und perl meckert nicht darüber. Dafür wird aber falsch gerechnet.
bei mir schon. gleich beim start.

2020.08.14 17:04:09.788 1: PERL WARNING: "my" variable $M masks earlier declaration in same statement at ./FHEM/10_CUL_HM.pm line 9572, <$fh> line 262.
2020.08.14 17:04:09.788 1: stacktrace:
2020.08.14 17:04:09.788 1:     main::__ANON__                      called by ./FHEM/10_CUL_HM.pm (9572)
2020.08.14 17:04:09.788 1:     (eval)                              called by fhem.pl (2636)
2020.08.14 17:04:09.788 1:     (eval)                              called by fhem.pl (2635)
2020.08.14 17:04:09.789 1:     main::CommandReload                 called by fhem.pl (2021)
2020.08.14 17:04:09.789 1:     main::LoadModule                    called by fhem.pl (2078)
2020.08.14 17:04:09.789 1:     main::CommandDefine                 called by fhem.pl (1254)
2020.08.14 17:04:09.789 1:     main::AnalyzeCommand                called by fhem.pl (1105)
2020.08.14 17:04:09.789 1:     main::AnalyzeCommandChain           called by fhem.pl (1392)
2020.08.14 17:04:09.789 1:     main::CommandInclude                called by fhem.pl (616)
FHEM: 6.0(SVN) => Pi3(buster)
IO: CUL433|CUL868|HMLAN|HMUSB2|HMUART
CUL_HM: CC-TC|CC-VD|SEC-SD|SEC-SC|SEC-RHS|Sw1PBU-FM|Sw1-FM|Dim1TPBU-FM|Dim1T-FM|ES-PMSw1-Pl
IT: ITZ500|ITT1500|ITR1500|GRR3500
WebUI [HMdeviceTools.js (hm.js)]: https://forum.fhem.de/index.php/topic,106959.0.html

martinp876

schon klar, schon gesehen

ActionDetector "status" ist rund-erneuert.
Auch das autoTry sowie Verbose.
Bei Problemen könnte man mir
attr ActionDetector verbose 4 etwas mehr sehen
"Status Request" ist 'streamlined' und auf "ping" umgestellt - was die Anzahl der Messages auf das notwendige reduziert.
attr ActionDetector actCycle 10 beschleunigt den Update uf 10s (was ich nur zum Testen empfehle - Performance!)
Nach booten wird ggf. einmal ein Ping probiert - was längere "unknown" bestmöglich reduziert.
Schön zum Testen ist dann, einen Schalt-Aktor auf 1min zu setzen
attr <SwAct> actCycle 000:01
Der wird dann ständig geprüft und Pings müssen gesendet werden




noansi

Hallo Martin,

zu ActionDetector "status":
2020.08.15 09:44:05.410 1: PERL WARNING: Argument "" isn't numeric in sprintf at /opt/fhem/FHEM/10_CUL_HM.pm line 9608.

liegt wohl am zu dem Zeitpunkt (noch) nicht definierten $actHash->{helper}{$devId}{try}

Danke!

Ansgar.

martinp876

da kommt gleich ein update - incl performance vergesserung (auch) bei reboot

martinp876

So, eingecheckt. Es gab noch ein paar Probleme und alten Code.
ActionDetector attr actCycle wurden scheinbar von niemandem genutzt, da es nicht fuktionierte. Jetzt klappt es.
getSerial ist nun nicht mehr vorhanden (HMConfig nachladen!). Das experimentelle Kommando ist schlicht nicht stabil... eher zufällig.

Die interne Kommandoliste wird nun beim Booten erstmalig erstellt. Die Performance-Probleme hierbei habe ich, denke ich, kompensieren können.

HMInfo "ping" geht nun "fluffig" (set hm cmdRequestG ping). Damit lässt sich schnell jedes Device, welches auch selbständig antworte, pingen. Gleiches gilt für einen Status-Rundruf.

frank

ZitatActionDetector attr actCycle wurden scheinbar von niemandem genutzt, da es nicht fuktionierte.
das uralte problem wurde schon ab und zu angesprochen.
schön, wenn es jetzt funktioniert.
FHEM: 6.0(SVN) => Pi3(buster)
IO: CUL433|CUL868|HMLAN|HMUSB2|HMUART
CUL_HM: CC-TC|CC-VD|SEC-SD|SEC-SC|SEC-RHS|Sw1PBU-FM|Sw1-FM|Dim1TPBU-FM|Dim1T-FM|ES-PMSw1-Pl
IT: ITZ500|ITT1500|ITR1500|GRR3500
WebUI [HMdeviceTools.js (hm.js)]: https://forum.fhem.de/index.php/topic,106959.0.html

noansi

Hallo Martin,

in CUL_HM Zeile 752ff ist
        return "format hhh:mm required. $attrVal incorrect" if( $h >= 999 && $h <= 0
                                                             && $m >= 59  && $m <= 0
                                                             && $h + $m > 0);

wohl eigentlich so gedacht, vermute ich:
        return "format hhh:mm required. $attrVal incorrect" if( $h > 999 || $h < 0
                                                             || $m > 59  || $m < 0
                                                             || $h + $m <= 0);


Gruß, Ansgar.

noansi

Hallo Martin,

was hast Du in CUL_HM Zeile 9437 wirklich geplant?
  return "not for virtuals" if($timeout !~ m/^\d\d\d:\d\d/);

Abfrage und return passen nicht recht zusammen.

beides vielleicht?
  return "not for virtuals" if($devHash->{helper}{role}{vrt});
  return "wrong timeout format. Use hhh:mm" if($timeout !~ m/^\d\d\d:\d\d/);


Gruß, Ansgar.

noansi

Hallo Martin,

richtig anlaufen tut der Actiondetector aber nicht nach Neustart.

Zeile 9455 verhindert es, da auskommentiert:
#  CUL_HM_ActCheck("add") if ($init_done);

respektive die Zeile davor stoppt ihn:
  RemoveInternalTimer("ActionDetector");

eventuell wolltest Du die auch auskommentieren?

Gruß, Ansgar.

noansi

#14
Hallo Martin,

in CUL_HM Zeile 4239 verhindert
  if($hash->{helper}{cmds}{cmdKey} ne $cmdKey){
    if(!$cmdKey){

, dass die cmdList aufgebaut wird, bis das device mal im Browser angezeigt wird oder ein set Kommando auf dem device ausgeführt wird.
Damit funktioniert der ActionDetector mit Pings nicht zuverlässig.

Diese Ergänzung sollte das Problem beheben helfen
  if(   ($hash->{helper}{cmds}{cmdKey} ne $cmdKey)
     || ($hash->{helper}{cmds}{cmdKey} eq "") ){ # noansi: is "" by default, see define
    if($cmdKey eq ""){ # noansi: $cmdKey may start with 0:


oder auch so:
  if($cmdKey eq ""){ # noansi: $cmdKey may start with 0:, build only on "", as it is not given by caller
    my $devName = InternalVal($name,"device",$name);
    my (undef,$chn) = unpack 'A6A2',$hash->{DEF}.'01';#default to chn 01 for dev
    $cmdKey =        ($hash->{helper}{role}{chn}?1:0)
                .":".($hash->{helper}{role}{dev}?1:0)
                .":".($hash->{helper}{role}{vrt}?1:0)
                .":".($hash->{helper}{fkt}?$hash->{helper}{fkt}:"")
                .":".$devName
                .":".($defs{$devName}{helper}{mId} ? $defs{$devName}{helper}{mId}:"")
                .":".$chn
                .":".InternalVal($name,"peerList","")
               ;# update cmds entry in case
  }

  my $changes = 0;
  if($hash->{helper}{cmds}{cmdKey} ne $cmdKey){ # noansi: is "" by default, see define


Gruß, Ansgar.