diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm index 3b65196ce..307b5e753 100755 --- a/fhem/FHEM/10_CUL_HM.pm +++ b/fhem/FHEM/10_CUL_HM.pm @@ -6317,13 +6317,15 @@ sub CUL_HM_UpdtCentral($){ map{InternalVal($_,"owner_CCU","") eq $name ? $_ : ""} keys %defs); - my @myIos;# get all IOs uing 'my' ID + my @myIos;# get all IOs using 'my' ID foreach (CUL_HM_noDup(grep !/^$/,map{AttrVal($_,"IODev","")}keys %defs)){ - push @myIos,$_ if (CUL_HM_h2IoId($defs{$_}) eq $defs{$name}{DEF}); + push @myIos,$_ if (CUL_HM_h2IoId($defs{$_}) eq $id); } + $defs{$name}{assignedIOs} = join(",",@myIos); + foreach my $ioN(split",",AttrVal($name,"IOList","")){ next if (!$defs{$ioN}); - if ( $defs{$ioN}{TYPE} eq "HMLAN"){; + if ( $defs{$ioN}{TYPE} eq "HMLAN"){; } elsif($defs{$ioN}{TYPE} eq "CUL"){ CommandAttr(undef, "$ioN rfmode HomeMatic") @@ -6332,11 +6334,11 @@ sub CUL_HM_UpdtCentral($){ else { next; } - CommandAttr(undef, "$ioN hmId $defs{$name}{DEF}") - if (AttrVal($ioN,"hmId","") ne $defs{$name}{DEF}); + CommandAttr(undef, "$ioN hmId $id") + if (AttrVal($ioN,"hmId","") ne $id); $defs{$ioN}{owner_CCU} = $name; } - $defs{$name}{assignedIOs} = join(",",@myIos); + # --- search for peers to CCU and potentially device this channel foreach my $ccuBId (CUL_HM_noDup(grep /$id/ ,map{split ",",AttrVal($_,"peerIDs","")}keys %defs)){ my $btnS = substr($ccuBId,6,2); @@ -6369,12 +6371,12 @@ sub CUL_HM_UpdtCentralState($){ } foreach my $ioN (@IOl){ my $cnd = ReadingsVal($ioN,"cond",""); - if ($cnd){ - $state .= "$ioN:".($cnd !~ m/(init|ok)/?$cnd:"ok").","; + if ($cnd){ # covering all HMLAN/USB + $state .= "$ioN:$cnd,"; } - else{ + else{ # handling CUL my $st = InternalVal($ioN,"STATE","unknown"); - $state .= "$ioN:".($st !~ m/([iI]nit|ok)/?$st:"ok").","; + $state .= "$ioN:".($st ne "Initialized"?$st:"ok").","; } if (AttrVal($ioN,"hmId","") ne $defs{$name}{DEF}){ Log 1,"CUL_HM correct hmId for assigned IO $ioN"; diff --git a/fhem/FHEM/98_HMinfo.pm b/fhem/FHEM/98_HMinfo.pm index c7966fae7..83b1d8ace 100644 --- a/fhem/FHEM/98_HMinfo.pm +++ b/fhem/FHEM/98_HMinfo.pm @@ -539,102 +539,10 @@ sub HMinfo_tempList(@) { ###################################################### $ret = "incomplete data for ".join("\n ",@incmpl) if (scalar@incmpl); } elsif ($action eq "verify"){ - open(aSave, "$fName") || return("Can't open $fName: $!"); - my @el = (); - my @elAll = (); - my @entryFail = (); - my @entryNF = (); - while(){ - chomp; - next if($_ =~ m/#/); - if($_ =~ m/^entities:/){ - my $line = $_; - $line =~s/.*://; - @el = (); - foreach (split(",",$line)){ - if ($defs{$_}){ - push @el,$_ if ($defs{$_} && $_ =~ m/$filter/); - } - else{ - push @entryNF,$_; - } - } - push @elAll,@el; - } - elsif(@el && $_ =~ m/(R_)?(P[123])?(_?._)?tempList[SMFWT].*\>/){ - my ($tln,$val) = ($1,$2)if($_ =~ m/(.*)>(.*)/); - $tln =~ s/ //g; - $val =~ s/ //g; - $tln = "R_".$tln if($tln !~ m/^R_/); - my $day = $dl{$1} if ($tln =~ m/tempList(...)/); - $tln =~s /tempList/${day}_tempList/ if ($tln !~ m/[0-6]_/); - foreach my $eN(@el){ - my $valR = ReadingsVal($eN,$tln,""); - $valR =~ s/ //g; - push (@entryFail,$eN." :".$tln) if ($valR ne $val); - } - } - } - $ret .= "\nentries tested:\n " .join("\n ",@elAll) if (scalar@elAll); - $ret .= "\nfailed verify:\n " .join("\n ",@entryFail) if (scalar@entryFail); - $ret .= "\nentries not found:\n ".join("\n ",@entryNF) if (scalar@entryNF); + $ret = HMinfo_tempListTmpl($filter,"",$action,$fName); } elsif ($action eq "restore"){ - open(aSave, "$fName") || return("Can't open $fName: $!"); - my @el = (); - my @elAll = (); - my @entryFail = (); - my @entryNF = (); - my @exec = (); - while(){ - chomp; - my $line = $_; - next if($line =~ m/#/); - if($line =~ m/^entities:/){ - $line =~s/.*://; - @el = (); - foreach (split(",",$line)){ - if ($defs{$_}){ - push @el,$_ if ($_ =~ m/$filter/); - } - else{ - push @entryNF,$_; - } - } - push @elAll,@el; - } - elsif(@el && $_ =~ m/(R_)?(P[123])?(_?._)?tempList[SMFWT].*\>/){ - my ($tln,$val) = ($1,$2)if($_ =~ m/(.*)>(.*)/); - $tln =~ s/ //g; - $tln = "R_".$tln if($tln !~ m/^R_/); - my $day = $dl{$1} if ($tln =~ m/tempList(...)/); - $tln =~s /tempList/${day}_tempList/ if ($tln !~ m/[0-6]_/); - $val =~ tr/ +/ /; - $val =~ s/^ //; - $val =~ s/ $//; - foreach my $eN(@el){ - if ($tln =~ m/(P.)_._tempList/){ - $val = lc($1)." ".$val; - } - $tln =~ s/R_(P._)?._//; - my $x = CUL_HM_Set($defs{$eN},$eN,$tln,"prep",split(" ",$val)); - if ($x ne "1"){ - my $list =$line; - $list =~ s/\>.*//; - push @entryFail,$eN." :".$list." respose:$x"; - } - push @exec,"$eN $tln exec $val" if (!(grep /$eN/,@exec)); - } - } - } - close(aSave); - foreach (@exec){ - my @param = split(" ",$_); - CUL_HM_Set($defs{$param[0]},@param); - } - - $ret = "failed Entries:\n " .join("\n ",@entryFail) if (scalar@entryFail); - $ret = "Entries not found:\n ".join("\n ",@entryNF) if (scalar@entryNF); + $ret = HMinfo_tempListTmpl($filter,"",$action,$fName); } else{ $ret = "$action unknown option - please use save, verify or restore"; @@ -667,7 +575,6 @@ sub HMinfo_tempListTmpl(@) { ################################################## : AttrVal($name,"tempListTmpl","tempList.cfg:$name"); my $r = CUL_HM_tempListTmpl($name,$action,$tmplDev); - push @rs, ($r ? "fail : $tmplDev for $name: $r" : "passed: $tmplDev for $name") ."\n"; @@ -1883,7 +1790,6 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
- Get -

Attributes