From ee4042bb421f555b59dc4c1761c84294bd33e9b0 Mon Sep 17 00:00:00 2001
From: zap <>
Date: Tue, 28 Sep 2021 14:14:33 +0000
Subject: [PATCH] HMCCU: Version 5.0
git-svn-id: https://svn.fhem.de/fhem/trunk@25028 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/contrib/HMCCU/FHEM/88_HMCCU.pm | 19 +++++++++++--------
fhem/contrib/HMCCU/FHEM/88_HMCCUCHN.pm | 20 +++++++++++++++-----
fhem/contrib/HMCCU/FHEM/88_HMCCUDEV.pm | 24 ++++++++++++++++--------
fhem/contrib/HMCCU/controls_HMCCU.txt | 6 +++---
4 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/fhem/contrib/HMCCU/FHEM/88_HMCCU.pm b/fhem/contrib/HMCCU/FHEM/88_HMCCU.pm
index 48b5ee703..ae5cc5f76 100644
--- a/fhem/contrib/HMCCU/FHEM/88_HMCCU.pm
+++ b/fhem/contrib/HMCCU/FHEM/88_HMCCU.pm
@@ -57,7 +57,7 @@ my %HMCCU_CUST_CHN_DEFAULTS;
my %HMCCU_CUST_DEV_DEFAULTS;
# HMCCU version
-my $HMCCU_VERSION = '5.0';
+my $HMCCU_VERSION = '5.0 212691835';
# Timeout for CCU requests (seconds)
my $HMCCU_TIMEOUT_REQUEST = 4;
@@ -193,7 +193,7 @@ sub HMCCU_SubstVariables ($$$);
# Update client device readings
sub HMCCU_BulkUpdate ($$$;$);
-sub HMCCU_GetUpdate ($$$);
+sub HMCCU_GetUpdate ($$;$$);
sub HMCCU_RefreshReadings ($);
sub HMCCU_UpdateCB ($$$);
sub HMCCU_UpdateClients ($$$$;$$);
@@ -9093,12 +9093,14 @@ sub HMCCU_SetVariable ($$$$$)
# Update all datapoints / readings of device or channel considering
# attribute ccureadingfilter.
# Parameter $ccuget can be 'State', 'Value' or 'Attr'.
-# Return 1 on success, <= 0 on error
+# Return 1 on success, < 0 on error
######################################################################
-sub HMCCU_GetUpdate ($$$)
+sub HMCCU_GetUpdate ($$;$$)
{
- my ($clHash, $addr, $ccuget) = @_;
+ my ($clHash, $addr, $filter, $ccuget) = @_;
+ $filter //= '.*';
+ $ccuget //= 'Value';
my $name = $clHash->{NAME};
my $type = $clHash->{TYPE};
@@ -9140,7 +9142,7 @@ sub HMCCU_GetUpdate ($$$)
if (HMCCU_IsFlag ($ioHash->{NAME}, 'nonBlocking')) {
# Non blocking request
HMCCU_HMScriptExt ($ioHash, $script, { list => $list, ccuget => $ccuget },
- \&HMCCU_UpdateCB);
+ \&HMCCU_UpdateCB, { filter => $filter });
return 1;
}
@@ -9151,7 +9153,7 @@ sub HMCCU_GetUpdate ($$$)
"Script response = \n".$response);
return -2 if ($response eq '' || $response =~ /^ERROR:.*/);
- HMCCU_UpdateCB ({ ioHash => $ioHash }, undef, $response);
+ HMCCU_UpdateCB ({ ioHash => $ioHash, filter => $filter }, undef, $response);
return 1;
}
@@ -9173,6 +9175,7 @@ sub HMCCU_UpdateCB ($$$)
}
my $hash = $param->{ioHash};
+ my $filter = $param->{filter} // '.*';
my $logcount = exists($param->{logCount}) && $param->{logCount} == 1 ? 1 : 0;
my $count = 0;
@@ -9186,7 +9189,7 @@ sub HMCCU_UpdateCB ($$$)
my ($chnname, $dpspec, $value) = split /=/, $dp;
next if (!defined($value));
my ($iface, $chnadd, $dpt) = split /\./, $dpspec;
- next if (!defined($dpt));
+ next if (!defined($dpt) || $dpt !~ /$filter/);
my ($add, $chn) = ('', '');
if ($iface eq 'sysvar' && $chnadd eq 'link') {
($add, $chn) = HMCCU_GetAddress ($hash, $chnname);
diff --git a/fhem/contrib/HMCCU/FHEM/88_HMCCUCHN.pm b/fhem/contrib/HMCCU/FHEM/88_HMCCUCHN.pm
index 023ba0f6c..970c8a0e4 100644
--- a/fhem/contrib/HMCCU/FHEM/88_HMCCUCHN.pm
+++ b/fhem/contrib/HMCCU/FHEM/88_HMCCUCHN.pm
@@ -100,10 +100,10 @@ sub HMCCUCHN_Define ($@)
my $n = 0;
while (my $arg = shift @$a) {
return $usage if ($n == 3);
- if ($arg eq 'readonly') { $hash->{readonly} = 'yes'; }
- elsif (lc($arg) eq 'nodefaults' && $init_done) { $hash->{hmccu}{nodefaults} = 1; }
- elsif (lc($arg) eq 'defaults' && $init_done) { $hash->{hmccu}{nodefaults} = 0; }
- else { return $usage; }
+ if ($arg eq 'readonly') { $hash->{readonly} = 'yes'; }
+ elsif (lc($arg) eq 'nodefaults') { $hash->{hmccu}{nodefaults} = 1 if ($init_done); }
+ elsif (lc($arg) eq 'defaults') { $hash->{hmccu}{nodefaults} = 0 if ($init_done); }
+ else { return $usage; }
$n++;
}
@@ -390,7 +390,7 @@ sub HMCCUCHN_Get ($@)
my $ccuflags = AttrVal ($name, 'ccuflags', 'null');
# Build set command syntax
- my $syntax = 'update:noArg config:noArg paramsetDesc:noArg deviceInfo:noArg values:noArg';
+ my $syntax = 'update config paramsetDesc:noArg deviceInfo:noArg values extValues';
# Command datapoint depends on readable datapoints
my ($add, $chn) = split(":", $hash->{ccuaddr});
@@ -428,6 +428,11 @@ sub HMCCUCHN_Get ($@)
return HMCCU_SetError ($hash, "Can't get device description") if (!defined($result));
return HMCCU_DisplayGetParameterResult ($ioHash, $hash, $result);
}
+ elsif ($lcopt eq 'extvalues') {
+ my $filter = shift @$a;
+ my $rc = HMCCU_GetUpdate ($hash, $ccuaddr, $filter);
+ return $rc < 0 ? HMCCU_SetError ($hash, $rc) : 'OK';
+ }
elsif ($lcopt eq 'paramsetdesc') {
my $result = HMCCU_ParamsetDescToStr ($ioHash, $hash);
return defined($result) ? $result : HMCCU_SetError ($hash, "Can't get device model");
@@ -636,6 +641,11 @@ sub HMCCUCHN_Get ($@)
Please add this information to your post in the FHEM forum, if you have a question about
the integration of a new device. See also command 'get paramsetDesc'.
+