From 95bacf15226b21f4805e3bf15f79e6a049b3db8c Mon Sep 17 00:00:00 2001 From: jpawlowski Date: Sat, 4 Jan 2014 09:40:02 +0000 Subject: [PATCH] ENIGMA2: fix readings update for boxinfo git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4552 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/70_ENIGMA2.pm | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/FHEM/70_ENIGMA2.pm b/FHEM/70_ENIGMA2.pm index 0b46ab563..359cb81e9 100644 --- a/FHEM/70_ENIGMA2.pm +++ b/FHEM/70_ENIGMA2.pm @@ -24,7 +24,7 @@ # along with fhem. If not, see . # # -# Version: 1.2.3 +# Version: 1.2.4 # # Major Version History: # - 1.2.0 - 2013-12-21 @@ -104,8 +104,6 @@ sub ENIGMA2_GetStatus($;$) { my $interval = $hash->{INTERVAL}; my $state = ''; my $boxinfo; - my $serviceinfo; - my $eventinfo; my $currsrvinfo; my $signalinfo; my $vol; @@ -317,12 +315,15 @@ sub ENIGMA2_GetStatus($;$) { # Read Boxinfo every 10 minutes only if ( - !defined( $hash->{helper}{lastStatusUpdate} ) - || ( defined( $hash->{helper}{lastStatusUpdate} ) - && $hash->{helper}{lastStatusUpdate} + 900 le time() ) + !defined( $hash->{helper}{lastFullUpdate} ) + || ( defined( $hash->{helper}{lastFullUpdate} ) + && $hash->{helper}{lastFullUpdate} + 900 le time() ) ) { $boxinfo = ENIGMA2_SendCommand( $hash, "about", "" ); + + # Update state + $hash->{helper}{lastFullUpdate} = time(); } # get current states @@ -438,7 +439,7 @@ sub ENIGMA2_GetStatus($;$) { $boxinfo->{e2about}{e2hddinfo}[$i]{capacity} ); if ( !defined( $hash->{READINGS}{$readingname}{VAL} ) - || ( ref(@value) eq "ARRAY" + || ( @value && $hash->{READINGS}{$readingname}{VAL} ne $value[0] ) ) @@ -451,7 +452,7 @@ sub ENIGMA2_GetStatus($;$) { split( / /, $boxinfo->{e2about}{e2hddinfo}[$i]{free} ); if ( !defined( $hash->{READINGS}{$readingname}{VAL} ) - || ( ref(@value) eq "ARRAY" + || ( @value && $hash->{READINGS}{$readingname}{VAL} ne $value[0] ) ) @@ -479,7 +480,7 @@ sub ENIGMA2_GetStatus($;$) { split( / /, $boxinfo->{e2about}{e2hddinfo}{capacity} ); if ( !defined( $hash->{READINGS}{$readingname}{VAL} ) - || ( ref(@value) eq "ARRAY" + || ( @value && $hash->{READINGS}{$readingname}{VAL} ne $value[0] ) ) { @@ -490,7 +491,7 @@ sub ENIGMA2_GetStatus($;$) { @value = split( / /, $boxinfo->{e2about}{e2hddinfo}{free} ); if ( !defined( $hash->{READINGS}{$readingname}{VAL} ) - || ( ref(@value) eq "ARRAY" + || ( @value && $hash->{READINGS}{$readingname}{VAL} ne $value[0] ) ) { @@ -890,9 +891,6 @@ sub ENIGMA2_GetStatus($;$) { } } - # Update state - $hash->{helper}{lastStatusUpdate} = time(); - readingsEndUpdate( $hash, 1 ); return $hash->{STATE};