From 70b4ccd9964bbbb8a852ec180d12032d9287c960 Mon Sep 17 00:00:00 2001 From: zap <> Date: Tue, 15 Dec 2020 13:46:01 +0000 Subject: [PATCH] FULLY: Added support for sensor information git-svn-id: https://svn.fhem.de/fhem/trunk@23354 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/89_FULLY.pm | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index e2fe14b41..102c69a11 100644 --- a/fhem/CHANGED +++ b/fhem/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: 89_FULLY: Added support for sensor information - bugfix: 98_weekprofile: HMCCU-HM send profile without prefix (Forum #1104569) - bugfix: 70_DENON_AVR: serial connection issues - feature: 77_SMAEM: attr serialNumber may contain multiple serial numbers diff --git a/fhem/FHEM/89_FULLY.pm b/fhem/FHEM/89_FULLY.pm index 55980fedc..9b8bc18df 100755 --- a/fhem/FHEM/89_FULLY.pm +++ b/fhem/FHEM/89_FULLY.pm @@ -1,6 +1,6 @@ ############################################################################## # -# 89_FULLY.pm 2.02 +# 89_FULLY.pm 2.1 # # $Id$ # @@ -40,7 +40,7 @@ sub FULLY_Decrypt ($); sub FULLY_Ping ($$); sub FULLY_SetPolling ($$;$); -my $FULLY_VERSION = '2.02'; +my $FULLY_VERSION = '2.1'; # Timeout for Fully requests my $FULLY_TIMEOUT = 5; @@ -827,8 +827,20 @@ sub FULLY_UpdateReadings ($$) foreach my $rn (keys %$result) { my $key = lc($rn); next if (exists($readings{$key}) && $readings{$key} eq 'ignore'); - readingsBulkUpdate ($hash, $key, exists($readings{$key}) && $readings{$key} eq 'bool' ? - ($result->{$rn} eq '0' ? 'no' : 'yes') : $result->{$rn}); + if (ref($result->{$rn}) eq 'ARRAY') { + if ($key eq 'sensorinfo') { + foreach my $e (@{$result->{$rn}}) { + $key = lc($e->{name}); + $key =~ s/ /_/g; + my $rv = ref($e->{values}) eq 'ARRAY' ? join(',', @{$e->{values}}) : $e->{values}; + readingsBulkUpdate ($hash, $key, $rv); + } + } + } + else { + readingsBulkUpdate ($hash, $key, exists($readings{$key}) && $readings{$key} eq 'bool' ? + ($result->{$rn} eq '0' ? 'no' : 'yes') : $result->{$rn}); + } } my $screenOn = $result->{isScreenOn} // $result->{screenOn};