mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
HUE: all_on & any_on readings for groups
git-svn-id: https://svn.fhem.de/fhem/trunk@11349 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d83a35fcd2
commit
57c215ed8a
@ -714,6 +714,7 @@ HUEBridge_Autocreate($;$)
|
||||
} else {
|
||||
$cmdret= CommandAttr(undef,"$devname alias ".$result->{$id}{name});
|
||||
$cmdret= CommandAttr(undef,"$devname room HUEDevice");
|
||||
$cmdret= CommandAttr(undef,"$devname group HUEGroup");
|
||||
$cmdret= CommandAttr(undef,"$devname IODev $name");
|
||||
|
||||
$autocreated++;
|
||||
|
@ -134,10 +134,17 @@ HUEDevice_devStateIcon($)
|
||||
$hash = $defs{$hash} if( ref($hash) ne 'HASH' );
|
||||
|
||||
return undef if( !$hash );
|
||||
return undef if( $hash->{helper}->{devtype} );
|
||||
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
if( $hash->{helper}->{devtype} && $hash->{helper}->{devtype} eq 'G' ) {
|
||||
#return ".*:off:toggle" if( !ReadingsVal($name,'any_on',0) );
|
||||
#return ".*:on:toggle" if( ReadingsVal($name,'any_on',0) );
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
return undef if( $hash->{helper}->{devtype} );
|
||||
|
||||
return ".*:light_question" if( !$hash->{helper}{reachable} );
|
||||
|
||||
return ".*:off:toggle" if( ReadingsVal($name,"state","off") eq "off" );
|
||||
@ -246,6 +253,8 @@ sub HUEDevice_Define($$)
|
||||
$hash->{helper}{xy} = '';
|
||||
$hash->{helper}{alert} = '';
|
||||
$hash->{helper}{effect} = '';
|
||||
$hash->{helper}{all_on} = -1;
|
||||
$hash->{helper}{any_on} = -1;
|
||||
|
||||
$hash->{helper}{percent} = -1;
|
||||
$hash->{helper}{rgb} = "";
|
||||
@ -259,6 +268,11 @@ sub HUEDevice_Define($$)
|
||||
$hash->{DEF} = "group $id $args[3]";
|
||||
$attr{$name}{delayedUpdate} = 1 if( !defined( $attr{$name}{delayedUpdate} ) );
|
||||
|
||||
$attr{$name}{devStateIcon} = '{(HUEDevice_devStateIcon($name),"toggle")}' if( !defined( $attr{$name}{devStateIcon} ) );
|
||||
|
||||
my $icon_path = AttrVal("WEB", "iconPath", "default:fhemSVG:openautomation" );
|
||||
$attr{$name}{'color-icons'} = 2 if( !defined( $attr{$name}{'color-icons'} ) && $icon_path =~ m/openautomation/ );
|
||||
|
||||
} elsif( $hash->{helper}->{devtype} eq 'S' ) {
|
||||
$hash->{DEF} = "sensor $id $args[3]";
|
||||
$hash->{INTERVAL} = $interval;
|
||||
@ -941,6 +955,19 @@ HUEDevice_Parse($$)
|
||||
$hash->{STATE} = 'Initialized';
|
||||
$hash->{lights} = join( ",", @{$result->{lights}} ) if( $result->{lights} );
|
||||
|
||||
if( $result->{state} ) {
|
||||
my $all_on = $result->{state}{all_on};
|
||||
my $any_on = $result->{state}{any_on};
|
||||
|
||||
readingsBeginUpdate($hash);
|
||||
readingsBulkUpdate($hash, "all_on", $result->{state}{all_on}) if( defined($all_on) && $all_on != $hash->{helper}{all_on} );
|
||||
readingsBulkUpdate($hash, "any_on", $result->{state}{any_on}) if( defined($any_on) && $any_on != $hash->{helper}{any_on} );
|
||||
readingsEndUpdate($hash,1);
|
||||
|
||||
$hash->{helper}{all_on} = $all_on if( defined($all_on) );
|
||||
$hash->{helper}{any_on} = $any_on if( defined($any_on) );
|
||||
}
|
||||
|
||||
if( defined($hash->{helper}->{update}) ) {
|
||||
delete $hash->{helper}->{update};
|
||||
fhem( "set $hash->{IODev}{NAME} statusRequest" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user