00_TCM: Read Base-Id of Tcm on start

This commit is contained in:
Marc Hoppe
2012-01-16 23:34:59 +01:00
committed by Marc Hoppe
parent 1264675b48
commit 6b5345e8bb

View File

@@ -81,6 +81,17 @@ TCM_Define($$)
$hash->{DeviceName} = $dev; $hash->{DeviceName} = $dev;
$hash->{MODEL} = $model; $hash->{MODEL} = $model;
my $ret = DevIo_OpenDev($hash, 0, undef); my $ret = DevIo_OpenDev($hash, 0, undef);
if($hash->{STATE} eq "opened") {
# Read Base-Id of Enocean-Module
my $cnt=0;
do { # this does not always work, so we try several times
my $answer=TCM_Get($hash, ($name, "baseid") );
my @fields=split(/[=,]/, $answer);
$hash->{BASEID}=$fields[1];
$cnt++;
} while ($cnt<3 and $hash->{BASEID} eq "");
}
return $ret; return $ret;
} }