2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

98_count.pm: new command module added

git-svn-id: https://svn.fhem.de/fhem/trunk@10516 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2016-01-15 21:18:31 +00:00
parent 14d250024a
commit 26c4e6448c
3 changed files with 54 additions and 1 deletions

View File

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

51
fhem/FHEM/98_count.pm Normal file
View File

@ -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
<a name="count"></a>
<h3>count</h3>
<ul>
<code>count [devspec]</code>
<br><br>
Count devices specified by devspec.<br/>
If no devspec given, count will return number of totally defined devices.<br/>
</ul>
=end html
=cut

View File

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