2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

30_HUEBridge.pm, 31_HUEDevice.pm: added get startup commands

git-svn-id: https://svn.fhem.de/fhem/trunk@17986 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2018-12-16 14:20:19 +00:00
parent 85dc5f656f
commit 88e99a20d9
3 changed files with 42 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 30_HUEBridge, 31_HUEDevice: added get startup command
- change: 55_DWD_OpenData: maintenance release (forum #83097 msg #869647)
- change: mqtt2.template: change name convention + cleanup
- feature: 72_FB_CALLLIST: new readings/events "count-..." implemented to

View File

@ -958,8 +958,32 @@ HUEBridge_Get($@)
$ret = sprintf( "%-20s %-20s %-30s %s\n", "CREATE", "LAST USE", "NAME", "KEY" ) .$ret if( $ret );
return $ret;
} elsif($cmd eq 'startup' ) {
my $result = HUEBridge_Call($hash, undef, 'lights', undef);
return $result->{error}{description} if( $result->{error} );
my $ret = "";
foreach my $key ( sort {$a<=>$b} keys %{$result} ) {
my $code = $name ."-". $key;
my $fhem_name ="";
$fhem_name = $modules{HUEDevice}{defptr}{$code}->{NAME} if( defined($modules{HUEDevice}{defptr}{$code}) );
$ret .= sprintf( "%2i: %-25s %-15s %s", $key, $result->{$key}{name}, $fhem_name );
if( !$result->{$key}{config} || !$result->{$key}{config}{startup} ) {
$ret .= "not supported";
} else {
$ret .= sprintf( "%s\t%s", $result->{$key}{config}{startup}{mode}, $result->{$key}{config}{startup}{configured} );
}
$ret .= "\n";
}
$ret = sprintf( "%2s %-25s %-15s %s\t%s\n", "ID", "NAME", "FHEM", "MODE", "CONFIGURED" ) .$ret if( $ret );
return $ret;
} else {
return "Unknown argument $cmd, choose one of lights:noArg groups:noArg scenes:noArg rule rules:noArg sensors:noArg whitelist:noArg";
my $list = "lights:noArg groups:noArg scenes:noArg rule rules:noArg sensors:noArg whitelist:noArg";
if( $hash->{helper}{apiversion} && $hash->{helper}{apiversion} >= (1<<16) + (26<<8) ) {
$list .= " startup:noArg";
}
return "Unknown argument $cmd, choose one of $list";
}
}
@ -1848,6 +1872,8 @@ HUEBridge_Attr($$$)
list the groups known to the bridge.</li>
<li>scenes [detail]<br>
list the scenes known to the bridge.</li>
<li>startup<br>
show startup behavior of all known lights</li>
<li>rule &lt;id&gt; <br>
list the rule with &lt;id&gt;.</li>
<li>rules [detail] <br>

View File

@ -988,11 +988,22 @@ HUEDevice_Get($@)
($r,$g,$b) = xyYtorgb($x,$y,$Y);
}
return sprintf( "%02x%02x%02x", $r+0.5, $g+0.5, $b+0.5 );
} elsif ( $cmd eq "startup" ) {
my $result = IOWrite($hash,undef,$hash->{NAME},$hash->{ID});
return $result->{error}{description} if( $result->{error} );
return "not supported" if( !$result->{config} || !$result->{config}{startup} );
return "$result->{config}{startup}{mode}\t$result->{config}{startup}{configured}";
return Dumper $result->{config}{startup};
} elsif ( $cmd eq "devStateIcon" ) {
return HUEDevice_devStateIcon($hash);
}
return "Unknown argument $cmd, choose one of rgb:noArg RGB:noArg devStateIcon:noArg";
my $list = "rgb:noArg RGB:noArg devStateIcon:noArg";
if( $defs{$name}->{IODev}->{helper}{apiversion} && $defs{$name}->{IODev}->{helper}{apiversion} >= (1<<16) + (26<<8) ) {
$list .= " startup:noArg";
}
return "Unknown argument $cmd, choose one of $list";
}
@ -1629,6 +1640,8 @@ HUEDevice_Attr($$$;$)
<ul>
<li>rgb</li>
<li>RGB</li>
<li>startup<br>
show startup behavior.</li>
<li>devStateIcon<br>
returns html code that can be used to create an icon that represents the device color in the room overview.</li>
</ul><br>