From 5aab69ddd09f88b002450b0e75b2becb07c6e763 Mon Sep 17 00:00:00 2001 From: fhemzap <> Date: Thu, 14 Jan 2016 19:32:13 +0000 Subject: [PATCH] HMCCUDEV: CCU access modes State and Value git-svn-id: https://svn.fhem.de/fhem/trunk@10503 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/HMCCU/88_HMCCUDEV.pm | 33 ++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/fhem/contrib/HMCCU/88_HMCCUDEV.pm b/fhem/contrib/HMCCU/88_HMCCUDEV.pm index 7e43e8ed6..f414a3555 100644 --- a/fhem/contrib/HMCCU/88_HMCCUDEV.pm +++ b/fhem/contrib/HMCCU/88_HMCCUDEV.pm @@ -4,7 +4,7 @@ # # $Id:$ # -# Version 2.4 +# Version 2.5 # # (c) 2015 zap (zap01 t-online de) # @@ -64,7 +64,7 @@ sub HMCCUDEV_Initialize ($) $hash->{GetFn} = "HMCCUDEV_Get"; $hash->{AttrFn} = "HMCCUDEV_Attr"; - $hash->{AttrList} = "IODev ccureadingfilter ccureadingformat:name,address ccureadings:0,1 ccustate statevals substitute statechannel statedatapoint stripnumber:0,1,2 loglevel:0,1,2,3,4,5,6 ". $readingFnAttributes; + $hash->{AttrList} = "IODev ccureadingfilter ccureadingformat:name,address ccureadings:0,1 ccustate ccuget:State,Value statevals substitute statechannel statedatapoint stripnumber:0,1,2 loglevel:0,1,2,3,4,5,6 ". $readingFnAttributes; } ##################################### @@ -346,13 +346,23 @@ sub HMCCUDEV_Get ($@) return $ccureadings ? undef : $result; } elsif ($opt eq 'update') { - $rc = HMCCU_GetUpdate ($hash, $hash->{ccuaddr}); + my $ccuget = shift @a; + $ccuget = 'Attr' if (!defined ($ccuget)); + if ($ccuget !~ /^(Attr|State|Value)$/) { + return HMCCUDEV_SetError ($hash, "Usage: get $name update [{'State'|'Value'}]"); + } + $rc = HMCCU_GetUpdate ($hash, $hash->{ccuaddr}, $ccuget); return HMCCUDEV_SetError ($hash, $rc) if ($rc < 0); return undef; } elsif ($opt eq 'deviceinfo') { - $result = HMCCU_GetDeviceInfo ($hash, $hash->{ccuaddr}); + my $ccuget = shift @a; + $ccuget = 'Attr' if (!defined ($ccuget)); + if ($ccuget !~ /^(Attr|State|Value)$/) { + return HMCCUDEV_SetError ($hash, "Usage: get $name deviceinfo [{'State'|'Value'}]"); + } + $result = HMCCU_GetDeviceInfo ($hash, $hash->{ccuaddr}, $ccuget); return HMCCUDEV_SetError ($hash, -2) if ($result eq ''); return $result; } @@ -501,9 +511,11 @@ sub HMCCUDEV_SetError ($$)
Get description of configuration parameters for CCU device.
-
  • get <name> update -
    +
  • get <name> update [{'State'|'Value'}]
    Update datapoints / readings of device. +

  • +
  • get <name> deviceinfo [{'State'|'Value'}]
    + Display all channels and datapoints of device.

  • @@ -512,9 +524,12 @@ sub HMCCUDEV_SetError ($$) Attributes