From b3348231c85f5b4b4461b6e694d73ae53f67ba0f Mon Sep 17 00:00:00 2001 From: fhemzap <> Date: Fri, 4 Dec 2015 18:06:48 +0000 Subject: [PATCH] HMCCUCHN: get/set CCU device parameters git-svn-id: https://svn.fhem.de/fhem/trunk@10088 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/HMCCU/88_HMCCUCHN.pm | 40 +++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/fhem/contrib/HMCCU/88_HMCCUCHN.pm b/fhem/contrib/HMCCU/88_HMCCUCHN.pm index 81e52f0c9..6c6412b26 100644 --- a/fhem/contrib/HMCCU/88_HMCCUCHN.pm +++ b/fhem/contrib/HMCCU/88_HMCCUCHN.pm @@ -4,7 +4,7 @@ # # $Id:$ # -# Version 2.0 +# Version 2.2 # # (c) 2015 zap (zap01 t-online de) # @@ -15,10 +15,13 @@ # set datapoint [...] # set devstate [...] # set +# set config = [...] # # get devstate # get datapoint # get channel +# get config +# get configdesc # # attr ccureadings { 0 | 1 } # attr statevals :[,...] @@ -158,7 +161,7 @@ sub HMCCUCHN_Set ($@) if (!defined ($hash->{IODev})) { return HMCCUCHN_SetError ($hash, "No IO device defined"); } - if ($hash->{statevals} eq 'readonly') { + if ($hash->{statevals} eq 'readonly' && $opt ne 'config') { return undef; } @@ -210,8 +213,15 @@ sub HMCCUCHN_Set ($@) return undef; } + elsif ($opt eq 'config') { + return HMCCUCHN_SetError ($hash, "Usage: set $name config {parameter}={value} [...]") if (@a < 1);; + + my $rc = HMCCU_RPCSetConfig ($hash, $hash->{ccuaddr}, \@a); + return HMCCUCHN_SetError ($hash, $rc) if ($rc < 0); + return undef; + } else { - my $retmsg = "HMCCUCHN: Unknown argument $opt, choose one of datapoint devstate"; + my $retmsg = "HMCCUCHN: Unknown argument $opt, choose one of config datapoint devstate"; return undef if ($hash->{statevals} eq 'readonly'); if ($hash->{statevals} ne '') { @@ -271,8 +281,22 @@ sub HMCCUCHN_Get ($@) return HMCCUCHN_SetError ($hash, $rc) if ($rc < 0); return $ccureadings ? undef : $result; } + elsif ($opt eq 'config') { + my $ccuobj = $hash->{ccuaddr}; + + my ($rc, $res) = HMCCU_RPCGetConfig ($hash, $ccuobj, "getParamset"); + return HMCCUCHN_SetError ($hash, $rc) if ($rc < 0); + return $ccureadings ? undef : $result; + } + elsif ($opt eq 'configdesc') { + my $ccuobj = $hash->{ccuaddr}; + + my ($rc, $res) = HMCCU_RPCGetConfig ($hash, $ccuobj, "getParamsetDescription"); + return HMCCUCHN_SetError ($hash, $rc) if ($rc < 0); + return $res; + } else { - return "HMCCUCHN: Unknown argument $opt, choose one of devstate:noArg datapoint channel"; + return "HMCCUCHN: Unknown argument $opt, choose one of devstate:noArg datapoint channel config:noArg configdesc:noArg"; } } @@ -378,6 +402,14 @@ sub HMCCUCHN_SetError ($$)
  • get <name> datapoint <datapoint>
    Get value of a CCU device datapoint. +

  • +
  • get <name> config +
    + Get configuration parameters of CCU channel. +

  • +
  • get <name> configdesc +
    + Get description of configuration parameters of CCU channel.