31_HUEDevice.pm: save lastupdated timestamp across restarts

git-svn-id: https://svn.fhem.de/fhem/trunk@12429 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme1968
2016-10-25 20:20:17 +00:00
parent 4bad008eba
commit 90e8a83de6

View File

@@ -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};
}