2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00
fhem-mirror/fhem/FHEM/98_count.pm
betateilchen f6671b06bc various modules: add =item to commandref
git-svn-id: https://svn.fhem.de/fhem/trunk@10533 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2016-01-16 20:00:25 +00:00

53 lines
909 B
Perl

# $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
=item command
=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