2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

31_HUEDevice.pm: added mode reading

git-svn-id: https://svn.fhem.de/fhem/trunk@20900 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2020-01-06 20:14:39 +00:00
parent 24ad30c752
commit cb09984b71

View File

@ -207,7 +207,7 @@ HUEDevice_devStateIcon($)
my $name = $hash->{NAME};
return ".*:light_question:toggle" if( !$hash->{helper}{reachable} );
return ".*:light_question:toggle" if( defined($hash->{mode}) && $hash->{mode} ne 'homeautomation' );
return ".*:light_question:toggle" if( ReadingsVal($name, 'mode', 'homeautomation') ne 'homeautomation' );
my $pct = ReadingsVal($name, 'pct', 100);
my $subtype = AttrVal($name, 'subType', 'extcolordimmer' );
@ -395,6 +395,8 @@ sub HUEDevice_Define($$)
$hash->{helper}{battery} = -1;
$hash->{helper}{mode} = '';
$attr{$name}{devStateIcon} = '{(HUEDevice_devStateIcon($name),"toggle")}' if( !defined( $attr{$name}{devStateIcon} ) );
my $icon_path = AttrVal("WEB", "iconPath", "default:fhemSVG:openautomation" );
@ -1683,10 +1685,8 @@ HUEDevice_Parse($$)
my $battery = undef;
$battery = $config->{battery} if( defined($config->{battery}) );
if( defined($hash->{mode})
|| ( defined($state->{mode}) && $state->{mode} ne 'homeautomation' ) ) {
$hash->{mode} = $state->{mode};
}
my $mode = undef;
$mode = $state->{mode} if( $hash->{helper}{mode} || defined($state->{mode} && $state->{mode} ne 'homeautomation') );
if( defined($colormode) && $colormode ne $hash->{helper}{colormode} ) {readingsBulkUpdate($hash,"colormode",$colormode);}
if( defined($bri) && $bri != $hash->{helper}{bri} ) {readingsBulkUpdate($hash,"bri",$bri);}
@ -1709,6 +1709,8 @@ HUEDevice_Parse($$)
if( defined($battery) && $battery ne $hash->{helper}{battery} ) {readingsBulkUpdate($hash,"battery",$battery);}
if( defined($mode) && $mode ne $hash->{helper}{mode} ) {readingsBulkUpdate($hash,"mode",$mode);}
my $s = '';
my $pct = -1;
if( defined($state->{'pct'}) ) {
@ -1760,6 +1762,8 @@ HUEDevice_Parse($$)
$hash->{helper}{battery} = $battery if( defined($battery) );
$hash->{helper}{mode} = $mode if( defined($mode) );
$hash->{helper}{pct} = $pct;
my $changed = $hash->{CHANGED}?1:0;