From b71019ca58edadf9c639356e962a69f84a4e3470 Mon Sep 17 00:00:00 2001 From: betateilchen Date: Fri, 15 Jan 2016 21:18:31 +0000 Subject: [PATCH] 98_count.pm: new command module added git-svn-id: https://svn.fhem.de/fhem/trunk@10516 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 ++- fhem/FHEM/98_count.pm | 51 +++++++++++++++++++++++++++++++++++++++++++ fhem/MAINTAINER.txt | 1 + 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 fhem/FHEM/98_count.pm diff --git a/fhem/CHANGED b/fhem/CHANGED index 4379f891f..d67a8184d 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,9 +1,10 @@ # 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. + - added: 98_count: count devices specified by devspec or all - bugfix: 57_CALVIEW: bugfix for started terms - feature: 10_KOPP_FC: Receive Mode for dimmer implemented, change: 10_KOPP_FC: removed "toggle" command, use "on" or "off" instead - - change: 49_SSCam: Vars "USERNAME" and "RECTIME" removed from Internals, + - change: 49_SSCam: Vars "USERNAME" and "RECTIME" removed from Internals, Var (Internals) "SERVERNAME" changed to "SERVERADDR", minor change of Log messages, Note: use rereadcfg in order to activate the changes diff --git a/fhem/FHEM/98_count.pm b/fhem/FHEM/98_count.pm new file mode 100644 index 000000000..9e4dee794 --- /dev/null +++ b/fhem/FHEM/98_count.pm @@ -0,0 +1,51 @@ +# $Id$ + +package main; +use strict; +use warnings; + +sub count_Initialize($$) { + + $cmds{count} = { Fn => "CommandCount", + Hlp=>"[filter],count devices"}; +} + +sub CommandCount($$) +{ + my ($cl, $param) = @_; + my $str = ""; + my $fill = ""; + my $n = 0; + + if(!$param) { # List of all devices + $n = keys %defs; + $fill = "s" if $n != 1; + $str = "\nCount: $n device$fill in total.\n"; + } else { # devspecArray + $n = 0; + my @list = devspec2array($param,$cl); + $n = int(@list); + $fill = "s" if $n != 1; + $str = "\nCount: $n device$fill for devspec $param\n"; + } + + return $str; +} + +1; + +=pod +=begin html + + +

count

+ + +=end html + +=cut diff --git a/fhem/MAINTAINER.txt b/fhem/MAINTAINER.txt index d1ef90b9b..2573afc0c 100644 --- a/fhem/MAINTAINER.txt +++ b/fhem/MAINTAINER.txt @@ -314,6 +314,7 @@ FHEM/98_cloneDummy.pm Joachim http://forum.fhem.de Automatis FHEM/98_cmdalias.pm rudolfkoenig http://forum.fhem.de Automatisierung FHEM/98_configdb.pm betateilchen http://forum.fhem.de Sonstiges FHEM/98_copy.pm justme1968 http://forum.fhem.de Sonstiges +FHEM/98_count.pm betateilchen http://forum.fhem.de Sonstiges FHEM/98_CustomReadings.pm HCS http://forum.fhem.de Unterstuetzende Dienste FHEM/98_dewpoint.pm Joachim http://forum.fhem.de Automatisierung FHEM/98_dummy.pm rudolfkoenig http://forum.fhem.de Automatisierung