From: Stefan Triller Date: Mon, 21 Jun 2021 06:50:13 +0000 (+0200) Subject: [influxdb] v2: Fix history queries if items are not tagged (#10888) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=7c221d0fb759b1063d5d0df01042612e93947b10;p=openhab-addons.git [influxdb] v2: Fix history queries if items are not tagged (#10888) Was missing in https://github.com/openhab/openhab-addons/pull/10680 Fixes #10887 Signed-off-by: Stefan Triller --- diff --git a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java index e281245c5d..0994ecebdb 100644 --- a/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java +++ b/bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java @@ -194,6 +194,9 @@ public class InfluxDB2RepositoryImpl implements InfluxDBRepository { private Stream mapRawResultToHistoric(FluxTable rawRow) { return rawRow.getRecords().stream().map(r -> { String itemName = (String) r.getValueByKey(InfluxDBConstants.TAG_ITEM_NAME); + if (itemName == null) { // use measurement name if item is not tagged + itemName = r.getMeasurement(); + } Object value = r.getValueByKey(COLUMN_VALUE_NAME_V2); Instant time = (Instant) r.getValueByKey(COLUMN_TIME_NAME_V2); return new InfluxRow(time, itemName, value);