Skip to content

Commit

Permalink
[wemo] fix wrong brightness value for dimmer switch (openhab#11385)
Browse files Browse the repository at this point in the history
* [wemo] fix wrong brightness value for dimmer switch

Signed-off-by: Hans-Jörg Merk <github@hmerk.de>

* Update bundles/org.openhab.binding.wemo/src/main/java/org/openhab/binding/wemo/internal/handler/WemoDimmerHandler.java

Co-authored-by: Hilbrand Bouwkamp <hilbrand@h72.nl>

* Remove @nullable on simple variable

Co-authored-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
Signed-off-by: Dave J Schoepel <dave@theschoepels.com>
  • Loading branch information
2 people authored and dschoepel committed Nov 9, 2021
1 parent f7fefbd commit 2df01d0
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,17 @@ public void onValueReceived(@Nullable String variable, @Nullable String value, @
new Object[] { variable, value, service, this.getThing().getUID() });
updateStatus(ThingStatus.ONLINE);
if (variable != null && value != null) {
String oldBinaryState = this.stateMap.get("BinaryState");
this.stateMap.put(variable, value);
}
if (variable != null && value != null) {
switch (variable) {
case "BinaryState":
State state = value.equals("0") ? OnOffType.OFF : OnOffType.ON;
logger.debug("State '{}' for device '{}' received", state, getThing().getUID());
updateState(CHANNEL_BRIGHTNESS, state);
if (state.equals(OnOffType.OFF)) {
updateState(CHANNEL_TIMERSTART, OnOffType.OFF);
if (oldBinaryState == null || !oldBinaryState.equals(value)) {
State state = value.equals("0") ? OnOffType.OFF : OnOffType.ON;
logger.debug("State '{}' for device '{}' received", state, getThing().getUID());
updateState(CHANNEL_BRIGHTNESS, state);
if (state.equals(OnOffType.OFF)) {
updateState(CHANNEL_TIMERSTART, OnOffType.OFF);
}
}
break;
case "brightness":
Expand Down

0 comments on commit 2df01d0

Please sign in to comment.