From e084a79e6a6fdd97957881acb8058da0b4e899e1 Mon Sep 17 00:00:00 2001 From: zap <> Date: Sun, 8 Sep 2019 12:19:00 +0000 Subject: [PATCH] HMCCU: New command set rpcparameter git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@20134 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 1 + FHEM/88_HMCCU.pm | 24 ++++++++++++------------ FHEM/88_HMCCUCHN.pm | 29 ++++++++++++++++++++++------- FHEM/88_HMCCUDEV.pm | 40 +++++++++++++++++++++++++++++----------- FHEM/HMCCUConf.pm | 2 +- 5 files changed, 65 insertions(+), 31 deletions(-) diff --git a/CHANGED b/CHANGED index 9bb8bda88..859d62a27 100644 --- a/CHANGED +++ b/CHANGED @@ -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 diff --git a/FHEM/88_HMCCU.pm b/FHEM/88_HMCCU.pm index dcbc21104..a3f38ae9e 100755 --- a/FHEM/88_HMCCU.pm +++ b/FHEM/88_HMCCU.pm @@ -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; diff --git a/FHEM/88_HMCCUCHN.pm b/FHEM/88_HMCCUCHN.pm index 84946e794..6b88f5eb1 100644 --- a/FHEM/88_HMCCUCHN.pm +++ b/FHEM/88_HMCCUCHN.pm @@ -4,7 +4,7 @@ # # $Id$ # -# Version 4.3.007 +# Version 4.3.008 # # (c) 2019 zap (zap01 t-online 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
+
  • set <name> rpcparameter { VALUES | MASTER } <parameter>=<value> [...]
    + Set multiple datapoints or config parameters by using RPC interface instead of Rega. + Supports attribute 'ccuscaleval' for datapoints. Parameter parameter must be a valid + datapoint or config parameter name. +

  • set <name> up [<value>]
    Increment value of datapoint LEVEL. This command is only available if channel contains a datapoint LEVEL. Default for value is 10. diff --git a/FHEM/88_HMCCUDEV.pm b/FHEM/88_HMCCUDEV.pm index b2798f93e..bad71aa9d 100644 --- a/FHEM/88_HMCCUDEV.pm +++ b/FHEM/88_HMCCUDEV.pm @@ -4,7 +4,7 @@ # # $Id$ # -# Version 4.3.009 +# Version 4.3.010 # # (c) 2019 zap (zap01 t-online 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 ($@)
  • set <name> pct <value;> [<ontime> [<ramptime>]]
    see HMCCUCHN

  • +
  • set <name> rpcparameter { <channel> VALUES | [<channel>] MASTER } <parameter>=<value> [...]
    + 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 parameter must be a valid + datapoint or config parameter name. +

  • set <name> <statevalue>
    State datapoint of a CCU device channel is set to 'statevalue'. State channel and state datapoint must be defined as attribute 'statedatapoint'. Values for statevalue diff --git a/FHEM/HMCCUConf.pm b/FHEM/HMCCUConf.pm index 7a3b8dccd..af4c43784 100644 --- a/FHEM/HMCCUConf.pm +++ b/FHEM/HMCCUConf.pm @@ -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",