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

31_HUEDevice.pm: clear dynamics_status on power off

git-svn-id: https://svn.fhem.de/fhem/trunk@25505 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2022-01-19 08:19:33 +00:00
parent e0f1073f10
commit e8a5081096

View File

@ -1952,31 +1952,33 @@ HUEDevice_Parse($$)
if( defined($state->{'pct'}) ) { if( defined($state->{'pct'}) ) {
$pct = $state->{'pct'}; $pct = $state->{'pct'};
$s = $pct; $s = $pct;
} elsif( $on )
{
$s = 'on';
if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",1);}
if( $bri < 0 || AttrVal($name, 'subType', 'dimmer') eq 'switch' ) { } elsif( $on ) {
$pct = 100; $s = 'on';
if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",1);}
} else { if( $bri < 0 || AttrVal($name, 'subType', 'dimmer') eq 'switch' ) {
$pct = int($bri * 99 / 254 + 1); $pct = 100;
if( $pct > 0
&& $pct < 100 ) { } else {
$s = $dim_values{int($pct/7)}; $pct = int($bri * 99 / 254 + 1);
} if( $pct > 0
$s = 'off' if( $pct == 0 ); && $pct < 100 ) {
$s = $dim_values{int($pct/7)};
} }
$s = 'off' if( $pct == 0 );
} }
else } else {
{ $on = 0;
$on = 0; $s = 'off';
$s = 'off'; $pct = 0;
$pct = 0; if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",0);}
if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",0);} }
}
$readings{dynamics_status} = 'none' if( !$on && defined($hash->{helper}{dynamics_status}) && !defined($readings{dynamics_status}) );
if( $pct != $hash->{helper}{pct} ) {readingsBulkUpdate($hash,"pct", $pct);} if( $pct != $hash->{helper}{pct} ) {readingsBulkUpdate($hash,"pct", $pct);}
#if( $pct != $hash->{helper}{pct} ) {readingsBulkUpdate($hash,"level", $pct . ' %');} #if( $pct != $hash->{helper}{pct} ) {readingsBulkUpdate($hash,"level", $pct . ' %');}