bugfix intervalForTimer
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
				
			|||||||
# 
 | 
					# 
 | 
				
			||||||
# Developed with Kate
 | 
					# Developed with Kate
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  (c) 2016 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
 | 
					#  (c) 2016-2017 Copyright: Marko Oldenburg (leongaultier at gmail dot com)
 | 
				
			||||||
#  All rights reserved
 | 
					#  All rights reserved
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  This script is free software; you can redistribute it and/or modify
 | 
					#  This script is free software; you can redistribute it and/or modify
 | 
				
			||||||
@@ -35,7 +35,7 @@ use POSIX;
 | 
				
			|||||||
use JSON;
 | 
					use JSON;
 | 
				
			||||||
use Blocking;
 | 
					use Blocking;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $version = "0.2.10";
 | 
					my $version = "0.2.11";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -129,7 +129,6 @@ sub XiaomiFlowerSens_Attr(@) {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
        elsif( $cmd eq "del" ) {
 | 
					        elsif( $cmd eq "del" ) {
 | 
				
			||||||
            readingsSingleUpdate ( $hash, "state", "active", 1 );
 | 
					            readingsSingleUpdate ( $hash, "state", "active", 1 );
 | 
				
			||||||
            InternalTimer( gettimeofday()+int(rand(30)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 );
 | 
					 | 
				
			||||||
            Log3 $name, 3, "Sub XiaomiFlowerSens ($name) - enabled";
 | 
					            Log3 $name, 3, "Sub XiaomiFlowerSens ($name) - enabled";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -142,7 +141,6 @@ sub XiaomiFlowerSens_Attr(@) {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
        elsif( $cmd eq "del" ) {
 | 
					        elsif( $cmd eq "del" ) {
 | 
				
			||||||
            readingsSingleUpdate ( $hash, "state", "active", 1 );
 | 
					            readingsSingleUpdate ( $hash, "state", "active", 1 );
 | 
				
			||||||
            InternalTimer( gettimeofday()+int(rand(30)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 );
 | 
					 | 
				
			||||||
            Log3 $name, 3, "Sub XiaomiFlowerSens ($name) - enabled";
 | 
					            Log3 $name, 3, "Sub XiaomiFlowerSens ($name) - enabled";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -200,12 +198,12 @@ sub XiaomiFlowerSens_stateRequestTimer($) {
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
        XiaomiFlowerSens($hash);
 | 
					        XiaomiFlowerSens($hash);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        InternalTimer( gettimeofday()+$hash->{INTERVAL}+int(rand(300)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 );
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        readingsSingleUpdate ( $hash, "state", "disabled", 1 );
 | 
					        readingsSingleUpdate ( $hash, "state", "disabled", 1 );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    InternalTimer( gettimeofday()+$hash->{INTERVAL}+int(rand(300)), "XiaomiFlowerSens_stateRequestTimer", $hash, 1 );
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    Log3 $name, 5, "Sub XiaomiFlowerSens ($name) - Request Timer wird aufgerufen";
 | 
					    Log3 $name, 5, "Sub XiaomiFlowerSens ($name) - Request Timer wird aufgerufen";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user