[hdpowerview] Remove unnecessary init checks and fix Thing status detail (#12331)
* [hdpowerview] Remove unnecessary init checks and fix Thing status detail Signed-off-by: Fabian Wolter <github@fabian-wolter.de>
This commit is contained in:
parent
dd687435ec
commit
d35e96ab3f
|
@ -311,7 +311,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||||
// exceptions are logged in HDPowerViewWebTargets
|
// exceptions are logged in HDPowerViewWebTargets
|
||||||
} catch (HubException e) {
|
} catch (HubException e) {
|
||||||
logger.warn("Error connecting to bridge: {}", e.getMessage());
|
logger.warn("Error connecting to bridge: {}", e.getMessage());
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE, e.getMessage());
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,18 +67,9 @@ public class HDPowerViewRepeaterHandler extends AbstractHubbedThingHandler {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
repeaterId = getConfigAs(HDPowerViewRepeaterConfiguration.class).id;
|
repeaterId = getConfigAs(HDPowerViewRepeaterConfiguration.class).id;
|
||||||
logger.debug("Initializing repeater handler for repeater {}", repeaterId);
|
logger.debug("Initializing repeater handler for repeater {}", repeaterId);
|
||||||
if (repeaterId <= 0) {
|
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
|
||||||
"@text/offline.conf-error.invalid-id");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bridge bridge = getBridge();
|
Bridge bridge = getBridge();
|
||||||
if (bridge == null) {
|
if (bridge == null) {
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED);
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!(bridge.getHandler() instanceof HDPowerViewHubHandler)) {
|
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED,
|
|
||||||
"@text/offline.conf-error.invalid-bridge-handler");
|
"@text/offline.conf-error.invalid-bridge-handler");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,21 +94,13 @@ public class HDPowerViewShadeHandler extends AbstractHubbedThingHandler {
|
||||||
isDisposing = false;
|
isDisposing = false;
|
||||||
shadeId = getConfigAs(HDPowerViewShadeConfiguration.class).id;
|
shadeId = getConfigAs(HDPowerViewShadeConfiguration.class).id;
|
||||||
logger.debug("Initializing shade handler for shade {}", shadeId);
|
logger.debug("Initializing shade handler for shade {}", shadeId);
|
||||||
if (shadeId <= 0) {
|
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
|
||||||
"@text/offline.conf-error.invalid-id");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bridge bridge = getBridge();
|
Bridge bridge = getBridge();
|
||||||
if (bridge == null) {
|
if (bridge == null) {
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED);
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!(bridge.getHandler() instanceof HDPowerViewHubHandler)) {
|
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED,
|
|
||||||
"@text/offline.conf-error.invalid-bridge-handler");
|
"@text/offline.conf-error.invalid-bridge-handler");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus(ThingStatus.UNKNOWN);
|
updateStatus(ThingStatus.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ channel-type.hdpowerview.shade-vane.description = The opening of the slats in th
|
||||||
# thing status descriptions
|
# thing status descriptions
|
||||||
|
|
||||||
offline.conf-error.no-host-address = Host address must be set
|
offline.conf-error.no-host-address = Host address must be set
|
||||||
offline.conf-error.invalid-id = Configuration 'id' not a valid integer
|
|
||||||
offline.conf-error.invalid-bridge-handler = Invalid bridge handler
|
offline.conf-error.invalid-bridge-handler = Invalid bridge handler
|
||||||
offline.gone.shade-unknown-to-hub = Shade is unknown to Hub
|
offline.gone.shade-unknown-to-hub = Shade is unknown to Hub
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue