fix many bugs with notify

This commit is contained in:
Marko Oldenburg 2017-11-30 21:32:00 +01:00
parent de90d6fb6b
commit 7e08c559b9

View File

@ -47,7 +47,7 @@ use JSON;
use Blocking;
my $version = "1.2.3";
my $version = "1.2.4";
my %CallBatteryFirmwareAge = ( '8h' => 28800,
'16h' => 57600,
'24h' => 86400,
@ -246,11 +246,13 @@ sub XiaomiFlowerSens_Notify($$) {
return if (!$events);
XiaomiFlowerSens_stateRequestTimer($hash) if( grep /^INITIALIZED$/,@{$events}
XiaomiFlowerSens_stateRequestTimer($hash) if( (grep /^DEFINED.$name$/,@{$events}
or grep /^INITIALIZED$/,@{$events}
or grep /^MODIFIED.$name$/,@{$events}
or grep /^DELETEATTR.$name.disable$/,@{$events}
or grep /^ATTR.$name.disable.0$/,@{$events}
or grep /^DELETEATTR.$name.interval$/,@{$events}
or grep /^ATTR.$name.interval.[0-9]+/,@{$events}
or (grep /^DEFINED.$name$/,@{$events} and $init_done) );
or grep /^ATTR.$name.interval.[0-9]+/,@{$events} ) and $init_done );
return;
}
@ -302,6 +304,8 @@ sub XiaomiFlowerSens_stateRequestTimer($) {
my $name = $hash->{NAME};
RemoveInternalTimer($hash);
if( $init_done and not IsDisabled($name) ) {
XiaomiFlowerSens_stateRequest($hash);
@ -769,6 +773,7 @@ sub XiaomiFlowerSens_CallBatteryFirmware_IsUpdateTimeAgeToOld($$) {
<b>Attributes</b>
<ul>
<li>disable - disables the device</li>
<li>disabledForIntervals - disable device for interval time (13:00-18:30 or 13:00-18:30 22:00-23:00)</li>
<li>interval - interval in seconds for statusRequest</li>
<li>minFertility - min fertility value for low warn event</li>
<li>maxFertility - max fertility value for High warn event</li>
@ -845,6 +850,7 @@ sub XiaomiFlowerSens_CallBatteryFirmware_IsUpdateTimeAgeToOld($$) {
<ul>
<li>disable - deaktiviert das Device</li>
<li>interval - Interval in Sekunden zwischen zwei Abfragen</li>
<li>disabledForIntervals - deaktiviert das Gerät für den angegebenen Zeitinterval (13:00-18:30 or 13:00-18:30 22:00-23:00)</li>
<li>minFertility - min Fruchtbarkeits-Grenzwert f&uuml;r ein Ereignis minFertility low </li>
<li>maxFertility - max Fruchtbarkeits-Grenzwert f&uuml;r ein Ereignis maxFertility high </li>
<li>minMoisture - min Feuchtigkeits-Grenzwert f&uuml;r ein Ereignis minMoisture low </li>