Skip to content

Commit

Permalink
[innogysmarthome] Don't set state twice
Browse files Browse the repository at this point in the history
Both dimmer and rollershutter set first the state as ONOFF and then as PercentType. It should set only one time because the percentage is the value actual wanted.
Closes openhab#6610

Signed-off-by: Hilbrand Bouwkamp <[email protected]>
  • Loading branch information
Hilbrand committed Dec 31, 2019
1 parent e54ca65 commit e7e03da
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.time.format.FormatStyle;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.eclipse.jdt.annotation.NonNullByDefault;
Expand Down Expand Up @@ -389,7 +390,9 @@ public void onDeviceStateChanged(final Device device) {
}

// CAPABILITY STATES
for (final Capability c : device.getCapabilityMap().values()) {
for (final Entry<String, Capability> entry : device.getCapabilityMap().entrySet()) {
final Capability c = entry.getValue();

logger.debug("->capability:{} ({}/{})", c.getId(), c.getType(), c.getName());

if (c.getCapabilityState() == null) {
Expand Down Expand Up @@ -420,11 +423,6 @@ public void onDeviceStateChanged(final Device device) {
final Integer dimLevel = c.getCapabilityState().getDimmerActuatorState();
if (dimLevel != null) {
logger.debug("Dimlevel state {}", dimLevel);
if (dimLevel > 0) {
updateState(CHANNEL_DIMMER, OnOffType.ON);
} else {
updateState(CHANNEL_DIMMER, OnOffType.OFF);
}
updateState(CHANNEL_DIMMER, new PercentType(dimLevel));
} else {
logger.debug("State for {} is STILL NULL!! cstate-id: {}, c-id: {}", c.getType(),
Expand All @@ -436,11 +434,6 @@ public void onDeviceStateChanged(final Device device) {
if (rollerShutterLevel != null) {
rollerShutterLevel = invertValueIfConfigured(CHANNEL_ROLLERSHUTTER, rollerShutterLevel);
logger.debug("RollerShutterlevel state {}", rollerShutterLevel);
if (rollerShutterLevel > 0) {
updateState(CHANNEL_ROLLERSHUTTER, UpDownType.DOWN);
} else {
updateState(CHANNEL_ROLLERSHUTTER, UpDownType.UP);
}
updateState(CHANNEL_ROLLERSHUTTER, new PercentType(rollerShutterLevel));
} else {
logger.debug("State for {} is STILL NULL!! cstate-id: {}, c-id: {}", c.getType(),
Expand Down

0 comments on commit e7e03da

Please sign in to comment.