Search in sources :

Example 1 with TradfriControllerData

use of org.eclipse.smarthome.binding.tradfri.internal.model.TradfriControllerData in project smarthome by eclipse.

the class TradfriControllerHandler method onUpdate.

@Override
public void onUpdate(JsonElement data) {
    if (active && !(data.isJsonNull())) {
        state = new TradfriControllerData(data);
        updateStatus(state.getReachabilityStatus() ? ThingStatus.ONLINE : ThingStatus.OFFLINE);
        DecimalType batteryLevel = state.getBatteryLevel();
        if (batteryLevel != null) {
            updateState(CHANNEL_BATTERY_LEVEL, batteryLevel);
        }
        OnOffType batteryLow = state.getBatteryLow();
        if (batteryLow != null) {
            updateState(CHANNEL_BATTERY_LOW, batteryLow);
        }
        updateDeviceProperties(state);
        logger.debug("Updating thing for controllerId {} to state {batteryLevel: {}, batteryLow: {}, firmwareVersion: {}, modelId: {}, vendor: {}}", state.getDeviceId(), batteryLevel, batteryLow, state.getFirmwareVersion(), state.getModelId(), state.getVendor());
    }
}
Also used : TradfriControllerData(org.eclipse.smarthome.binding.tradfri.internal.model.TradfriControllerData) OnOffType(org.eclipse.smarthome.core.library.types.OnOffType) DecimalType(org.eclipse.smarthome.core.library.types.DecimalType)

Aggregations

TradfriControllerData (org.eclipse.smarthome.binding.tradfri.internal.model.TradfriControllerData)1 DecimalType (org.eclipse.smarthome.core.library.types.DecimalType)1 OnOffType (org.eclipse.smarthome.core.library.types.OnOffType)1