use of org.eclipse.smarthome.binding.tradfri.internal.model.TradfriSensorData in project smarthome by eclipse.
the class TradfriSensorHandler method onUpdate.
@Override
public void onUpdate(JsonElement data) {
if (active && !(data.isJsonNull())) {
state = new TradfriSensorData(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 sensorId {} to state {batteryLevel: {}, batteryLow: {}, firmwareVersion: {}, modelId: {}, vendor: {}}", state.getDeviceId(), batteryLevel, batteryLow, state.getFirmwareVersion(), state.getModelId(), state.getVendor());
}
}
Aggregations