From 90e8a83de6e442b94d1ab9f015bb02692a1e5fb6 Mon Sep 17 00:00:00 2001 From: justme1968 Date: Tue, 25 Oct 2016 20:20:17 +0000 Subject: [PATCH] 31_HUEDevice.pm: save lastupdated timestamp across restarts git-svn-id: https://svn.fhem.de/fhem/trunk@12429 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/31_HUEDevice.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/31_HUEDevice.pm b/fhem/FHEM/31_HUEDevice.pm index 7b761759a..56ef990a1 100644 --- a/fhem/FHEM/31_HUEDevice.pm +++ b/fhem/FHEM/31_HUEDevice.pm @@ -1201,7 +1201,9 @@ HUEDevice_Parse($$) $lastupdated = FmtDateTime($sec); } - return undef if( $hash->{lastupdated} && $hash->{lastupdated} eq $lastupdated ); + + $hash->{lastupdated} = ReadingsVal( $name, '.lastupdated', undef ) if( !$hash->{lastupdated} ); + return undef if( $hash->{lastupdated} && $hash->{lastupdated} eq $lastupdated ); Log3 $name, 4, "$name: lastupdated: $lastupdated, hash->{lastupdated}: $hash->{lastupdated}"; Log3 $name, 5, "$name: ". Dumper $result; @@ -1238,6 +1240,12 @@ HUEDevice_Parse($$) } } + if( $lastupdated ) { + $hash->{'.updateTimestamp'} = $lastupdated; + $hash->{CHANGETIME}[$i] = $lastupdated; + readingsBulkUpdate($hash, '.lastupdated', $lastupdated, 0); + } + readingsEndUpdate($hash,1); delete $hash->{CHANGETIME}; }