Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[homekit] fix 100% brightness for dimmer #7932

Merged
merged 3 commits into from
Jun 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private void sendCommand() {
final PercentType brightness = (PercentType) commandCache.remove(BRIGHTNESS_COMMAND);
final DecimalType hue = (DecimalType) commandCache.remove(HUE_COMMAND);
final PercentType saturation = (PercentType) commandCache.remove(SATURATION_COMMAND);
final @Nullable OnOffType currentOnState = ((DimmerItem) item).getStateAs(OnOffType.class);
if (on != null) {
// always sends OFF.
// sends ON only if
Expand All @@ -93,7 +94,7 @@ private void sendCommand() {
// - DIMMER_MODE_FILTER_ON_EXCEPT100 is not enabled and brightness is null or below 100
if ((on == OnOffType.OFF) || (dimmerMode == DIMMER_MODE_NORMAL)
|| (dimmerMode == DIMMER_MODE_FILTER_BRIGHTNESS_100)
|| ((dimmerMode == DIMMER_MODE_FILTER_ON_EXCEPT_BRIGHTNESS_100)
|| ((dimmerMode == DIMMER_MODE_FILTER_ON_EXCEPT_BRIGHTNESS_100) && (currentOnState != OnOffType.ON)
&& ((brightness == null) || (brightness.intValue() == 100)))) {
logger.trace("send OnOff command for item {} with value {}", item, on);
((DimmerItem) item).send(on);
Expand All @@ -119,7 +120,7 @@ private void sendCommand() {
// - other modes (DIMMER_MODE_FILTER_BRIGHTNESS_100 or DIMMER_MODE_FILTER_ON_EXCEPT_BRIGHTNESS_100) and
// <100%.
if ((dimmerMode == DIMMER_MODE_NORMAL) || (dimmerMode == DIMMER_MODE_FILTER_ON)
|| (brightness.intValue() < 100)) {
|| (brightness.intValue() < 100) || (currentOnState == OnOffType.ON)) {
logger.trace("send Brightness command for item {} with value {}", item, brightness);
((DimmerItem) item).send(brightness);
}
Expand Down