2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 23:06:05 +00:00

14_CUL_TX.pm: Fix problems when resuing the same code (Forum #90003)

git-svn-id: https://svn.fhem.de/fhem/trunk@17099 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-08-07 06:55:24 +00:00
parent d45ff6c27c
commit 8105d3581c

View File

@ -20,7 +20,9 @@ CUL_TX_Initialize($)
$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" } };
{ "CUL_TX.*" => { GPLOT => "temp4hum4:Temp/Hum,",
FILTER => "%NAME",
autocreateThreshold => "2:180" } };
}
#############################
@ -33,6 +35,12 @@ CUL_TX_Define($$)
return "wrong syntax: define <name> CUL_TX <code> [corr] [minsecs]"
if(int(@a) < 3 || int(@a) > 5);
my $dp = $modules{CUL_TX}{defptr};
my $old = ($dp && $dp->{$a[2]} ? $dp->{$a[2]}{NAME} : "");
my $op = ($hash->{OLDDEF} ? "modify":"define");
return "Cannot $op $hash->{NAME} as the code $a[2] is already used by $old"
if($old);
$hash->{CODE} = $a[2];
$hash->{corr} = ((int(@a) > 3) ? $a[3] : 0);
$hash->{minsecs} = ((int(@a) > 4) ? $a[4] : 0);
@ -75,7 +83,7 @@ CUL_TX_Parse($$)
my $def = $modules{CUL_TX}{defptr}{$id3};
if(!$def) {
Log3 $hash, 2, "CUL_TX Unknown device $id3, please define it";
return "UNDEFINED CUL_TX_$id3 CUL_TX $id3" if(!$def);
return "UNDEFINED CUL_TX_$id3 CUL_TX $id3";
}
my $now = time();