diff --git a/fhem/CHANGED b/fhem/CHANGED index 0daf2c3ae..05e5efdad 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # 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. + - changed: 98_fheminfo.pm: remove release, featurelevel, uptime infos + - added: 98_uptime.pm: new command module to show FHEM uptime - change: 93_DbLog: V2.19.0, replace internal DBMODEL by MODEL completely - update: 88_HMCCU: Version 4.1 - feature: 93_DbRep: V5.5.0, new command restoreMySQL, use new Internal diff --git a/fhem/FHEM/98_fheminfo.pm b/fhem/FHEM/98_fheminfo.pm index 88cbb0491..93e092646 100644 --- a/fhem/FHEM/98_fheminfo.pm +++ b/fhem/FHEM/98_fheminfo.pm @@ -73,16 +73,12 @@ sub CommandFheminfo($$) { # sub _fi2_Count() { my $uniqueID = getUniqueId(); - my $release = "5.8"; - my $feature = $featurelevel ? $featurelevel : $release; my $os = $^O; my $perl = sprintf("%vd", $^V); %fhemInfo = (); $fhemInfo{$c_system}{'uniqueID'} = $uniqueID; - $fhemInfo{$c_system}{'release'} = $release; - $fhemInfo{$c_system}{'feature'} = $feature; $fhemInfo{$c_system}{'os'} = $os; $fhemInfo{$c_system}{'perl'} = $perl; $fhemInfo{$c_system}{'revision'} = _fi2_findRev(); @@ -171,19 +167,15 @@ sub _fi2_Send() { sub _fi2_TelnetTable($) { my ($doSend) = shift; - my $upTime = _fi2_Uptime(); my $str; $str .= "Following statistics data will be sent to server:\n(see Logfile level 4 for server response)\n\n" if($doSend == 1); $str .= "System Info\n"; - $str .= sprintf(" Release%*s: %s\n",6," ",$fhemInfo{$c_system}{'release'}); - $str .= sprintf(" FeatureLevel%*s: %s\n",0," ",$fhemInfo{$c_system}{'feature'}); $str .= sprintf(" ConfigType%*s: %s\n",3," ",$fhemInfo{$c_system}{'configType'}); $str .= sprintf(" SVN revision%*s: %s\n",0," ",$fhemInfo{$c_system}{'revision'}) if (defined($fhemInfo{$c_system}{'revision'})); $str .= sprintf(" OS%*s: %s\n",11," ",$fhemInfo{$c_system}{'os'}); $str .= sprintf(" Perl%*s: %s\n",9," ",$fhemInfo{$c_system}{'perl'}); $str .= sprintf(" uniqueID%*s: %s\n",5," ",_fi2_shortId()); - $str .= sprintf(" upTime%*s: %s\n",7," ",$upTime); my @keys = keys %fhemInfo; foreach my $type (sort @keys) @@ -201,19 +193,15 @@ sub _fi2_TelnetTable($) { sub _fi2_HtmlTable($) { my ($doSend) = shift; - my $upTime = _fi2_Uptime(); my $result = ""; $result .= "" if($doSend == 1); $result .= ""; - $result .= ""; - $result .= ""; $result .= ""; $result .= "" if (defined($fhemInfo{$c_system}{'revision'})); $result .= ""; $result .= ""; $result .= ""; - $result .= ""; $result .= ""; $result .= ""; @@ -231,27 +219,6 @@ sub _fi2_HtmlTable($) { return $result; } -sub _fi2_Uptime() { - my $diff = time - $fhem_started; - my ($d,$h,$m,$ret); - - ($d,$diff) = _fi2_Div($diff,86400); - ($h,$diff) = _fi2_Div($diff,3600); - ($m,$diff) = _fi2_Div($diff,60); - - $ret = ""; - $ret .= "$d days, " if($d > 1); - $ret .= "1 day, " if($d == 1); - $ret .= sprintf("%02s:%02s:%02s", $h, $m, $diff); - - return $ret; -} - -sub _fi2_Div($$) { - my ($p1,$p2) = @_; - return (int($p1/$p2), $p1 % $p2); -} - sub _fi2_findRev() { my $cf = 'controls_fhem.txt'; my $filename = (-e "./$cf") ? "./$cf" : AttrVal("global","modpath",".")."/FHEM/$cf"; @@ -312,20 +279,18 @@ sub _fi2_shortId() {

The optional parameter send transmitts the collected data - to a central server in order to support the development of FHEM. The - transmitted data is processed graphically. The results can be viewed - on http://fhem.de/stats/statistics.html. + to a central server in order to support the development of FHEM.
+ The submitted data is processed graphically. The results can be viewed + on http://fhem.de/stats/statistics.html.
The IP address will not be stored in database, only used for region determination during send.

Features:
diff --git a/fhem/FHEM/98_uptime.pm b/fhem/FHEM/98_uptime.pm new file mode 100644 index 000000000..085201d7e --- /dev/null +++ b/fhem/FHEM/98_uptime.pm @@ -0,0 +1,77 @@ +=for comment + +# $Id$ + +This script free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +any later version. + +The GNU General Public License can be found at +http://www.gnu.org/copyleft/gpl.html. +A copy is found in the textfile GPL.txt and important notices to the license +from the author is found in LICENSE.txt distributed with these scripts. + +This script is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +=cut + +package main; +use strict; +use warnings; + +sub uptime_Initialize($$) { + my %hash = ( + Fn => "CommandUptime", + Hlp => ",show FHEM uptime", + ); + $cmds{uptime} = \%hash; +} + +sub CommandUptime($$) { + my ($cl,$param) = @_; + my @args = split("[ \t]+", $param); + + my $diff = time - $fhem_started; + my ($d,$h,$m,$ret); + + ($d,$diff) = _upT_Div($diff,86400); + ($h,$diff) = _upT_Div($diff,3600); + ($m,$diff) = _upT_Div($diff,60); + + $ret = ""; + $ret .= "$d days, " if($d > 1); + $ret .= "1 day, " if($d == 1); + $ret .= sprintf("%02s:%02s:%02s", $h, $m, $diff); + + return $ret; +} + +sub _upT_Div($$) { + my ($p1,$p2) = @_; + return (int($p1/$p2), $p1 % $p2); +} + +1; + +=pod +=item command +=item summary show FHEM uptime +=item summary_DE zeigt FHEM Laufzeit an +=begin html + + +

uptime/h3> + + +=end html +=cut

Following statistics data will be sent to server:
(see Logfile level 4 for server response)
System Info
Release:$fhemInfo{$c_system}{'release'}
FeatureLevel:$fhemInfo{$c_system}{'feature'}
ConfigType:$fhemInfo{$c_system}{'configType'}
SVN rev:$fhemInfo{$c_system}{'revision'}
OS:$fhemInfo{$c_system}{'os'}
Perl:$fhemInfo{$c_system}{'perl'}
uniqueId:"._fi2_shortId()."
upTime:$upTime
 
ModulesModelCount