98_autocreate: EnOceal special: add support for -temporary. Forum #39610

git-svn-id: https://svn.fhem.de/fhem/trunk@9216 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2015-09-09 13:10:01 +00:00
parent f39bbd4762
commit 2b09e289b1

View File

@@ -118,8 +118,14 @@ autocreate_Notify($$)
my $s = $dev->{CHANGED}[$i]; my $s = $dev->{CHANGED}[$i];
$s = "" if(!defined($s)); $s = "" if(!defined($s));
my $temporary;
################ ################
if($s =~ m/^UNDEFINED -temporary/) { # Special for EnOcean. DO NOT use it elsewhere
$temporary = 1;
$s =~ s/ -temporary//;
}
if($s =~ m/^UNDEFINED ([^ ]*) ([^ ]*) (.*)$/) { if($s =~ m/^UNDEFINED ([^ ]*) ([^ ]*) (.*)$/) {
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));
@@ -213,6 +219,7 @@ autocreate_Notify($$)
#################### ####################
if(!$hash) { if(!$hash) {
$cmd = "$name $type $arg"; $cmd = "$name $type $arg";
$cmd = "-temporary $name $type $arg" if($temporary);
Log3 $me, 2, "autocreate: define $cmd"; Log3 $me, 2, "autocreate: define $cmd";
$ret = CommandDefine(undef, $cmd); $ret = CommandDefine(undef, $cmd);
if($ret) { if($ret) {
@@ -227,7 +234,8 @@ autocreate_Notify($$)
$room = $attr{$name}{room} if($attr{$name} && $attr{$name}{room}); $room = $attr{$name}{room} if($attr{$name} && $attr{$name}{room});
$attr{$name}{room} = $room if($room); $attr{$name}{room} = $room if($room);
next if($modules{$hash->{TYPE}}{noAutocreatedFilelog}); $nrcreated = 0 if($temporary); # do not save
next if($modules{$hash->{TYPE}}{noAutocreatedFilelog} || $temporary);
#################### ####################
my $fl = replace_wildcards($hash, AttrVal($me, "filelog", "")); my $fl = replace_wildcards($hash, AttrVal($me, "filelog", ""));