From 6b97fd3317db33547c2871a418b5027f77716bbf Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Sat, 9 Feb 2019 12:13:20 +0000 Subject: [PATCH] 98_count.pm: add parameter "raw" git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18543 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/98_count.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/FHEM/98_count.pm b/FHEM/98_count.pm index 242b84903..e88a675f3 100644 --- a/FHEM/98_count.pm +++ b/FHEM/98_count.pm @@ -5,7 +5,6 @@ use strict; use warnings; sub count_Initialize($$) { - $cmds{count} = { Fn => "CommandCount", Hlp=>"[filter],count devices"}; } @@ -14,14 +13,16 @@ sub CommandCount($$) { my ($cl, $param) = @_; my $str = ""; - my $fill = ""; + my $fill = $str; my $n = 0; - + my $raw = $n; + if(!$param) { # List of all devices $n = keys %defs; $fill = "s" if $n != 1; $str = "\nCount: $n device$fill in total.\n"; } else { # devspecArray + $raw = $param =~ s/ raw$//i; $n = 0; my @list = devspec2array($param,$cl); $n = int(@list); @@ -34,7 +35,8 @@ sub CommandCount($$) $str = "\nCount: $n device$fill for devspec $param\n"; } - return $str; + return $str unless $raw; + return $n; } 1; @@ -48,10 +50,12 @@ sub CommandCount($$)

count

=end html