2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 12:58:13 +00:00

HMCCU: Version 5.0

git-svn-id: https://svn.fhem.de/fhem/trunk@25028 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2021-09-28 14:14:33 +00:00
parent a396166a1f
commit ee4042bb42
4 changed files with 45 additions and 24 deletions

View File

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

View File

@ -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'.
</li><br/>
<li><b>get &lt;name&gt; extValues [&lt;filter-expr&gt;]</b><br/>
Update all readings for all parameters of parameter set VALUES (datapoints) and connected system
variables by using CCU Rega (Homematic script).
If <i>filter-expr</i> is specified, only datapoints matching the expression are stored as readings.
</li><br/>
<li><b>get &lt;name&gt; paramsetDesc</b><br/>
Display description of parameter sets of channel and device. The output of this command
is helpful to gather information about new / not yet supported devices. Please add this

View File

@ -110,12 +110,12 @@ sub HMCCUDEV_Define ($@)
# Parse optional command line parameters
foreach my $arg (@$a) {
if (lc($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; }
elsif (lc($arg) eq 'forcedev') { $hash->{hmccu}{forcedev} = 1; }
elsif ($arg =~ /^[0-9]+$/) { $attr{$name}{controlchannel} = $arg; }
else { return $usage; }
if (lc($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); }
elsif (lc($arg) eq 'forcedev') { $hash->{hmccu}{forcedev} = 1; }
elsif ($arg =~ /^[0-9]+$/) { $attr{$name}{controlchannel} = $arg; }
else { return $usage; }
}
# IO device can be set by command line parameter iodev, otherwise try to detect IO device
@ -466,7 +466,7 @@ sub HMCCUDEV_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 @dpRList;
@ -519,6 +519,11 @@ sub HMCCUDEV_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");
@ -718,7 +723,10 @@ sub HMCCUDEV_Get ($@)
<li>device and channel description</li>
</ul>
</li><br/>
<li><b>get &lt;name&gt; update [{State | <u>Value</u>}]</b><br/>
<li><b>get &lt;name&gt; extValues [&lt;filter-expr&gt;]</b><br/>
<a href="#HMCCUCHNget">see HMCCUCHN</a>
</li><br/>
<li><b>get &lt;name&gt; update [{State | <u>Value</u>}]</b><br/>
<a href="#HMCCUCHNget">see HMCCUCHN</a>
</li><br/>
<li><b>get &lt;name&gt; weekProgram [&lt;program-number&gt;|<u>all</u>]</b><br/>

View File

@ -1,5 +1,5 @@
UPD 2021-09-09_19:12:29 103713 FHEM/88_HMCCURPCPROC.pm
UPD 2021-09-11_15:40:16 84901 FHEM/HMCCUConf.pm
UPD 2021-09-02_19:33:39 43994 FHEM/88_HMCCUCHN.pm
UPD 2021-09-11_16:31:05 358198 FHEM/88_HMCCU.pm
UPD 2021-09-02_19:33:39 31267 FHEM/88_HMCCUDEV.pm
UPD 2021-09-27_10:23:35 44472 FHEM/88_HMCCUCHN.pm
UPD 2021-09-27_10:29:06 358364 FHEM/88_HMCCU.pm
UPD 2021-09-27_10:19:43 31506 FHEM/88_HMCCUDEV.pm