2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +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'}) ) {
$pct = $state->{'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' ) {
$pct = 100;
} elsif( $on ) {
$s = 'on';
if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",1);}
} else {
$pct = int($bri * 99 / 254 + 1);
if( $pct > 0
&& $pct < 100 ) {
$s = $dim_values{int($pct/7)};
}
$s = 'off' if( $pct == 0 );
if( $bri < 0 || AttrVal($name, 'subType', 'dimmer') eq 'switch' ) {
$pct = 100;
} else {
$pct = int($bri * 99 / 254 + 1);
if( $pct > 0
&& $pct < 100 ) {
$s = $dim_values{int($pct/7)};
}
$s = 'off' if( $pct == 0 );
}
else
{
$on = 0;
$s = 'off';
$pct = 0;
if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",0);}
}
} else {
$on = 0;
$s = 'off';
$pct = 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,"level", $pct . ' %');}