Fix initialization of shade handler. (#11707)
Fixes #11702 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
112d2653a7
commit
b28a3f3765
|
@ -135,7 +135,7 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
|
||||||
|
|
||||||
if (host == null || host.isEmpty()) {
|
if (host == null || host.isEmpty()) {
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||||
"@text/offline.conf-error-no-host-address");
|
"@text/offline.conf-error.no-host-address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.openhab.core.library.types.QuantityType;
|
||||||
import org.openhab.core.library.types.StopMoveType;
|
import org.openhab.core.library.types.StopMoveType;
|
||||||
import org.openhab.core.library.types.UpDownType;
|
import org.openhab.core.library.types.UpDownType;
|
||||||
import org.openhab.core.library.unit.Units;
|
import org.openhab.core.library.unit.Units;
|
||||||
|
import org.openhab.core.thing.Bridge;
|
||||||
import org.openhab.core.thing.ChannelUID;
|
import org.openhab.core.thing.ChannelUID;
|
||||||
import org.openhab.core.thing.Thing;
|
import org.openhab.core.thing.Thing;
|
||||||
import org.openhab.core.thing.ThingStatus;
|
import org.openhab.core.thing.ThingStatus;
|
||||||
|
@ -80,14 +81,25 @@ public class HDPowerViewShadeHandler extends AbstractHubbedThingHandler {
|
||||||
getShadeId();
|
getShadeId();
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||||
"Configuration 'id' not a valid integer");
|
"@text/offline.conf-error.invalid-id");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (getBridgeHandler() == null) {
|
Bridge bridge = getBridge();
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Hub not configured");
|
if (bridge == null) {
|
||||||
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
if (!(bridge.getHandler() instanceof HDPowerViewHubHandler)) {
|
||||||
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED,
|
||||||
|
"@text/offline.conf-error.invalid-bridge-handler");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ThingStatus bridgeStatus = bridge.getStatus();
|
||||||
|
if (bridgeStatus == ThingStatus.ONLINE) {
|
||||||
|
updateStatus(ThingStatus.ONLINE);
|
||||||
|
} else {
|
||||||
|
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -36,7 +36,9 @@ 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
|
||||||
|
|
||||||
# dynamic channels
|
# dynamic channels
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue