2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-07 16:59:18 +00:00

30_LIGHTIFY.pm: better autodetection of subType for lightify lamps

git-svn-id: https://svn.fhem.de/fhem/trunk@7979 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2015-02-14 16:08:59 +00:00
parent e14aefc1b8
commit 3e3e079b99
2 changed files with 25 additions and 26 deletions

View File

@ -403,16 +403,6 @@ Log 3, "$alias: $id:$short, type: $type (w:$has_w, rgb:$has_rgb), onoff: $onoff,
$cmdret= CommandAttr(undef,"$devname room LIGHTIFY");
$cmdret= CommandAttr(undef,"$devname IODev $name");
my $subtype = 'extcolordimmer';
if( $has_w && $has_rgb ) {
$subtype = 'extcolordimmer';
} elsif( $has_rgb ) {
$subtype = 'colordimmer';
} elsif( $has_w ) {
$subtype = 'ctdimmer';
}
$cmdret= CommandAttr(undef,"$devname subType $subtype");
$autocreated++;
}
}
@ -426,6 +416,14 @@ Log 3, "$alias: $id:$short, type: $type (w:$has_w, rgb:$has_rgb), onoff: $onoff,
}
};
if( $has_rgb && $has_w ) {
$json->{type} = 'Extended color light';
} elsif( $has_rgb ) {
$json->{type} = 'Color light';
} elsif( $has_w ) {
$json->{type} = 'Color Temperature Light';
}
if( !$has_rgb ) {
$json->{state}->{colormode} = 'ct';

View File

@ -838,8 +838,8 @@ HUEDevice_Parse($$)
$attr{$name}{model} = $result->{modelid} if( !defined($attr{$name}{model}) && $result->{modelid} );
if( defined($attr{$name}{model}) ) {
if( !defined($attr{$name}{subType}) ) {
if( !defined($attr{$name}{subType}) ) {
if( defined($attr{$name}{model}) ) {
if( defined($hueModels{$attr{$name}{model}}{subType}) ) {
$attr{$name}{subType} = $hueModels{$attr{$name}{model}}{subType};
@ -852,29 +852,30 @@ HUEDevice_Parse($$)
} elsif( $attr{$name}{model} =~ m/RGBW$/ ) {
$attr{$name}{subType} = 'extcolordimmer';
} elsif( $hash->{type} ) {
if( $hash->{type} eq "Extended color light" ) {
$attr{$name}{subType} = 'extcolordimmer';
}
} elsif( $hash->{type} eq "Color light" ) {
$attr{$name}{subType} = 'colordimmer';
} elsif( $hash->{type} ) {
if( $hash->{type} eq "Extended color light" ) {
$attr{$name}{subType} = 'extcolordimmer';
} elsif( $hash->{type} eq "Color Temperature Light" ) {
$attr{$name}{subType} = 'ctdimmer';
} elsif( $hash->{type} eq "Color light" ) {
$attr{$name}{subType} = 'colordimmer';
} elsif( $hash->{type} eq "Dimmable light" ) {
$attr{$name}{subType} = 'dimmer';
} elsif( $hash->{type} eq "Color Temperature Light" ) {
$attr{$name}{subType} = 'ctdimmer';
} elsif( $hash->{type} eq "Dimmable plug-in unit" ) {
$attr{$name}{subType} = 'dimmer';
} elsif( $hash->{type} eq "Dimmable light" ) {
$attr{$name}{subType} = 'dimmer';
}
} elsif( $hash->{type} eq "Dimmable plug-in unit" ) {
$attr{$name}{subType} = 'dimmer';
}
} elsif( $attr{$name}{subType} eq "colordimmer" ) {
$attr{$name}{subType} = $hueModels{$attr{$name}{model}}{subType} if( defined($hueModels{$attr{$name}{model}}{subType}) );
}
} elsif( $attr{$name}{subType} eq "colordimmer" ) {
$attr{$name}{subType} = $hueModels{$attr{$name}{model}}{subType} if( defined($hueModels{$attr{$name}{model}}{subType}) );
}