From 3c6c830bc5961e66b3cd2e12cc024500ab422147 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Sun, 22 Mar 2020 10:06:36 +0000 Subject: [PATCH] 31_HUEDevice.pm: added batteryPercent reading, battery is deprecated and will be removed later git-svn-id: https://svn.fhem.de/fhem/trunk@21480 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/31_HUEDevice.pm | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/fhem/CHANGED b/fhem/CHANGED index f1ac989ec..7818fd972 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 batteryPercent reading + battery reading is deprecated, will be removed later - feature: 93_DbRep: add column header for custom selects (sqlCmd), new sqlSpecial readingsDifferenceByTimeDelta for MySQL, bugfix: FHEM crash if no time-attribute is set and time diff --git a/fhem/FHEM/31_HUEDevice.pm b/fhem/FHEM/31_HUEDevice.pm index 5662ea50b..b279f63a2 100644 --- a/fhem/FHEM/31_HUEDevice.pm +++ b/fhem/FHEM/31_HUEDevice.pm @@ -1524,6 +1524,8 @@ HUEDevice_Parse($$) $hash->{sensitivity} = $config->{sensitivity} if( defined($config->{sensitivity}) ); $readings{battery} = $config->{battery} if( defined($config->{battery}) ); + $readings{batteryPercent} = $config->{battery} if( defined($config->{battery}) ); + $readings{reachable} = $config->{reachable} if( defined($config->{reachable}) ); $readings{temperature} = $config->{temperature} * 0.01 if( defined($config->{temperature}) ); @@ -1597,6 +1599,7 @@ HUEDevice_Parse($$) $readings{fire} = $state->{fire} if( defined($state->{fire}) ); $readings{tampered} = $state->{tampered} if( defined($state->{tampered}) ); $readings{battery} = $state->{battery} if( defined($state->{battery}) ); + $readings{batteryPercent} = $state->{battery} if( defined($state->{battery}) ); $readings{batteryState} = $state->{lowbattery}?'low':'ok' if( defined($state->{lowbattery}) ); #Xiaomi Aqara Vibrationsensor (lumi.vibration.aq1) @@ -1772,6 +1775,7 @@ HUEDevice_Parse($$) if( defined($rgb) && $rgb ne $hash->{helper}{rgb} ) {readingsBulkUpdate($hash,"rgb",$rgb);} if( defined($battery) && $battery ne $hash->{helper}{battery} ) {readingsBulkUpdate($hash,"battery",$battery);} + if( defined($battery) && $battery ne $hash->{helper}{battery} ) {readingsBulkUpdate($hash,'batteryPercent',$battery);} if( defined($mode) && $mode ne $hash->{helper}{mode} ) {readingsBulkUpdate($hash,"mode",$mode);}