[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
|
||||
} catch (HubException e) {
|
||||
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() {
|
||||
repeaterId = getConfigAs(HDPowerViewRepeaterConfiguration.class).id;
|
||||
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();
|
||||
if (bridge == null) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED);
|
||||
return;
|
||||
}
|
||||
if (!(bridge.getHandler() instanceof HDPowerViewHubHandler)) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED,
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"@text/offline.conf-error.invalid-bridge-handler");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -94,21 +94,13 @@ public class HDPowerViewShadeHandler extends AbstractHubbedThingHandler {
|
|||
isDisposing = false;
|
||||
shadeId = getConfigAs(HDPowerViewShadeConfiguration.class).id;
|
||||
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();
|
||||
if (bridge == null) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED);
|
||||
return;
|
||||
}
|
||||
if (!(bridge.getHandler() instanceof HDPowerViewHubHandler)) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED,
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"@text/offline.conf-error.invalid-bridge-handler");
|
||||
return;
|
||||
}
|
||||
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ channel-type.hdpowerview.shade-vane.description = The opening of the slats in th
|
|||
# thing status descriptions
|
||||
|
||||
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.gone.shade-unknown-to-hub = Shade is unknown to Hub
|
||||
|
||||
|
|
Loading…
Reference in New Issue