mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
Apply suggestions from code review
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: David Pace <dev@davidpace.de>
This commit is contained in:
parent
1b8696ef34
commit
9aa64a2972
@ -89,7 +89,7 @@ public abstract class BoschSHCDeviceHandler extends BoschSHCHandler {
|
||||
protected boolean processDeviceInfo(Device deviceInfo) {
|
||||
try {
|
||||
updateLocationPropertiesIfApplicable(deviceInfo);
|
||||
} catch (Exception e) {
|
||||
} catch (BoschSHCException e) {
|
||||
logger.warn("Error while updating location properties for thing {}.", getThing().getUID(), e);
|
||||
}
|
||||
// do not cancel thing initialization if location properties cannot be updated
|
||||
@ -104,12 +104,10 @@ public abstract class BoschSHCDeviceHandler extends BoschSHCHandler {
|
||||
|
||||
private void updateLocationPropertyIfApplicable(Map<String, String> thingProperties, Device deviceInfo)
|
||||
throws BoschSHCException {
|
||||
@Nullable
|
||||
String roomName = getBridgeHandler().resolveRoomId(deviceInfo.roomId);
|
||||
if (roomName != null) {
|
||||
@Nullable
|
||||
String currentLocation = thingProperties.get(PROPERTY_LOCATION);
|
||||
if (currentLocation == null || !currentLocation.equals(roomName)) {
|
||||
if (!roomName.equals(currentLocation)) {
|
||||
logger.debug("Updating property '{}' of thing {} to '{}'.", PROPERTY_LOCATION, getThing().getUID(),
|
||||
roomName);
|
||||
updateProperty(PROPERTY_LOCATION, roomName);
|
||||
|
Loading…
Reference in New Issue
Block a user