diff --git a/CHANGED b/CHANGED index b01b3ca35..d515aebd6 100644 --- a/CHANGED +++ b/CHANGED @@ -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. + - bugfix: 31_MilightDevice: if we're already off don't turn on to set dim level! - added: new dustbin icon - bugfix: SYSMON: some warnings - changed: SYSMON: documentation diff --git a/FHEM/31_MilightDevice.pm b/FHEM/31_MilightDevice.pm index 8f86cdb9b..685f4e559 100644 --- a/FHEM/31_MilightDevice.pm +++ b/FHEM/31_MilightDevice.pm @@ -672,11 +672,15 @@ sub MilightDevice_RGB_Off(@) if (ReadingsVal($hash->{NAME}, "state", "off") ne "off") { readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1); + # Dim down to min brightness then send off command (avoid flicker on turn on) + MilightDevice_RGB_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); + return MilightDevice_RGB_Dim($hash, 0, 0, 'q'); + } + else + { + # If we are already off just send the off command again + return MilightDevice_RGB_Dim($hash, 0, 0, ''); } - - # Dim down to min brightness then send off command (avoid flicker on turn on) - MilightDevice_RGB_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); - return MilightDevice_RGB_Dim($hash, 0, 0, 'q'); } ##################################### @@ -837,11 +841,15 @@ sub MilightDevice_RGBW_Off(@) if (ReadingsVal($hash->{NAME}, "state", "off") ne "off") { readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1); + # Dim down to min brightness then send off command (avoid flicker on turn on) + MilightDevice_RGBW_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); + return MilightDevice_RGBW_Dim($hash, 0, 0, 'q'); + } + else + { + # If we are already off just send the off command again + return MilightDevice_RGBW_Dim($hash, 0, 0, ''); } - - # Dim down to min brightness then send off command (avoid flicker on turn on) - MilightDevice_RGBW_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); - return MilightDevice_RGBW_Dim($hash, 0, 0, 'q'); } ##################################### @@ -1065,10 +1073,15 @@ sub MilightDevice_White_Off(@) if (ReadingsVal($hash->{NAME}, "state", "off") ne "off") { readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1); + # Dim down to min brightness then send off command (avoid flicker on turn on) + MilightDevice_White_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); + return MilightDevice_White_Dim($hash, 0, 0, 'q'); + } + else + { + # If we are already off just send the off command again + return MilightDevice_White_Dim($hash, 0, 0, ''); } - # Dim down to min brightness then send off command (avoid flicker on turn on) - MilightDevice_White_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); - return MilightDevice_White_Dim($hash, 0, 0, 'q'); } #####################################