]> git.basschouten.com Git - openhab-addons.git/commitdiff
[influxdb] v2: Fix history queries if items are not tagged (#10888)
authorStefan Triller <t2000@users.noreply.github.com>
Mon, 21 Jun 2021 06:50:13 +0000 (08:50 +0200)
committerGitHub <noreply@github.com>
Mon, 21 Jun 2021 06:50:13 +0000 (08:50 +0200)
Was missing in https://github.com/openhab/openhab-addons/pull/10680

Fixes #10887

Signed-off-by: Stefan Triller <github@stefantriller.de>
bundles/org.openhab.persistence.influxdb/src/main/java/org/openhab/persistence/influxdb/internal/influx2/InfluxDB2RepositoryImpl.java

index e281245c5d18df0a1cd86eee0ea518223ca16e00..0994ecebdb3240028030044f23d9e9f11a62850b 100644 (file)
@@ -194,6 +194,9 @@ public class InfluxDB2RepositoryImpl implements InfluxDBRepository {
     private Stream<InfluxRow> 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);