2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-23 20:52:13 +00:00

31_HUEDevice.pm: fixed perl warning, support frient Air Quality Sensor, support for dynamic scene state

git-svn-id: https://svn.fhem.de/fhem/trunk@25473 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2022-01-16 15:03:37 +00:00
parent 25dd2fc086
commit 9839342db8

View File

@ -1498,8 +1498,8 @@ HUEDevice_Parse($$)
my $lights = join (' ', map( { my $code = $_;
$code = $hash->{IODev}->{NAME} ."-". $code if( defined($hash->{IODev}) );
$modules{HUEDevice}{defptr}{$code}{NAME} } @{$result->{lights}}) );
#readingsSingleUpdate($hash,"rgb", $rgb,1);
return $modules{HUEDevice}{defptr}{$code}{NAME} if(defined($modules{HUEDevice}{defptr}{$code}));
return '' } @{$result->{lights}}) );
setReadingsVal( $hash, ".associatedWith", $lights, TimeNow() );
}
@ -1733,6 +1733,10 @@ HUEDevice_Parse($$)
#Aqara Cube
$readings{gesture} = $state->{gesture} if( defined($state->{gesture}) );
#frient Air Quality Sensor
$readings{airqualityppb} = $state->{airqualityppb} if( defined($state->{airqualityppb}) );
$readings{airquality} = $state->{airquality} if( defined($state->{airquality}) );
if( my $entries = $hash->{helper}{readingList} ) {
foreach my $entry (@{$entries}) {
$readings{$entry} = $state->{$entry} if( defined($state->{$entry}) );
@ -1851,6 +1855,7 @@ HUEDevice_Parse($$)
}
}
my %readings;
readingsBeginUpdate($hash);
my $state = $result->{'state'};
@ -1884,6 +1889,11 @@ HUEDevice_Parse($$)
my $lastseen = undef;
$lastseen = $result->{lastseen} if( defined($result->{lastseen}) );
$readings{dynamics_speed} = $state->{dynamics_speed};
$readings{dynamics_status} = $state->{dynamics_status};
if( defined($colormode) && $colormode ne $hash->{helper}{colormode} ) {readingsBulkUpdate($hash,"colormode",$colormode);}
if( defined($bri) && $bri != $hash->{helper}{bri} ) {readingsBulkUpdate($hash,"bri",$bri);}
if( defined($ct) && $ct != $hash->{helper}{ct} ) {
@ -1969,6 +1979,12 @@ HUEDevice_Parse($$)
if( $s ne $hash->{STATE} ) {readingsBulkUpdate($hash,"state",$s);}
foreach my $key ( keys %readings ) {
if( defined($readings{$key}) ) {
readingsBulkUpdate($hash, $key, $readings{$key}, 1) if( !defined($hash->{helper}{$key}) || $hash->{helper}{$key} ne $readings{$key} );
$hash->{helper}{$key} = $readings{$key};
}
}
readingsEndUpdate($hash,1);
if( defined($colormode) && !defined($rgb) ) {