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

HMCCU: New command set rpcparameter

git-svn-id: https://svn.fhem.de/fhem/trunk@20134 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2019-09-08 12:19:00 +00:00
parent b496ea6955
commit 4eaa7c443b
5 changed files with 65 additions and 31 deletions

View File

@ -1,5 +1,6 @@
# 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.
- feature: 88_HMCCU: new rpc set command
- bugfix: 74_AMADautomagicFlowset: change Flowset Action TTS to use network
engine
- feature: 30_tradfri: blind support

View File

@ -4,7 +4,7 @@
#
# $Id$
#
# Version 4.3.017
# Version 4.3.018
#
# Module for communication between FHEM and Homematic CCU2/3.
#
@ -52,7 +52,7 @@ my %HMCCU_CUST_CHN_DEFAULTS;
my %HMCCU_CUST_DEV_DEFAULTS;
# HMCCU version
my $HMCCU_VERSION = '4.3.017';
my $HMCCU_VERSION = '4.3.018';
# Constants and default values
my $HMCCU_MAX_IOERRORS = 100;
@ -4751,23 +4751,23 @@ sub HMCCU_IsValidDevice ($$$)
elsif (HMCCU_IsDevAddr ($param, 0)) {
$a = $param;
}
else {
HMCCU_Log ($hash, 3, "$param is not a valid address", 0);
}
# else {
# HMCCU_Log ($hash, 3, "$param is not a valid address", 0);
# }
if (exists ($hash->{hmccu}{dev}{$a})) {
return $hash->{hmccu}{dev}{$a}{valid};
}
else {
HMCCU_Log ($hash, 3, "Address $param not found", 0);
}
# else {
# HMCCU_Log ($hash, 3, "Address $param not found", 0);
# }
# Special address for Non-Homematic devices
if (($mode & $HMCCU_FL_EXADDRESS) && exists ($hash->{hmccu}{dev}{$param})) {
return $hash->{hmccu}{dev}{$param}{valid} && $hash->{hmccu}{dev}{$param}{addtype} eq 'dev' ? 1 : 0;
}
HMCCU_Log ($hash, 3, "Invalid address $param", 0);
# HMCCU_Log ($hash, 3, "Invalid address $param", 0);
}
# Name
@ -4775,9 +4775,9 @@ sub HMCCU_IsValidDevice ($$$)
if (exists ($hash->{hmccu}{adr}{$param})) {
return $hash->{hmccu}{adr}{$param}{valid} && $hash->{hmccu}{adr}{$param}{addtype} eq 'dev' ? 1 : 0;
}
else {
HMCCU_Log ($hash, 3, "Device $param not found", 0);
}
# else {
# HMCCU_Log ($hash, 3, "Device $param not found", 0);
# }
}
return 0;

View File

@ -4,7 +4,7 @@
#
# $Id$
#
# Version 4.3.007
# Version 4.3.008
#
# (c) 2019 zap (zap01 <at> t-online <dot> de)
#
@ -208,7 +208,7 @@ sub HMCCUCHN_Set ($@)
return "No set command specified" if (!defined ($opt));
my $rocmds = "clear defaults:noArg";
my $rwcmds = "clear config control datapoint defaults:noArg devstate rpcParameter";
my $rwcmds = "clear config control datapoint defaults:noArg rpcparameter devstate";
# Get I/O device, check device state
return undef if (!defined ($hash->{ccudevstate}) || $hash->{ccudevstate} eq 'pending' ||
@ -423,15 +423,25 @@ sub HMCCUCHN_Set ($@)
return HMCCU_SetError ($hash, $rc) if ($rc < 0);
return HMCCU_SetState ($hash, "OK");
}
elsif ($opt eq 'rpcParameter') {
return HMCCU_SetError ($hash, "Usage: set $name rpcParameter [MASTER|VALUES] {parameter}={value} [...]")
elsif ($opt eq 'rpcparameter') {
return HMCCU_SetError ($hash, "Usage: set $name rpcparameter [MASTER|VALUES] {parameter}={value} [...]")
if ((scalar keys %{$h}) < 1);
my $key = shift @$a;
$key = 'VALUES' if (!defined ($key));
return HMCCU_SetError ($hash, "Key must be MASTER or VALUES")
if ($key ne 'MASTER' && $key ne 'VALUES');
my ($rc, $res) = HMCCU_RPCRequest ($hash, "putParamset", $ccuaddr, $key, $h);
my $rc;
my $res;
if ($key eq 'VALUES') {
($rc, $res) = HMCCU_SetMultipleParameters ($hash, $ccuaddr, $h);
}
elsif ($key eq 'MASTER') {
($rc, $res) = HMCCU_RPCRequest ($hash, "putParamset", $ccuaddr, $key, $h);
}
else {
return HMCCU_SetError ($hash, "Key must be MASTER or VALUES");
}
return HMCCU_SetError ($hash, $rc) if ($rc < 0);
return HMCCU_SetState ($hash, "OK");
}
@ -729,6 +739,11 @@ sub HMCCUCHN_Get ($@)
set myswitch pct 100 600 10
</code>
</li><br/>
<li><b>set &lt;name&gt; rpcparameter { VALUES | MASTER } &lt;parameter&gt;=&lt;value&gt; [...]</b><br/>
Set multiple datapoints or config parameters by using RPC interface instead of Rega.
Supports attribute 'ccuscaleval' for datapoints. Parameter <i>parameter</i> must be a valid
datapoint or config parameter name.
</li><br/>
<li><b>set &lt;name&gt; up [&lt;value&gt;]</b><br/>
Increment value of datapoint LEVEL. This command is only available if channel contains
a datapoint LEVEL. Default for <i>value</i> is 10.

View File

@ -4,7 +4,7 @@
#
# $Id$
#
# Version 4.3.009
# Version 4.3.010
#
# (c) 2019 zap (zap01 <at> t-online <dot> de)
#
@ -601,27 +601,38 @@ sub HMCCUDEV_Set ($@)
return HMCCU_SetState ($hash, "OK");
}
elsif ($opt eq 'rpcParameter') {
return HMCCU_SetError ($hash, "Usage: set $name rpcParameter [channel] [MASTER|VALUES] {parameter}={value} [...]")
elsif ($opt eq 'rpcparameter') {
return HMCCU_SetError ($hash, "Usage: set $name rpcparameter { channel VALUES | [channel] MASTER } {parameter}={value} [...]")
if ((scalar keys %{$h}) < 1);
my $key;
my $addr;
my $chn;
my $rc;
my $res;
while (my $p = shift @$a) {
if ($p =~ /^(MASTER|VALUES)$/ && !defined ($key)) {
$key = $p;
if (uc($p) =~ /^(MASTER|VALUES)$/ && !defined ($key)) {
$key = uc($p);
}
elsif ($p =~ /^([0-9]+)$/ && !defined ($addr)) {
elsif ($p =~ /^([0-9]+)$/ && !defined ($chn)) {
HMCCU_SetError ($hash, -7) if ($p >= $hash->{channels});
$addr = $p;
$chn = $p;
}
}
$key = 'VALUES' if (!defined ($key));
$addr = defined ($addr) ? "$ccuaddr:$addr" : $ccuaddr;
my $addr = defined ($chn) ? "$ccuaddr:$chn" : $ccuaddr;
if ($key eq 'VALUES') {
($rc, $res) = HMCCU_SetMultipleParameters ($hash, $addr, $h);
}
elsif ($key eq 'MASTER') {
($rc, $res) = HMCCU_RPCRequest ($hash, "putParamset", $addr, $key, $h);
}
else {
return HMCCU_SetError ($hash, "Key must be MASTER or VALUES");
}
my ($rc, $res) = HMCCU_RPCRequest ($hash, "putParamset", $addr, $key, $h);
return HMCCU_SetError ($hash, $rc) if ($rc < 0);
return HMCCU_SetState ($hash, "OK");
}
@ -634,7 +645,7 @@ sub HMCCUDEV_Set ($@)
return "HMCCUCHN: Unknown argument $opt, choose one of ".$rocmds
if ($hash->{statevals} eq 'readonly');
my $retmsg = "HMCCUDEV: Unknown argument $opt, choose one of clear config control datapoint defaults:noArg";
my $retmsg = "HMCCUDEV: Unknown argument $opt, choose one of clear config control datapoint rpcparameter defaults:noArg";
if ($sc ne '') {
$retmsg .= " devstate";
if ($hash->{statevals} ne '') {
@ -932,6 +943,13 @@ sub HMCCUDEV_Get ($@)
<li><b>set &lt;name&gt; pct &lt;value;&gt; [&lt;ontime&gt; [&lt;ramptime&gt;]]</b><br/>
<a href="#HMCCUCHNset">see HMCCUCHN</a>
</li><br/>
<li><b>set &lt;name&gt; rpcparameter { &lt;channel&gt; VALUES | [&lt;channel&gt;] MASTER } &lt;parameter&gt;=&lt;value&gt; [...]</b><br/>
Set multiple datapoints or config parameters by using RPC interface instead of Rega.
Supports attribute 'ccuscaleval' for datapoints. Method VALUES (setting datapoints)
requires a channel number. For method MASTER (setting parameters) a channel number
is optional (setting device parameters). Parameter <i>parameter</i> must be a valid
datapoint or config parameter name.
</li><br/>
<li><b>set &lt;name&gt; &lt;statevalue&gt;</b><br/>
State datapoint of a CCU device channel is set to 'statevalue'. State channel and state
datapoint must be defined as attribute 'statedatapoint'. Values for <i>statevalue</i>

View File

@ -730,7 +730,7 @@ use vars qw(%HMCCU_SCRIPTS);
"HmIP-BROLL|HmIP-FROLL" => {
_description => "Rollladenaktor",
ccureadingfilter => "3.LEVEL;(ERROR_CODE|ERROR_OVERHEAT|ACTUAL_TEMPERATURE|ACTIVITY_STATE|SELF_CALIBRATION_RESULT)",
ccureadingname => "3.LEVEL$:+control,+pct",
ccureadingname => "3.LEVEL\$:+control,+pct",
ccuscaleval => "LEVEL:0:1:0:100",
cmdIcon => "up:fts_shutter_up stop:fts_shutter_manual down:fts_shutter_down",
controldatapoint => "4.LEVEL",