From f34b8351cabbbb97f965a2c3186d3e26e849c7e1 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Fri, 2 Oct 2020 07:41:18 +0000 Subject: [PATCH] 31_HUEDevice.pm: added readingList attribute git-svn-id: https://svn.fhem.de/fhem/trunk@22900 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/31_HUEDevice.pm | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/fhem/CHANGED b/fhem/CHANGED index dc18c0d41..d312b4f72 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # 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: 31_HUEDevice: added gesture reading for Aqara Cube + added readingList attribute - feature: 50_SSChatBot: new getter apiInfo - feature: 49_SSCam: new getter apiInfo - bugfix: 10_SOMFY: corrected autostore rolling code (esp. restart) diff --git a/fhem/FHEM/31_HUEDevice.pm b/fhem/FHEM/31_HUEDevice.pm index 1dca74815..19d27cf7e 100644 --- a/fhem/FHEM/31_HUEDevice.pm +++ b/fhem/FHEM/31_HUEDevice.pm @@ -186,6 +186,7 @@ sub HUEDevice_Initialize($) "setList:textField-long ". "configList:textField-long ". "subType:extcolordimmer,colordimmer,ctdimmer,dimmer,switch,blind ". + "readingList ". $readingFnAttributes; #$hash->{FW_summaryFn} = "HUEDevice_summaryFn"; @@ -1621,6 +1622,12 @@ HUEDevice_Parse($$) #Aqara Cube $readings{gesture} = $state->{gesture} if( defined($state->{gesture}) ); + + if( my $entries = $hash->{helper}{readingList} ) { + foreach my $entry (@{$entries}) { + $readings{$entry} = $state->{$entry} if( defined($state->{$entry}) ); + } + } } $hash->{lastupdated} = ReadingsVal( $name, '.lastupdated', '' ) if( !$hash->{lastupdated} ); @@ -1882,6 +1889,15 @@ HUEDevice_Attr($$$;$) } } } + + } elsif( $attrName eq 'readingList' ) { + my $hash = $defs{$name}; + delete $hash->{helper}{$attrName}; + return "$name is not a sensor device" if( $hash->{helper}->{devtype} ne 'S' ); + if( $cmd eq "set" && $attrVal ) { + my @a = split("[ ,]+", $attrVal); + $hash->{helper}{$attrName} = \@a; + } } return; @@ -2055,6 +2071,8 @@ absent:{<json>} The list of know config commands for sensor type devices. one command per line, eg.:
attr mySensor mode:{<json>}\
/heatsetpoint (.*)/:perl:{'{"heatsetpoint":'. $VALUE1 * 100 .'}'}
+
  • readingList
    + The list of readings that should be created from the sensor state object. Space or comma separated.
  • subType
    extcolordimmer -> device has rgb and color temperatur control
    colordimmer -> device has rgb controll