Skip to content

Commit

Permalink
[wemo] fix wrong brightness value for dimmer switch (#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 <[email protected]>

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

Co-authored-by: Hilbrand Bouwkamp <[email protected]>

* Remove @nullable on simple variable

Co-authored-by: Hilbrand Bouwkamp <[email protected]>
  • Loading branch information
hmerk and Hilbrand authored Oct 15, 2021
1 parent c6a89be commit 42c830b
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 42c830b

Please sign in to comment.