Java Code Examples for org.eclipse.smarthome.core.thing.ThingStatusDetail#BRIDGE_OFFLINE

The following examples show how to use org.eclipse.smarthome.core.thing.ThingStatusDetail#BRIDGE_OFFLINE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseThingHandler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
    if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE
            && getThing().getStatusInfo().getStatusDetail() == ThingStatusDetail.BRIDGE_OFFLINE) {
        updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE);
    } else if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
    }
}
 
Example 2
Source File: HomematicThingHandler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Updates the thing status based on device status.
 */
private void updateStatus(HmDevice device) throws GatewayNotAvailableException, IOException {
    loadHomematicChannelValues(device.getChannel(0));

    ThingStatus oldStatus = thing.getStatus();
    ThingStatus newStatus = ThingStatus.ONLINE;
    ThingStatusDetail newDetail = ThingStatusDetail.NONE;

    if (getBridge().getStatus() == ThingStatus.OFFLINE) {
        newStatus = ThingStatus.OFFLINE;
        newDetail = ThingStatusDetail.BRIDGE_OFFLINE;
    } else if (device.isFirmwareUpdating()) {
        newStatus = ThingStatus.OFFLINE;
        newDetail = ThingStatusDetail.FIRMWARE_UPDATING;
    } else if (device.isUnreach()) {
        newStatus = ThingStatus.OFFLINE;
        newDetail = ThingStatusDetail.COMMUNICATION_ERROR;
    } else if (device.isConfigPending() || device.isUpdatePending()) {
        newDetail = ThingStatusDetail.CONFIGURATION_PENDING;
    }

    if (thing.getStatus() != newStatus || thing.getStatusInfo().getStatusDetail() != newDetail) {
        updateStatus(newStatus, newDetail);
    }
    if (oldStatus == ThingStatus.OFFLINE && newStatus == ThingStatus.ONLINE) {
        initialize();
    }
}
 
Example 3
Source File: AbstractMQTTThingHandler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Return the bridge status.
 */
public ThingStatusInfo getBridgeStatus() {
    Bridge b = getBridge();
    if (b != null) {
        return b.getStatusInfo();
    } else {
        return new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE, null);
    }
}
 
Example 4
Source File: OwBaseThingHandler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
    if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE
            && getThing().getStatusInfo().getStatusDetail() == ThingStatusDetail.BRIDGE_OFFLINE) {
        if (validConfig) {
            updatePresenceStatus(UnDefType.UNDEF);
        } else {
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR);
        }
    } else if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
    }
}
 
Example 5
Source File: OwBaseThingHandler.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * check if thing can be refreshed from the bridge handler
 *
 * @return true if thing can be refreshed
 */
public boolean isRefreshable() {
    return super.isInitialized()
            && this.thing.getStatusInfo().getStatusDetail() != ThingStatusDetail.CONFIGURATION_ERROR
            && this.thing.getStatusInfo().getStatusDetail() != ThingStatusDetail.BRIDGE_OFFLINE;
}