mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 05:06:35 +00:00
autocreate ignoreTypes
git-svn-id: https://svn.fhem.de/fhem/trunk@853 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
796f05d673
commit
8b7bbe4d23
@ -11,49 +11,55 @@ use warnings;
|
|||||||
# - check "UNDEFINED" parameters for BS/USF1000/X10
|
# - check "UNDEFINED" parameters for BS/USF1000/X10
|
||||||
|
|
||||||
my %flogpar = (
|
my %flogpar = (
|
||||||
"CUL_EM:.*"
|
"CUL_EM.*"
|
||||||
=> { GPLOT => "cul_em:Power,", FILTER => "%NAME:CNT:.*" },
|
=> { GPLOT => "cul_em:Power,", FILTER => "%NAME:CNT:.*" },
|
||||||
"CUL_WS:.*"
|
"CUL_WS.*"
|
||||||
=> { GPLOT => "hms:Temp/Hum,", FILTER => "%NAME" },
|
=> { GPLOT => "hms:Temp/Hum,", FILTER => "%NAME" },
|
||||||
"CUL_FHTTK:.*"
|
"CUL_FHTTK.*"
|
||||||
=> { GPLOT => "fht80tf:Window,", FILTER => "%NAME" },
|
=> { GPLOT => "fht80tf:Window,", FILTER => "%NAME" },
|
||||||
"FHT:.*"
|
"FHT.*"
|
||||||
=> { GPLOT => "fht:Temp/Act,", FILTER => "%NAME" },
|
=> { GPLOT => "fht:Temp/Act,", FILTER => "%NAME" },
|
||||||
"HMS:HMS100TFK_.*"
|
"HMS100TFK_.*"
|
||||||
=> { GPLOT => "fht80tf:Contact,", FILTER => "%NAME" },
|
=> { GPLOT => "fht80tf:Contact,", FILTER => "%NAME" },
|
||||||
"HMS:HMS100T._.*"
|
"HMS100T._.*"
|
||||||
=> { GPLOT => "hms:Temp/Hum,", FILTER => "%NAME:T:.*" },
|
=> { GPLOT => "hms:Temp/Hum,", FILTER => "%NAME:T:.*" },
|
||||||
"KS300:.*"
|
"KS300.*"
|
||||||
=> { GPLOT => "ks300:Temp/Rain,ks300_2:Wind/Hum,",
|
=> { GPLOT => "ks300:Temp/Rain,ks300_2:Wind/Hum,",
|
||||||
FILTER => "%NAME:T:.*" },
|
FILTER => "%NAME:T:.*" },
|
||||||
|
|
||||||
# Oregon sensors:
|
# Oregon sensors:
|
||||||
# * temperature
|
# * temperature
|
||||||
"OREGON:(THR128|THWR288A|THN132N).*"
|
"(THR128|THWR288A|THN132N).*"
|
||||||
=> { GPLOT => "oregon_hms_t:Temp,", FILTER => "%NAME" },
|
=> { GPLOT => "oregon_hms_t:Temp,", FILTER => "%NAME" },
|
||||||
# * temperature, humidity
|
# * temperature, humidity
|
||||||
"OREGON:(THGR228N|THGR810|THGR918|THGR328N|RTGR328N|WTGR800_T).*"
|
"(THGR228N|THGR810|THGR918|THGR328N|RTGR328N|WTGR800_T).*"
|
||||||
=> { GPLOT => "oregon_hms:Temp/Hum,", FILTER => "%NAME" },
|
=> { GPLOT => "oregon_hms:Temp/Hum,", FILTER => "%NAME" },
|
||||||
# * temperature, humidity, pressure
|
# * temperature, humidity, pressure
|
||||||
"OREGON:(BTHR918N|BTHR918|BTHR918N).*"
|
"(BTHR918N|BTHR918|BTHR918N).*"
|
||||||
=> { GPLOT => "oregon_temp_press:Temp/Press,oregon_hms:Temp/Hum,",
|
=> { GPLOT => "oregon_temp_press:Temp/Press,oregon_hms:Temp/Hum,",
|
||||||
FILTER => "%NAME" },
|
FILTER => "%NAME" },
|
||||||
# * anenometer
|
# * anenometer
|
||||||
"OREGON:(WGR800|WGR918|WTGR800_A).*"
|
"(WGR800|WGR918|WTGR800_A).*"
|
||||||
=> { GPLOT => "oregon_wind:WindDir/WindSpeed,", FILTER => "%NAME" },
|
=> { GPLOT => "oregon_wind:WindDir/WindSpeed,", FILTER => "%NAME" },
|
||||||
# * Oregon sensors: Rain gauge
|
# * Oregon sensors: Rain gauge
|
||||||
"OREGON:(PCR800|RGR918).*"
|
"(PCR800|RGR918).*"
|
||||||
=> { GPLOT => "oregon_rain:RainRate", FILTER => "%NAME" },
|
=> { GPLOT => "oregon_rain:RainRate", FILTER => "%NAME" },
|
||||||
|
|
||||||
# HomeMatic
|
# HomeMatic
|
||||||
"CUL_HM:THSensor"
|
"CUL_HM_THSensor.*"
|
||||||
=> { GPLOT => "hms:Temp/Hum,",
|
=> { GPLOT => "hms:Temp/Hum,",
|
||||||
FILTER => "%NAME:T:.*" },
|
FILTER => "%NAME:T:.*" },
|
||||||
"CUL_HM:KS550"
|
"CUL_HM_KS550.*"
|
||||||
=> { GPLOT => "ks300:Temp/Rain,ks300_2:Wind/Hum,",
|
=> { GPLOT => "ks300:Temp/Rain,ks300_2:Wind/Hum,",
|
||||||
FILTER => "%NAME:T:.*" },
|
FILTER => "%NAME:T:.*" },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Do not create FileLog for the following devices.
|
||||||
|
my @flog_blacklist = (
|
||||||
|
"CUL_RFR"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
autocreate_Initialize($)
|
autocreate_Initialize($)
|
||||||
@ -63,7 +69,7 @@ autocreate_Initialize($)
|
|||||||
$hash->{NotifyFn} = "autocreate_Notify";
|
$hash->{NotifyFn} = "autocreate_Notify";
|
||||||
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 " .
|
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 " .
|
||||||
"autosave filelog device_room weblink weblink_room " .
|
"autosave filelog device_room weblink weblink_room " .
|
||||||
"disable";
|
"disable ignoreTypes";
|
||||||
my %ahash = ( Fn=>"CommandCreateLog",
|
my %ahash = ( Fn=>"CommandCreateLog",
|
||||||
Hlp=>"<device>,create log/weblink for <device>" );
|
Hlp=>"<device>,create log/weblink for <device>" );
|
||||||
$cmds{createlog} = \%ahash;
|
$cmds{createlog} = \%ahash;
|
||||||
@ -112,7 +118,9 @@ autocreate_Notify($$)
|
|||||||
my ($name, $type, $arg) = ($1, $2, $3);
|
my ($name, $type, $arg) = ($1, $2, $3);
|
||||||
next if(AttrVal($me, "disable", undef));
|
next if(AttrVal($me, "disable", undef));
|
||||||
|
|
||||||
my $lctype = lc($type);
|
my $it = AttrVal($me, "ignoreTypes", undef);
|
||||||
|
next if($it && $name =~ m/$it/i);
|
||||||
|
|
||||||
my ($cmd, $ret);
|
my ($cmd, $ret);
|
||||||
my $hash = $defs{$name}; # Called from createlog
|
my $hash = $defs{$name}; # Called from createlog
|
||||||
|
|
||||||
@ -131,6 +139,13 @@ autocreate_Notify($$)
|
|||||||
my $room = replace_wildcards($hash, $attr{$me}{device_room});
|
my $room = replace_wildcards($hash, $attr{$me}{device_room});
|
||||||
$attr{$name}{room} = $room if($room);
|
$attr{$name}{room} = $room if($room);
|
||||||
|
|
||||||
|
# BlackList processing
|
||||||
|
my $blfound;
|
||||||
|
foreach my $bl (@flog_blacklist) {
|
||||||
|
$blfound = 1 if($name !~ m/^$bl$/);
|
||||||
|
}
|
||||||
|
last if($blfound);
|
||||||
|
|
||||||
####################
|
####################
|
||||||
my $fl = replace_wildcards($hash, $attr{$me}{filelog});
|
my $fl = replace_wildcards($hash, $attr{$me}{filelog});
|
||||||
next if(!$fl);
|
next if(!$fl);
|
||||||
@ -138,9 +153,7 @@ autocreate_Notify($$)
|
|||||||
delete($defs{$flname}); # If we are re-creating it with createlog.
|
delete($defs{$flname}); # If we are re-creating it with createlog.
|
||||||
my ($gplot, $filter) = ("", $name);
|
my ($gplot, $filter) = ("", $name);
|
||||||
foreach my $k (keys %flogpar) {
|
foreach my $k (keys %flogpar) {
|
||||||
my $model = AttrVal($name, "model", "");
|
next if($name !~ m/^$k$/);
|
||||||
next if("$type:$name" !~ m/^$k$/ &&
|
|
||||||
"$type:$model" !~ m/^$k$/);
|
|
||||||
$gplot = $flogpar{$k}{GPLOT};
|
$gplot = $flogpar{$k}{GPLOT};
|
||||||
$filter = replace_wildcards($hash, $flogpar{$k}{FILTER});
|
$filter = replace_wildcards($hash, $flogpar{$k}{FILTER});
|
||||||
}
|
}
|
||||||
@ -212,6 +225,7 @@ autocreate_Notify($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandSave(undef, undef) if(!$ret && $nrcreated && $attr{$me}{autosave});
|
CommandSave(undef, undef) if(!$ret && $nrcreated && $attr{$me}{autosave});
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
@ -5819,6 +5819,15 @@ Terminating
|
|||||||
wildcards %TYPE and %NAME, see the example above.</li><br>
|
wildcards %TYPE and %NAME, see the example above.</li><br>
|
||||||
|
|
||||||
<li><a href="#disable">disable</a></li>
|
<li><a href="#disable">disable</a></li>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a name="ignoreTypes"></a>
|
||||||
|
<li>ignoreTypes<br>
|
||||||
|
This is a regexp, to ignore certain devices, e.g. you neighbours FHT.
|
||||||
|
You can specify more than one, with usual regexp syntax, e.g.<br>
|
||||||
|
attr autocreate ignoreTypes CUL_HOERMANN.*|FHT_1234|CUL_WS_7
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<a name="createlog"></a>
|
<a name="createlog"></a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user