From d4eb0558bc70737e8a967f0a3ff5e4c6bb45b7fb Mon Sep 17 00:00:00 2001 From: martinp876 Date: Fri, 22 May 2020 11:05:41 +0000 Subject: [PATCH] 98_HMInfo: support CUL_HM update. New command "commmandReqG" to allow status and ping of devices git-svn-id: https://svn.fhem.de/fhem/trunk@21999 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_HMinfo.pm | 44 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/98_HMinfo.pm b/fhem/FHEM/98_HMinfo.pm index 04603e881..a27132dc9 100644 --- a/fhem/FHEM/98_HMinfo.pm +++ b/fhem/FHEM/98_HMinfo.pm @@ -848,8 +848,9 @@ sub HMinfo_tempListTmplView() { ############################################### push @tlFileMiss,"$fName - $err" if ($err); } - my @tNfound; # templates found in files - push @tNfound, @{$defs{hm}{helper}{weekplanList}} if ($defs{$n}{helper}{weekplanList}); + my @tNfound = (); # templates found in files + push @tNfound, @{$defs{hm}{helper}{weekplanList}} if ($defs{$n}{helper}{weekplanList} + && ref($defs{$n}{helper}{weekplanList}) eq 'ARRAY'); #################################################### my $ret = ""; @@ -1640,6 +1641,26 @@ sub HMinfo_SetFn($@) {######################################################### return $cmd." done:" ."\n triggered:" ."\n ".(join "\n ",sort @entities) ; } + elsif($cmd eq "cmdRequestG"){##perform statusRequest for all devicesregister Read------- + my $action = $a[0] ? $a[0]:"status"; + my $st = gettimeofday(); + $action = ($action eq "ping" ? "ping":"status"); #we have status or ping to search devices + my %h; + if($action eq "ping"){ + foreach my $defN (devspec2array("TYPE=CUL_HM:FILTER=DEF=......:FILTER=subType!=virtual")){ + next if(($defs{$defN}{helper}{rxType} & 0xe3) == 0); + next if (1 == CUL_HM_Set($defs{$defN},$defN,"sysTime")); + foreach my $chnN($defN,map{$defs{$defN}{$_}}grep(/^channel_/,keys %{$defs{$defN}})){ + last if(1== CUL_HM_Set($defs{$chnN},$chnN,"statusRequest")); + } + } + } + else{ + $h{$_} = $_ foreach(devspec2array("TYPE=CUL_HM:FILTER=DEF=......:FILTER=subType!=virtual")); # all non-virtual devices. CUL_HM will select statusRequest + CUL_HM_qStateUpdatIfEnab($_,1)foreach(map{$h{$_}}keys %h);#issue status-request + } + return; + } elsif($cmd eq "templateSet"){##template: set of register -------------------- return HMinfo_templateSet(@a); @@ -1656,7 +1677,7 @@ sub HMinfo_SetFn($@) {######################################################### elsif($cmd eq "update") {##update hm counts ----------------------------- $ret = HMinfo_status($hash); } - elsif($cmd =~ m/tempList[G]?/){##handle thermostat templist from file ------- + elsif($cmd =~ m/tempList[G]?/) {##handle thermostat templist from file ---- my $action = $a[0]?$a[0]:""; HMinfo_listOfTempTemplates(); # refresh - maybe there are new entries in the files. if ($action eq "genPlot"){#generatelog and gplot file @@ -1731,6 +1752,7 @@ sub HMinfo_SetFn($@) {######################################################### else{ my @cmdLst = ( "autoReadReg" + ,"cmdRequestG:ping,status" ,"clear" #:msgStat,msgEvents,all,rssi,register,trigger,readings" ,"clearG:msgEvents,msgErrors,msgStat,readings,register,oldRegs,rssi,trigger,attack,all" ,"archConfig:-0,-a","saveConfig","verifyConfig","loadConfig","purgeConfig" @@ -1759,6 +1781,8 @@ sub HMInfo_help(){ ############################################################ ."\n set loadConfig [-typeFilter-] -file- # restores register and peer readings if missing" ."\n set verifyConfig [-typeFilter-] -file- # compare curent date with configfile,report differences" ."\n set autoReadReg [-typeFilter-] # trigger update readings if attr autoReadReg is set" + ."\n set cmdRequestG [ping|status] # trigger a status-request for ping) one channel per device" + ."\n # status) all channel that support statusRequest" ."\n set tempList [-typeFilter-][save|restore|verify|status|genPlot][-filename-]# handle tempList of thermostat devices" ."\n set x-deviceReplace # WARNING:replace a device with another" ."\n ---infos---" @@ -2545,6 +2569,7 @@ sub HMinfo_templateChk_Get($){ ################################################ sub HMinfo_templateDef(@){##################################################### my ($name,$param,$desc,@regs) = @_; return "insufficient parameter, no param" if(!defined $param); + CUL_HM_TemplateModify(); $tmplDefChange = 1;# signal we have a change! if ($param eq "del"){ return "template in use, cannot be deleted" if(HMinfo_templateUsg("","",$name)); @@ -3120,6 +3145,13 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
  • autoReadReg [filter]
    schedules a read of the configuration for the CUL_HM devices with attribut autoReadReg set to 1 or higher.
  • +
  • cmdRequestG
    + issues a status request to update the system and performs access check to devices
    + ping: for one channel per CUL_HM device
    + status: for all channels that suport statusRequest
    + Ping will generate a message to the device. If not answered the device is unaccessible. Check protState for errors in case. +
  • + ,"cmdRequestG:ping,status"
  • clear [filter] [msgEvents|readings|msgStat|register|rssi]
    executes a set clear ... on all HM entities
      @@ -3582,6 +3614,12 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
    • autoReadReg [filter]
      Aktiviert das automatische Lesen der Konfiguration für ein CUL_HM Gerät, wenn das Attribut autoReadReg auf 1 oder höher steht.
    • +
    • cmdRequestG
      + commando cmdRequestG wird an alle Entites verschickt um einen update zu erzwingen und die Zugriffe zu prüfen.
      + Das Kommando geht nur an Entites, welche auch statusRequest unterstützen.
      + ping: es wird an einen der kanäle ein status request verschickt
      + status: jede entity welche das kommando unterstützt wird angesprochen
      +
    • clear [filter] [msgEvents|msgErrors|readings|msgStat|register|rssi]
      Führt ein set clear ... für alle HM Instanzen aus