2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-25 09:55:38 +00:00

36_Shelly: convert dim-command with brightness=0 to an off-command

git-svn-id: https://svn.fhem.de/fhem/trunk@28691 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Starkstrombastler 2024-03-21 19:02:38 +00:00
parent 56de22e4c0
commit ae988ab224

View File

@ -66,6 +66,8 @@
# 5.18 Bug Fix: function of all Gen1 relay devices
# 5.19 change back: roller devices: use 'set ... pct' as command
# 5.20 Bug Fix: suppress status calls for disabled devices
# 5.21 Bug Fix: Shelly-dimmer: convert dim-command with brightness=0 to an off-command
# Bug Fix: Shelly-dimmer, Shelly-bulb: slider for pct starts with 1
package main;
@ -84,7 +86,7 @@ sub Log($$);
sub Shelly_Set ($@);
#-- globals on start
my $version = "5.20 24.01.2024";
my $version = "5.21 21.03.2024";
my $defaultINTERVAL = 60;
my $secndIntervalMulti = 4; # Multiplier for 'long update'
@ -238,7 +240,7 @@ my %shelly_dropdowns = (
"Multi" => " ON:noArg OFF:noArg xtrachannels:noArg",
"Rol" => " closed open stop:noArg pct:slider,0,1,100 delta zero:noArg predefAttr:noArg",
"RgbwW" => " pct dim dimup dimdown dim-for-timer",
"BulbW" => " ct:colorpicker,CT,3000,10,6500 pct:slider,0,1,100",
"BulbW" => " ct:colorpicker,CT,3000,10,6500 pct:slider,1,1,100",
"RgbwC" => " rgbw rgb:colorpicker,HSV hsv white:slider,0,1,100 gain:slider,0,1,100"
);
## may be used for RgbwC:
@ -1971,7 +1973,11 @@ sub Shelly_Set ($@) {
if( $cmd =~ /^((on)|(off)|(dim))/ && $cmd!~/(till)/ ){ # on-till, on-till-overnight
if( $cmd eq "dim" ){
#
$cmd = "?brightness=$brightness&turn=on";
if( $brightness == 0 ){
$cmd = "?turn=off$oldtimer";
}else{
$cmd = "?brightness=$brightness&turn=on$oldtimer";
}
}
#-- check timer command
elsif( $cmd =~ /for-timer/ ){