00_TCM: Read Base-Id of Tcm on start
This commit is contained in:
@@ -12,7 +12,7 @@ package main;
|
||||
# EnOcean Serial Protocol 3 (ESP3) (for the TCM310)
|
||||
|
||||
|
||||
# TODO:
|
||||
# TODO:
|
||||
# Check BSC Temp
|
||||
# Check Stick Temp
|
||||
# Check Stick WriteRadio
|
||||
@@ -77,10 +77,21 @@ TCM_Define($$)
|
||||
$attr{$name}{dummy} = 1;
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
$hash->{DeviceName} = $dev;
|
||||
$hash->{MODEL} = $model;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -586,7 +597,7 @@ TCM_ReadAnswer($$)
|
||||
if($^O =~ m/Win/ && $hash->{USBDev}) {
|
||||
$hash->{USBDev}->read_const_time($to*1000); # set timeout (ms)
|
||||
# Read anstatt input sonst funzt read_const_time nicht.
|
||||
$buf = $hash->{USBDev}->read(999);
|
||||
$buf = $hash->{USBDev}->read(999);
|
||||
return ("$name Timeout reading answer for $arg", undef)
|
||||
if(length($buf) == 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user