2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

31_HUEDevice.pm: added lastseen reading

git-svn-id: https://svn.fhem.de/fhem/trunk@22918 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2020-10-05 17:37:19 +00:00
parent a7f7c2e5bf
commit d9540f601a

View File

@ -442,6 +442,8 @@ HUEDevice_Define($$) {
$hash->{helper}{mode} = '';
$hash->{helper}{lastupdated} = '';
$attr{$name}{devStateIcon} = '{(HUEDevice_devStateIcon($name),"toggle")}' if( !defined( $attr{$name}{devStateIcon} ) );
my $icon_path = AttrVal("WEB", "iconPath", "default:fhemSVG:openautomation" );
@ -1510,11 +1512,17 @@ HUEDevice_Parse($$)
$hash->{manufacturername} = $result->{manufacturername} if( defined($result->{manufacturername}) );
$hash->{luminaireuniqueid} = $result->{luminaireuniqueid} if( defined($result->{luminaireuniqueid}) );
#https://github.com/dresden-elektronik/deconz-rest-plugin/issues/2590
#$hash->{lastseen} = $result->{lastseen} if( defined($result->{lastseen}) );
$hash->{lastannounced} = $result->{lastannounced} if( defined($result->{lastannounced}) );
$hash->{power} = $result->{power} if( defined($result->{power}) );
if( $hash->{helper}->{devtype} eq 'S' ) {
my %readings;
$readings{lastseen} = $result->{lastseen} if( defined($result->{lastseen}) );
if( my $config = $result->{config} ) {
$hash->{on} = $config->{on}?1:0 if( defined($config->{on}) );
$hash->{reachable} = $config->{reachable}?1:0 if( defined($config->{reachable}) );
@ -1770,6 +1778,9 @@ HUEDevice_Parse($$)
my $mode = undef;
$mode = $state->{mode} if( defined($state->{mode}) && ($hash->{helper}{mode} || $state->{mode} ne 'homeautomation') );
my $lastupdated = undef;
$lastupdated = $result->{lastupdated} if( defined($result->{lastupdated}) );
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} ) {
@ -1794,6 +1805,8 @@ HUEDevice_Parse($$)
if( defined($mode) && $mode ne $hash->{helper}{mode} ) {readingsBulkUpdate($hash,"mode",$mode);}
if( defined($lastupdated) && $lastupdated ne $hash->{helper}{lastupdated} ) {readingsBulkUpdate($hash,"lastupdated",$lastupdated);}
my $s = '';
my $pct = -1;
if( defined($state->{'pct'}) ) {