mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
add listDevice to actionDetector
git-svn-id: https://svn.fhem.de/fhem/trunk@6040 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b089780c37
commit
b45e1d034b
@ -211,6 +211,7 @@ sub CUL_HM_updateConfig($){
|
|||||||
$attr{$name}{"event-on-change-reading"} =
|
$attr{$name}{"event-on-change-reading"} =
|
||||||
AttrVal($name, "event-on-change-reading", ".*")
|
AttrVal($name, "event-on-change-reading", ".*")
|
||||||
if(!$nAttr);
|
if(!$nAttr);
|
||||||
|
$attr{$name}{model} = "ActionDetector";
|
||||||
delete $hash->{helper}{role};
|
delete $hash->{helper}{role};
|
||||||
$hash->{helper}{role}{vrt} = 1;
|
$hash->{helper}{role}{vrt} = 1;
|
||||||
next;
|
next;
|
||||||
@ -2581,11 +2582,36 @@ sub CUL_HM_Get($@) {#+++++++++++++++++ get command+++++++++++++++++++++++++++++
|
|||||||
@h = split(" ", $h) if($h);
|
@h = split(" ", $h) if($h);
|
||||||
|
|
||||||
if(!defined($h)) {
|
if(!defined($h)) {
|
||||||
my @arr;
|
my @arr = ();
|
||||||
push @arr, keys %{$culHmGlobalGets} if(!$roleV);
|
if(!$roleV) {foreach(keys %{$culHmGlobalGets} ){push @arr,"$_:".$culHmGlobalGets->{$_} }};
|
||||||
push @arr, keys %{$culHmVrtGets} if($roleV);
|
if($roleV) {foreach(keys %{$culHmVrtGets} ){push @arr,"$_:".$culHmVrtGets->{$_} }};
|
||||||
push @arr, keys %{$culHmSubTypeGets->{$st}} if($culHmSubTypeGets->{$st});
|
if($culHmSubTypeGets->{$st}){foreach(keys %{$culHmSubTypeGets->{$st}}){push @arr,"$_:".${$culHmSubTypeGets->{$st}}{$_} }};
|
||||||
push @arr, keys %{$culHmModelGets->{$md}} if($culHmModelGets->{$md});
|
if($culHmModelGets->{$md}) {foreach(keys %{$culHmModelGets->{$md}} ){push @arr,"$_:".${$culHmModelGets->{$md}}{$_} }};
|
||||||
|
|
||||||
|
foreach(@arr){
|
||||||
|
my ($cmd,$val) = split(":",$_,2);
|
||||||
|
Log 1,"General $_ : $cmd,$val";
|
||||||
|
if (!$val ||
|
||||||
|
$val !~ m/^\[.*\]$/ ||
|
||||||
|
$val =~ m/\[.*\[/ ||
|
||||||
|
$val =~ m/(\<|\>)]/
|
||||||
|
){
|
||||||
|
$_ = $cmd;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$val =~ s/(\[|\])//g;
|
||||||
|
my @vArr = split('\|',$val);
|
||||||
|
foreach (@vArr){
|
||||||
|
if ($_ =~ m/(.*)\.\.(.*)/ ){
|
||||||
|
my @list = map { ($_.".0", $_+0.5) } (($1+0)..($2+0));
|
||||||
|
pop @list;
|
||||||
|
$_ = join(",",@list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$_ = "$cmd:".join(",",@vArr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $usg = "Unknown argument $cmd, choose one of ".join(" ",sort @arr);
|
my $usg = "Unknown argument $cmd, choose one of ".join(" ",sort @arr);
|
||||||
|
|
||||||
return $usg;
|
return $usg;
|
||||||
@ -2750,7 +2776,7 @@ sub CUL_HM_Get($@) {#+++++++++++++++++ get command+++++++++++++++++++++++++++++
|
|||||||
close(aSave);
|
close(aSave);
|
||||||
}
|
}
|
||||||
elsif($cmd eq "listDevice"){ ###############################################
|
elsif($cmd eq "listDevice"){ ###############################################
|
||||||
|
if ($md eq "CCU-FHEM"){
|
||||||
my @dl = grep !/^$/,
|
my @dl = grep !/^$/,
|
||||||
map{AttrVal($_,"IOgrp","") =~ m/^$name/ ? $_ : ""}
|
map{AttrVal($_,"IOgrp","") =~ m/^$name/ ? $_ : ""}
|
||||||
keys %defs;
|
keys %defs;
|
||||||
@ -2762,6 +2788,23 @@ sub CUL_HM_Get($@) {#+++++++++++++++++ get command+++++++++++++++++++++++++++++
|
|||||||
}
|
}
|
||||||
return "devices using $name\ncurrent IO / preferred\n ".join "\n ", sort @rl;
|
return "devices using $name\ncurrent IO / preferred\n ".join "\n ", sort @rl;
|
||||||
}
|
}
|
||||||
|
elsif ($md eq "ActionDetector"){
|
||||||
|
my $re = $a[2]?$a[2]:"all";
|
||||||
|
if($re && $re =~ m/^(all|alive|unknown|dead|notAlive)$/){
|
||||||
|
my @fnd = map {$_.":".$defs{$name}{READINGS}{$_}{VAL}}
|
||||||
|
grep /^status_/,
|
||||||
|
keys %{$defs{ActionDetector}{READINGS}};
|
||||||
|
if ($re eq "notAlive"){ @fnd = grep !/:alive$/,@fnd; }
|
||||||
|
elsif ($re eq "all") {; }
|
||||||
|
else { @fnd = grep /:$a[2]$/,@fnd;}
|
||||||
|
$_ =~ s/status_(.*):.*/$1/ foreach(@fnd);
|
||||||
|
push @fnd,"empty" if (!scalar(@fnd));
|
||||||
|
return join",",@fnd;
|
||||||
|
} else{
|
||||||
|
return "please enter parameter [alive|unknown|dead|notAlive]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log3 $name,3,"CUL_HM get $name " . join(" ", @a[1..$#a]);
|
Log3 $name,3,"CUL_HM get $name " . join(" ", @a[1..$#a]);
|
||||||
|
|
||||||
@ -7763,7 +7806,15 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
|
|||||||
restore will not delete any peered channels, it will just add peer channels.<br>
|
restore will not delete any peered channels, it will just add peer channels.<br>
|
||||||
</li>
|
</li>
|
||||||
<li><B>listDevice</B><br>
|
<li><B>listDevice</B><br>
|
||||||
returns a list of Devices using the ccu service to assign an IO.<br>
|
<li>when used with ccu it returns a list of Devices using the ccu service to assign an IO.<br>
|
||||||
|
</li>
|
||||||
|
<li>when used with ActionDetector user will get a comma separated list of entities being assigned to the action detector<br>
|
||||||
|
get ActionDetector listDevice # returns all assigned entities<br>
|
||||||
|
get ActionDetector listDevice notActive# returns entities which habe not status alive<br>
|
||||||
|
get ActionDetector listDevice alive # returns entities with status alive<br>
|
||||||
|
get ActionDetector listDevice unknown # returns entities with status unknown<br>
|
||||||
|
get ActionDetector listDevice dead # returns entities with status dead<br>
|
||||||
|
</li>
|
||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
@ -8975,7 +9026,15 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
|
|||||||
"restore" löscht keine verknüpften Kanäle, es fügt nur neue Peers hinzu.<br>
|
"restore" löscht keine verknüpften Kanäle, es fügt nur neue Peers hinzu.<br>
|
||||||
</li>
|
</li>
|
||||||
<li><B>listDevice</B><br>
|
<li><B>listDevice</B><br>
|
||||||
gibt eine Lister der Devices, welche den ccu service zum zuweisen der IOs zurück<br>
|
<li>bei einer CCU gibt es eine Liste der Devices, welche den ccu service zum zuweisen der IOs zurück<br>
|
||||||
|
</li>
|
||||||
|
<li>beim ActionDetector wird eine Komma geteilte Liste der Entities zurückgegeben<br>
|
||||||
|
get ActionDetector listDevice # returns alle assigned entities<br>
|
||||||
|
get ActionDetector listDevice notActive# returns entities ohne status alive<br>
|
||||||
|
get ActionDetector listDevice alive # returns entities mit status alive<br>
|
||||||
|
get ActionDetector listDevice unknown # returns entities mit status unknown<br>
|
||||||
|
get ActionDetector listDevice dead # returns entities mit status dead<br>
|
||||||
|
</li>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul><br>
|
</ul><br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user