[amazonechocontrol] bugfixes (#9118)

* fix color channel for smarthome devices
* fix smarthome devices not updating

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K 2020-11-24 08:18:28 +01:00 committed by GitHub
parent c83af2c66d
commit a5940bc141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -932,7 +932,7 @@ public class AccountHandler extends BaseBridgeHandler implements IWebSocketComma
private synchronized void updateSmartHomeState(@Nullable String deviceFilterId) {
try {
logger.debug("updateSmartHomeState started");
logger.debug("updateSmartHomeState started with deviceFilterId={}", deviceFilterId);
Connection connection = this.connection;
if (connection == null || !connection.getIsLoggedIn()) {
return;
@ -976,8 +976,10 @@ public class AccountHandler extends BaseBridgeHandler implements IWebSocketComma
logger.debug("Device update {} suspended", id);
continue;
}
if (id.equals(deviceFilterId)) {
if (deviceFilterId == null || id.equals(deviceFilterId)) {
smartHomeDeviceHandler.updateChannelStates(allDevices, applianceIdToCapabilityStates);
} else {
logger.trace("Id {} not matching filter {}", id, deviceFilterId);
}
}

View File

@ -113,11 +113,10 @@ public class HandlerColorController extends HandlerBase {
}
}
}
if (lastColorName == null) {
lastColorName = colorNameValue;
} else if (colorNameValue == null && lastColorName != null) {
if (colorNameValue == null && lastColorName != null) {
colorNameValue = lastColorName;
}
lastColorName = colorNameValue;
updateState(COLOR_PROPERTIES.channelId,
lastColorName == null ? UnDefType.UNDEF : new StringType(lastColorName));
}
@ -134,7 +133,7 @@ public class HandlerColorController extends HandlerBase {
colorObject.addProperty("hue", color.getHue());
colorObject.addProperty("saturation", color.getSaturation().floatValue() / 100);
colorObject.addProperty("brightness", color.getBrightness().floatValue() / 100);
connection.smartHomeCommand(entityId, "setColor", "color", colorObject);
connection.smartHomeCommand(entityId, "setColor", "value", colorObject);
}
}
}