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. # 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. # 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 - added: new dustbin icon
- bugfix: SYSMON: some warnings - bugfix: SYSMON: some warnings
- changed: SYSMON: documentation - changed: SYSMON: documentation

View File

@ -672,12 +672,16 @@ sub MilightDevice_RGB_Off(@)
if (ReadingsVal($hash->{NAME}, "state", "off") ne "off") if (ReadingsVal($hash->{NAME}, "state", "off") ne "off")
{ {
readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1); readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1);
}
# Dim down to min brightness then send off command (avoid flicker on turn on) # Dim down to min brightness then send off command (avoid flicker on turn on)
MilightDevice_RGB_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); MilightDevice_RGB_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags);
return MilightDevice_RGB_Dim($hash, 0, 0, 'q'); 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, '');
}
}
##################################### #####################################
sub MilightDevice_RGB_Dim(@) sub MilightDevice_RGB_Dim(@)
@ -837,12 +841,16 @@ sub MilightDevice_RGBW_Off(@)
if (ReadingsVal($hash->{NAME}, "state", "off") ne "off") if (ReadingsVal($hash->{NAME}, "state", "off") ne "off")
{ {
readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1); readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1);
}
# Dim down to min brightness then send off command (avoid flicker on turn on) # Dim down to min brightness then send off command (avoid flicker on turn on)
MilightDevice_RGBW_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); MilightDevice_RGBW_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags);
return MilightDevice_RGBW_Dim($hash, 0, 0, 'q'); 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, '');
}
}
##################################### #####################################
sub MilightDevice_RGBW_Dim(@) sub MilightDevice_RGBW_Dim(@)
@ -1065,11 +1073,16 @@ sub MilightDevice_White_Off(@)
if (ReadingsVal($hash->{NAME}, "state", "off") ne "off") if (ReadingsVal($hash->{NAME}, "state", "off") ne "off")
{ {
readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1); readingsSingleUpdate($hash, "brightness_on", ReadingsVal($hash->{NAME}, "brightness", 100), 1);
}
# Dim down to min brightness then send off command (avoid flicker on turn on) # Dim down to min brightness then send off command (avoid flicker on turn on)
MilightDevice_White_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags); MilightDevice_White_Dim($hash, 100/MilightDevice_DimSteps($hash), $ramp, $flags);
return MilightDevice_White_Dim($hash, 0, 0, 'q'); 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, '');
}
}
##################################### #####################################
sub MilightDevice_White_Dim(@) sub MilightDevice_White_Dim(@)