diff --git a/fhem/contrib/HMCCU/88_HMCCUCHN.pm b/fhem/contrib/HMCCU/88_HMCCUCHN.pm index 22dc6c727..9b1660f86 100644 --- a/fhem/contrib/HMCCU/88_HMCCUCHN.pm +++ b/fhem/contrib/HMCCU/88_HMCCUCHN.pm @@ -4,14 +4,15 @@ # # $Id:$ # -# Version 2.5 +# Version 2.6 # -# (c) 2015 zap (zap01 t-online de) +# (c) 2016 zap (zap01 t-online de) # ################################################################ # # define HMCCUCHN [readonly] # +# set control # set datapoint [...] # set devstate [...] # set @@ -27,11 +28,12 @@ # attr ccureadings { 0 | 1 } # attr ccureadingfilter # attr ccureadingformat { name | address | datapoint } +# attr controldatapoint # attr statevals :[,...] # attr substitute [;...] # ################################################################ -# Requires module 88_HMCCU +# Requires module 88_HMCCU.pm ################################################################ package main; @@ -61,7 +63,7 @@ sub HMCCUCHN_Initialize ($) $hash->{GetFn} = "HMCCUCHN_Get"; $hash->{AttrFn} = "HMCCUCHN_Attr"; - $hash->{AttrList} = "IODev ccureadingfilter ccureadingformat:name,address,datapoint ccureadings:0,1 ccustate ccuget:State,Value statedatapoint statevals substitute stripnumber:0,1,2 loglevel:0,1,2,3,4,5,6 ". $readingFnAttributes; + $hash->{AttrList} = "IODev ccureadingfilter ccureadingformat:name,address,datapoint ccureadings:0,1 ccustate ccuget:State,Value controldatapoint statedatapoint statevals substitute stripnumber:0,1,2 loglevel:0,1,2,3,4,5,6 ". $readingFnAttributes; } ##################################### @@ -176,6 +178,7 @@ sub HMCCUCHN_Set ($@) my $statevals = AttrVal ($name, "statevals", ''); my $statedatapoint = AttrVal ($name, "statedatapoint", 'STATE'); + my $controldatapoint = AttrVal ($name, "controldatapoint", ''); my $result = ''; my $rc; @@ -201,6 +204,16 @@ sub HMCCUCHN_Set ($@) return undef; } + elsif ($opt eq 'control') { + return HMCCUCHN_SetError ($hash, "Attribute control datapoint not set") if ($controldatapoint eq ''); + my $objvalue = shift @a; + my $objname = $hash->{ccuif}.'.'.$hash->{ccuaddr}.':'.$controldatapoint; + $rc = HMCCU_SetDatapoint ($hash, $objname, $objvalue); + return HMCCUDEV_SetError ($hash, $rc) if ($rc < 0); + + HMCCU_SetState ($hash, "OK"); + return undef; + } elsif ($opt =~ /^($hash->{statevals})$/) { my $cmd = $1; my $objvalue = ($cmd ne 'devstate') ? $cmd : join ('%20', @a); @@ -451,6 +464,15 @@ sub HMCCUCHN_SetError ($$)
  • ccureadingfilter <datapoint-expr>
    Only datapoints matching specified expression are stored as readings.

  • +
  • controldatapoint <datapoint>
    + Set datapoint for device control. Can be use to realize user defined control elements for + setting control datapoint. For example if datapoint of thermostat control is + SET_TEMPERATURE one can define a slider for setting the destination temperature with + following attributes:

    + attr mydev controldatapoint SET_TEMPERATURE + attr mydev webCmd control + attr mydev widgetOverride control:slider,10,1,25 +

  • statedatapoint <datapoint>
    Set datapoint for devstate commands.