mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 06:48:43 +00:00
34_SWAP.pm: added random delay to initial statusRequest to avoid collisions of the response messages
git-svn-id: https://svn.fhem.de/fhem/trunk@8401 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
47d85a29a8
commit
04aee3f4db
@ -803,6 +803,8 @@ SWAP_regName($$$)
|
||||
{
|
||||
my ($rid, $ep, $endpoint) = @_;
|
||||
|
||||
$ep = "0$ep" if( length($ep) == 0 );
|
||||
|
||||
if( !defined($endpoint) ) {
|
||||
return $rid if( $ep == 0 && !defined($endpoint->{position}) );
|
||||
return $rid .'.'. $ep;
|
||||
@ -1023,7 +1025,8 @@ SWAP_Parse($$)
|
||||
$rhash->{product} = $products->{$productcode} if( defined($productcode) && defined($products->{$productcode} ) );
|
||||
|
||||
if( $first ) {
|
||||
SWAP_Set( $rhash, $rname, "statusRequest" );
|
||||
my $time = 1+rand(5);
|
||||
fhem( "sleep $time; set $rname statusRequest" );
|
||||
} else {
|
||||
SWAP_Send($rhash, $rhash->{addr}, QUERY, "01" );
|
||||
SWAP_Send($rhash, $rhash->{addr}, QUERY, "02" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user