mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
autocreate.pm decentralization
git-svn-id: https://svn.fhem.de/fhem/trunk@4229 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
769f16ab11
commit
f87e491acf
@ -115,6 +115,8 @@ CUL_FHTTK_Initialize($)
|
||||
$hash->{ParseFn} = "CUL_FHTTK_Parse";
|
||||
$hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:0,1 " .
|
||||
"model:FHT80TF loglevel:0,1,2,3,4,5,6";
|
||||
$hash->{AutoCreate}=
|
||||
{ "CUL_FHTTK.*" => { GPLOT => "fht80tf:Window,", FILTER => "%NAME" } };
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,11 @@ FBDECT_Initialize($)
|
||||
"IODev do_not_notify:1,0 ignore:1,0 dummy:1,0 showtime:1,0 ".
|
||||
"$readingFnAttributes " .
|
||||
"model:".join(",", sort @fbdect_models);
|
||||
$hash->{AutoCreate}=
|
||||
{ "FBDECT.*" => {
|
||||
GPLOT => "power4:Power,",
|
||||
FILTER => "%NAME:power\\x3a.*",
|
||||
ATTR => "event-min-interval:power:120" } };
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,6 +189,8 @@ FHT_Initialize($)
|
||||
"showtime:1,0 retrycount " .
|
||||
"minfhtbuffer lazy tmpcorr ignore:1,0 ".
|
||||
$readingFnAttributes;
|
||||
$hash->{AutoCreate}=
|
||||
{ "FHT.*" => { GPLOT => "fht:Temp/Act,", FILTER => "%NAME" } };
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,6 +39,12 @@ HMS_Initialize($)
|
||||
$hash->{UndefFn} = "HMS_Undef";
|
||||
$hash->{ParseFn} = "HMS_Parse";
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:hms100-t,hms100-tf,hms100-wd,hms100-mg,hms100-tfk,rm100-2,hms100-co,hms100-fit ignore:0,1 $readingFnAttributes";
|
||||
$hash->{AutoCreate}= {
|
||||
"HMS100TFK_.*" =>
|
||||
{ GPLOT => "fht80tf:Contact,", FILTER => "%NAME" },
|
||||
"HMS100T[F]?_.*" =>
|
||||
{ GPLOT => "temp4hum6:Temp/Hum,", FILTER => "%NAME:T:.*" }
|
||||
};
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
@ -22,6 +22,11 @@ KS300_Initialize($)
|
||||
$hash->{ParseFn} = "KS300_Parse";
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 model:ks300 ".
|
||||
"rainadjustment:0,1 ignore:0,1";
|
||||
$hash->{AutoCreate}=
|
||||
{ "KS300.*" => {
|
||||
GPLOT => "temp4rain10:Temp/Rain,hum6wind8:Wind/Hum,",
|
||||
FILTER => "%NAME:T:.*" } };
|
||||
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
@ -19,6 +19,8 @@ CUL_TX_Initialize($)
|
||||
$hash->{ParseFn} = "CUL_TX_Parse";
|
||||
$hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:1,0 " .
|
||||
$readingFnAttributes;
|
||||
$hash->{AutoCreate}=
|
||||
{ "CUL_TX.*" => { GPLOT => "temp4hum4:Temp/Hum,", FILTER => "%NAME" } };
|
||||
}
|
||||
|
||||
#############################
|
||||
|
@ -28,6 +28,8 @@ CUL_WS_Initialize($)
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 ".
|
||||
"model:S300TH,KS300,ASH2200 ignore:0,1 ".
|
||||
$readingFnAttributes;
|
||||
$hash->{AutoCreate}=
|
||||
{ "CUL_WS.*" => { GPLOT => "temp4hum6:Temp/Hum,", FILTER=>"%NAME:T:.*" } };
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,8 @@ CUL_EM_Initialize($)
|
||||
$hash->{AttrList} = "IODev do_not_notify:0,1 showtime:0,1 " .
|
||||
"model:EMEM,EMWZ,EMGZ ignore:0,1 ".
|
||||
$readingFnAttributes;
|
||||
$hash->{AutoCreate}=
|
||||
{ "CUL_EM.*" => { GPLOT => "power8:Power,", FILTER => "%NAME:CNT.*" } };
|
||||
}
|
||||
|
||||
#####################################
|
||||
|
@ -12,22 +12,6 @@ use warnings;
|
||||
# - check "UNDEFINED" parameters for BS/USF1000/X10
|
||||
|
||||
my %flogpar = (
|
||||
"CUL_EM.*"
|
||||
=> { GPLOT => "power8:Power,", FILTER => "%NAME:CNT.*" },
|
||||
"CUL_WS.*"
|
||||
=> { GPLOT => "temp4hum6:Temp/Hum,", FILTER => "%NAME:T:.*" },
|
||||
"CUL_FHTTK.*"
|
||||
=> { GPLOT => "fht80tf:Window,", FILTER => "%NAME" },
|
||||
"FHT.*"
|
||||
=> { GPLOT => "fht:Temp/Act,", FILTER => "%NAME" },
|
||||
"HMS100TFK_.*"
|
||||
=> { GPLOT => "fht80tf:Contact,", FILTER => "%NAME" },
|
||||
"HMS100T[F]?_.*"
|
||||
=> { GPLOT => "temp4hum6:Temp/Hum,", FILTER => "%NAME:T:.*" },
|
||||
"KS300.*"
|
||||
=> { GPLOT => "temp4rain10:Temp/Rain,hum6wind8:Wind/Hum,",
|
||||
FILTER => "%NAME:T:.*" },
|
||||
|
||||
# Oregon sensors:
|
||||
# * temperature
|
||||
"(THR128|THWR288A|THN132N|THGR132N).*"
|
||||
@ -72,14 +56,6 @@ my %flogpar = (
|
||||
FILTER => "%NAME:T:.*" },
|
||||
"CUL_HM_HM-CC-TC.*"
|
||||
=> { GPLOT => "temp4hum6:Temp/Hum,", FILTER => "%NAME:T:.*" },
|
||||
|
||||
# Lacrosse TX
|
||||
"CUL_TX.*"
|
||||
=> { GPLOT => "temp4hum4:Temp/Hum,", FILTER => "%NAME" },
|
||||
|
||||
"FBDECT.*"
|
||||
=> { GPLOT => "power4:Power,", FILTER => "%NAME:power\\x3a.*",
|
||||
ATTR => "event-min-interval:power:120" },
|
||||
);
|
||||
|
||||
# Do not create FileLog for the following devices.
|
||||
@ -181,26 +157,32 @@ autocreate_Notify($$)
|
||||
|
||||
####################
|
||||
my $fl = replace_wildcards($hash, AttrVal($me, "filelog", ""));
|
||||
next if(!$fl);
|
||||
my $flname = "FileLog_$name";
|
||||
delete($defs{$flname}); # If we are re-creating it with createlog.
|
||||
delete($defs{$flname}) if($fl); # If we are re-creating it with createlog.
|
||||
my ($gplot, $filter, $devattr) = ("", $name, "");
|
||||
foreach my $k (keys %flogpar) {
|
||||
|
||||
my $fp = $modules{$hash->{TYPE}}{AutoCreate};
|
||||
$fp = \%flogpar if(!$fp);
|
||||
|
||||
foreach my $k (keys %{$fp}) {
|
||||
next if($name !~ m/^$k$/);
|
||||
$gplot = $flogpar{$k}{GPLOT};
|
||||
$filter = replace_wildcards($hash, $flogpar{$k}{FILTER});
|
||||
$devattr = $flogpar{$k}{ATTR};
|
||||
$gplot = $fp->{$k}{GPLOT};
|
||||
$filter = replace_wildcards($hash, $fp->{$k}{FILTER});
|
||||
$devattr = $fp->{$k}{ATTR};
|
||||
last;
|
||||
}
|
||||
$cmd = "$flname FileLog $fl $filter";
|
||||
Log3 $me, 2, "autocreate: define $cmd";
|
||||
$ret = CommandDefine(undef, $cmd);
|
||||
if($ret) {
|
||||
Log3 $me, 1, "ERROR: $ret";
|
||||
last;
|
||||
|
||||
if($fl) {
|
||||
$cmd = "$flname FileLog $fl $filter";
|
||||
Log3 $me, 2, "autocreate: define $cmd";
|
||||
$ret = CommandDefine(undef, $cmd);
|
||||
if($ret) {
|
||||
Log3 $me, 1, "ERROR: $ret";
|
||||
last;
|
||||
}
|
||||
$attr{$flname}{room} = $room if($room);
|
||||
$attr{$flname}{logtype} = "${gplot}text";
|
||||
}
|
||||
$attr{$flname}{room} = $room if($room);
|
||||
$attr{$flname}{logtype} = "${gplot}text";
|
||||
if($devattr) {
|
||||
foreach my $attrNV (split(" ", $devattr)) {
|
||||
my ($an, $av) = split(":", $attrNV, 2);
|
||||
@ -209,7 +191,7 @@ autocreate_Notify($$)
|
||||
}
|
||||
|
||||
####################
|
||||
next if(!AttrVal($me, "weblink", 1) || !$gplot);
|
||||
next if(!AttrVal($me, "weblink", 1) || !$gplot || !$fl);
|
||||
$room = replace_wildcards($hash, AttrVal($me, "weblink_room", "Plots"));
|
||||
my $wnr = 1;
|
||||
foreach my $wdef (split(/,/, $gplot)) {
|
||||
|
Loading…
Reference in New Issue
Block a user