2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

Color.pm: handle set.*, handle onoff for rgb

git-svn-id: https://svn.fhem.de/fhem/trunk@20742 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2019-12-14 10:08:24 +00:00
parent 9b2c9a2fcb
commit 5e16771e84

View File

@ -452,6 +452,7 @@ devStateIcon($$@)
my $s = $value; my $s = $value;
return ".*:light_question" if( !$s ); return ".*:light_question" if( !$s );
return ".*:light_question" if( $s =~ m/^set/i );
return ".*:$s:toggle"; return ".*:$s:toggle";
} elsif( $type && $type eq "dimmer" ) { } elsif( $type && $type eq "dimmer" ) {
@ -465,6 +466,7 @@ devStateIcon($$@)
} }
return ".*:light_question" if( !defined($percent) ); return ".*:light_question" if( !defined($percent) );
return ".*:light_question" if( $percent =~ m/^set/i );
return ".*:on:toggle" if( $percent eq "on" ); return ".*:on:toggle" if( $percent eq "on" );
return ".*:off:toggle" if( $percent eq "off" ); return ".*:off:toggle" if( $percent eq "off" );
@ -489,13 +491,17 @@ devStateIcon($$@)
} }
return ".*:light_question" if( !defined($value) ); return ".*:light_question" if( !defined($value) );
return ".*:light_question" if( $value =~ m/^set/i );
return ".*:on:toggle" if( $value eq "on" ); return ".*:on:toggle" if( $value eq "on" );
return ".*:off:toggle" if( $value eq "off" ); return ".*:off:toggle" if( $value eq "off" );
$value = substr($value,0,6);
my $s = 'on'; my $s = 'on';
if( $pct ) { if( $pct ) {
my $percent = ::ReadingsVal($name,$pct, undef); my $percent = ::ReadingsVal($name,$pct, undef);
$percent = ::CommandGet("","$name $pct") if( !$percent ); $percent = ::CommandGet("","$name $pct") if( !$percent );
return ".*:off:toggle" if( $onoff && ::ReadingsVal($name,$onoff,'') =~ m/(0|off$)/i );
return ".*:off:toggle" if( $percent eq "off" ); return ".*:off:toggle" if( $percent eq "off" );
$percent = 100 if( $percent eq "on" ); $percent = 100 if( $percent eq "on" );
$s = $dim_values{int($percent/7)} if( $percent && $percent < 100 ); $s = $dim_values{int($percent/7)} if( $percent && $percent < 100 );