2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

31_HUEDevice.pm: fix for lightify plug

git-svn-id: https://svn.fhem.de/fhem/trunk@11353 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2016-04-30 22:50:34 +00:00
parent 439a939e0d
commit da80a0e859

View File

@ -80,6 +80,7 @@ my %hueModels = (
'Surface Light TW' => {name => 'LIGHTIFY Surface light tunable white' ,type => 'Color Temperature Light' ,subType => 'ctdimmer',},
'Classic A60 TW' => {name => 'LIGHTIFY Classic A60 tunable white' ,type => 'Color Temperature Light' ,subType => 'ctdimmer',},
'PAR16 50 TW' => {name => 'LIGHTIFY PAR16 50 tunable white' ,type => 'Color Temperature Light' ,subType => 'ctdimmer',},
'Plug - LIGHTIFY' => {name => 'LIGHTIFY Plug' ,type => 'On/Off plug-in unit ' ,subType => 'switch',},
);
my %dim_values = (
@ -154,7 +155,7 @@ HUEDevice_devStateIcon($)
$s="on" if( $percent eq "100" );
return ".*:$s:toggle" if( AttrVal($name, "model", "") eq "LWL001" );
return ".*:$s:toggle" if( AttrVal($name, "subtype", "") eq "dimmer" );
return ".*:$s:toggle" if( AttrVal($name, "subType", "") eq "dimmer" );
#return ".*:$s:toggle" if( AttrVal($name, "model", "") eq "LWB001" );
#return ".*:$s:toggle" if( AttrVal($name, "model", "") eq "LWB003" );
@ -1104,18 +1105,20 @@ HUEDevice_Parse($$)
if( defined($effect) && $effect ne $hash->{helper}{effect} ) {readingsBulkUpdate($hash,"effect",$effect);}
my $s = '';
my $percent;
my $percent = -1;
if( $on )
{
$s = 'on';
if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",1);}
$percent = int($bri * 99 / 254 + 1);
if( $percent > 0
&& $percent < 100 ) {
$s = $dim_values{int($percent/7)};
if( $bri >= 0 && AttrVal($name, 'subType', 'dimmer') ne 'switch' ) {
$percent = int($bri * 99 / 254 + 1);
if( $percent > 0
&& $percent < 100 ) {
$s = $dim_values{int($percent/7)};
}
$s = 'off' if( $percent == 0 );
}
$s = 'off' if( $percent == 0 );
}
else
{
@ -1125,7 +1128,7 @@ HUEDevice_Parse($$)
if( $on != $hash->{helper}{on} ) {readingsBulkUpdate($hash,"onoff",0);}
}
if( $percent != $hash->{helper}{percent} ) {readingsBulkUpdate($hash,"pct", $percent);}
if( $percent != -1 && $percent != $hash->{helper}{percent} ) {readingsBulkUpdate($hash,"pct", $percent);}
#if( $percent != $hash->{helper}{percent} ) {readingsBulkUpdate($hash,"level", $percent . ' %');}
$s = 'unreachable' if( !$reachable );