use of org.openhab.binding.withings.internal.api.WithingsApiClient in project openhab1-addons by openhab.
the class WithingsBinding method updateItemStates.
private void updateItemStates(Map<String, WithingsBindingConfig> withingsBindings) {
try {
WithingsApiClient client = this.withingsApiClients.get(0);
List<MeasureGroup> measures = client.getMeasures(lastUpdate);
if (measures == null || measures.isEmpty()) {
logger.info("No new measures found since the last update.");
return;
}
for (Entry<String, WithingsBindingConfig> withingBinding : withingsBindings.entrySet()) {
WithingsBindingConfig withingsBindingConfig = withingBinding.getValue();
String itemName = withingBinding.getKey();
updateItemState(itemName, withingsBindingConfig, measures);
}
lastUpdate = now();
} catch (Exception ex) {
logger.error("Cannot get Withings measure data: " + ex.getMessage(), ex);
}
}
Aggregations