bugfix: 31_MilightDevice: if we're already off don't turn on to set dim level!

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@7807 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mattwire 2015-01-31 21:28:09 +00:00
parent 0392cc0a22
commit fe8bca40b9
2 changed files with 25 additions and 11 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.
- 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

View File

@ -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');
}
#####################################