From 7b7164ec0a98628249794f9e34bc27d94a4aabe2 Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Sat, 5 Jun 2021 03:06:35 +0000 Subject: [PATCH] 50_HP1000: change time format for Internal SYSTEMTIME_UTC git-svn-id: https://svn.fhem.de/fhem/trunk@24587 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/50_HP1000.pm | 47 +++++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 436b20463..09f92a4c8 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 50_HP1000: change time format for Internal SYSTEMTIME_UTC - bugfix: 73_AutoShuttersControl: add multiple Condition for fixing shutter drives - bugfix: 89_AndroidDBHost: Fixed module not loaded error diff --git a/fhem/FHEM/50_HP1000.pm b/fhem/FHEM/50_HP1000.pm index ee858a889..cca1ce2ff 100755 --- a/fhem/FHEM/50_HP1000.pm +++ b/fhem/FHEM/50_HP1000.pm @@ -412,7 +412,9 @@ sub HP1000_CGI() { my $result = "Initialized"; my $webArgs; my $servertype; - + + Log3 $name, 5, "HP1000 $name: called function HP1000_CGI()"; + #TODO: should better be blocked in FHEMWEB already return ( "text/plain; charset=utf-8", "Booting up" ) unless ($init_done); @@ -466,7 +468,6 @@ sub HP1000_CGI() { } if ( !defined( $webArgs->{softwaretype} ) - || !defined( $webArgs->{dateutc} ) || !defined( $webArgs->{action} ) ) { Log3 $name, 5, @@ -514,18 +515,21 @@ sub HP1000_CGI() { HP1000_SetAliveState( $hash, 1 ); - $hash->{IP} = $defs{$FW_cname}{PEER}; - $hash->{SERVER_TYPE} = $servertype; - $hash->{SWVERSION} = $webArgs->{softwaretype}; - $hash->{INTERVAL} = ( - $hash->{SYSTEMTIME_UTC} - ? time_str2num( $webArgs->{dateutc} ) - - time_str2num( $hash->{SYSTEMTIME_UTC} ) - : 0 - ); - $hash->{SYSTEMTIME_UTC} = $webArgs->{dateutc}; - $hash->{UPLOAD_TYPE} = "default"; - $hash->{UPLOAD_TYPE} = "customize" + $hash->{IP} = $defs{$FW_cname}{PEER}; + $hash->{SERVER_TYPE} = $servertype; + $hash->{SWVERSION} = $webArgs->{softwaretype}; + + $hash->{INTERVAL} = ( + $hash->{helper}->{SYSTEMTIME_UTC} + ? strftime('%s',gmtime()) - + $hash->{helper}->{SYSTEMTIME_UTC} + : 0 + ); + $hash->{SYSTEMTIME_UTC} = gmtime(); + $hash->{helper}->{SYSTEMTIME_UTC} = strftime('%s',gmtime()); + + $hash->{UPLOAD_TYPE} = "default"; + $hash->{UPLOAD_TYPE} = "customize" if ( defined( $webArgs->{solarradiation} ) ); Log3 $name, 5, @@ -588,16 +592,17 @@ sub HP1000_CGI() { # Filter values that seem bogus if ( AttrVal( $name, 'bogusFilter', 0 ) ne '0' ) { - foreach ($webArgs) { - next unless ( looks_like_number( $webArgs->{$_} ) ); - - if ( $webArgs->{$_} < -273.2 ) { + Log3 $name, 5, + "HP1000: Check data for bogus values"; + foreach my $element (keys %{$webArgs}) { + next unless ( looks_like_number( $webArgs->{$element} ) ); + if ( $webArgs->{$element} < -273.2 ) { Log3 $name, 4, "HP1000: " . "Received value '" - . $webArgs->{$_} - . "' for '$_' seems out of range - removed from data set"; - delete $webArgs->{$_}; + . $webArgs->{$element} + . "' for '$element' seems out of range - removed from data set"; + delete $webArgs->{$element}; } } }