2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

36_Shelly.pm: bugfix

git-svn-id: https://svn.fhem.de/fhem/trunk@21943 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
phenning 2020-05-15 02:50:13 +00:00
parent 79e24d56d4
commit 8a073c033c

View File

@ -39,7 +39,7 @@ use vars qw{%attr %defs};
sub Log($$); sub Log($$);
#-- globals on start #-- globals on start
my $version = "2.11"; my $version = "2.12";
#-- these we may get on request #-- these we may get on request
my %gets = ( my %gets = (
@ -709,6 +709,10 @@ sub Shelly_Set ($@) {
if( $cmd eq "hsv" ){ if( $cmd eq "hsv" ){
my($hue,$saturation,$value)=split(',',$value); my($hue,$saturation,$value)=split(',',$value);
#-- rescale
if( $hue>1 ){
$hue = $hue/360;
}
my ($red,$green,$blue)=Color::hsv2rgb($hue,$saturation,$value); my ($red,$green,$blue)=Color::hsv2rgb($hue,$saturation,$value);
$cmd=sprintf("red=%d&green=%d&blue=%d",int($red*255+0.5),int($green*255+0.5),int($blue*255+0.5)); $cmd=sprintf("red=%d&green=%d&blue=%d",int($red*255+0.5),int($green*255+0.5),int($blue*255+0.5));
Shelly_dim($hash,"color/0","?".$cmd); Shelly_dim($hash,"color/0","?".$cmd);
@ -1478,7 +1482,8 @@ sub Shelly_updown2($){
<br />switches device on or off for &lt;time&gt; seconds. </li> <br />switches device on or off for &lt;time&gt; seconds. </li>
<li> <li>
<code>set &lt;name&gt; hsv &lt;hue value 0..360&gt;,&lt;saturation value 0..1&gt;,&lt;brightness value 0..1&gt; </code> <code>set &lt;name&gt; hsv &lt;hue value 0..360&gt;,&lt;saturation value 0..1&gt;,&lt;brightness value 0..1&gt; </code>
<br />comma separated list of hue, saturation and value to set the color</li> <br />comma separated list of hue, saturation and value to set the color. Note, that 360° is the same hue as 0° = red.
Hue values smaller than 1 will be treated as fraction of the full circle, e.g. 0.5 will give the same hue as 180°.</li>
<li> <li>
<code>set &lt;name&gt; rgb &lt;rrggbb&gt; </code> <code>set &lt;name&gt; rgb &lt;rrggbb&gt; </code>
<br />6-digit hex string to set the color</li> <br />6-digit hex string to set the color</li>