diff --git a/seinflux.py b/seinflux.py index d950812..9773117 100644 --- a/seinflux.py +++ b/seinflux.py @@ -141,6 +141,8 @@ class SEHistory(InfluxDBWrapper): table = result.get(final_key) if table is None: result[final_key] = table = Table(tags, merge_key[0], ('_time', primary)) + else: + table.tags.update(tags) # for previously undefined units by_idx[col_idx] = table for row in rows: by_idx[row[2]].append((row[0], row[1])) @@ -334,7 +336,7 @@ class SEHistory(InfluxDBWrapper): chunks = current.setdefault(devcombi, []) if chunks and time.localtime(chunks[-1][0])[:3] == time.localtime(ts)[:3]: # merge when started at the same day - chunk = chunks[-1][1] + chunk = chunks[-1] chunk[1] = ETERNITY else: chunk = [ts, ETERNITY]