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());
}
}
Aggregations