mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-24 02:59:22 +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:
parent
25dd2fc086
commit
9839342db8
@ -1498,8 +1498,8 @@ HUEDevice_Parse($$)
|
|||||||
|
|
||||||
my $lights = join (' ', map( { my $code = $_;
|
my $lights = join (' ', map( { my $code = $_;
|
||||||
$code = $hash->{IODev}->{NAME} ."-". $code if( defined($hash->{IODev}) );
|
$code = $hash->{IODev}->{NAME} ."-". $code if( defined($hash->{IODev}) );
|
||||||
$modules{HUEDevice}{defptr}{$code}{NAME} } @{$result->{lights}}) );
|
return $modules{HUEDevice}{defptr}{$code}{NAME} if(defined($modules{HUEDevice}{defptr}{$code}));
|
||||||
#readingsSingleUpdate($hash,"rgb", $rgb,1);
|
return '' } @{$result->{lights}}) );
|
||||||
setReadingsVal( $hash, ".associatedWith", $lights, TimeNow() );
|
setReadingsVal( $hash, ".associatedWith", $lights, TimeNow() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1733,6 +1733,10 @@ HUEDevice_Parse($$)
|
|||||||
#Aqara Cube
|
#Aqara Cube
|
||||||
$readings{gesture} = $state->{gesture} if( defined($state->{gesture}) );
|
$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} ) {
|
if( my $entries = $hash->{helper}{readingList} ) {
|
||||||
foreach my $entry (@{$entries}) {
|
foreach my $entry (@{$entries}) {
|
||||||
$readings{$entry} = $state->{$entry} if( defined($state->{$entry}) );
|
$readings{$entry} = $state->{$entry} if( defined($state->{$entry}) );
|
||||||
@ -1851,6 +1855,7 @@ HUEDevice_Parse($$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my %readings;
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
my $state = $result->{'state'};
|
my $state = $result->{'state'};
|
||||||
@ -1884,6 +1889,11 @@ HUEDevice_Parse($$)
|
|||||||
my $lastseen = undef;
|
my $lastseen = undef;
|
||||||
$lastseen = $result->{lastseen} if( defined($result->{lastseen}) );
|
$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($colormode) && $colormode ne $hash->{helper}{colormode} ) {readingsBulkUpdate($hash,"colormode",$colormode);}
|
||||||
if( defined($bri) && $bri != $hash->{helper}{bri} ) {readingsBulkUpdate($hash,"bri",$bri);}
|
if( defined($bri) && $bri != $hash->{helper}{bri} ) {readingsBulkUpdate($hash,"bri",$bri);}
|
||||||
if( defined($ct) && $ct != $hash->{helper}{ct} ) {
|
if( defined($ct) && $ct != $hash->{helper}{ct} ) {
|
||||||
@ -1969,6 +1979,12 @@ HUEDevice_Parse($$)
|
|||||||
|
|
||||||
if( $s ne $hash->{STATE} ) {readingsBulkUpdate($hash,"state",$s);}
|
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);
|
readingsEndUpdate($hash,1);
|
||||||
|
|
||||||
if( defined($colormode) && !defined($rgb) ) {
|
if( defined($colormode) && !defined($rgb) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user