From 628a7646018c783a0ebab64594ebf4a2141bea8a Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 30 Sep 2017 19:38:53 +0200 Subject: [PATCH] bugfix in timestampAge function --- 74_XiaomiFlowerSens.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/74_XiaomiFlowerSens.pm b/74_XiaomiFlowerSens.pm index 3fa749e..9385828 100644 --- a/74_XiaomiFlowerSens.pm +++ b/74_XiaomiFlowerSens.pm @@ -602,8 +602,9 @@ sub XiaomiFlowerSens_CallBatteryFirmware_UpdateTimeAge($) { my $hash = shift; - my $UpdateTimeAge = gettimeofday() - $hash->{helper}{updateTimeCallBatteryFirmware}; + $hash->{helper}{updateTimeCallBatteryFirmware} = 0 if( not defined($hash->{helper}{updateTimeCallBatteryFirmware}) ); + my $UpdateTimeAge = gettimeofday() - $hash->{helper}{updateTimeCallBatteryFirmware}; return $UpdateTimeAge; }