cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.1289: full source

This commit is contained in:
Setti Solutions S.R.L committed 2026-11-08 16:35:35 +02:00
1 parent 165dda4479
commit 05802d6f87
57 files changed
+5928 -232

No files matched your search

+2 -2
View File
@@ -44,7 +44,7 @@ async def backfill(client: HAClient, mapping, queue, since: datetime, until: dat
row = {"start": _ts(r["start"])}
for k in (("sum", "state") if a.kind == "counter" else ("mean", "min", "max")):
v = number(r.get(k))
row[k] = None if v is None else scaled(convert(v, unit, a.unit), a)
row[k] = None if v is None else scaled(convert(v, getattr(a, "unit_in", "") or unit, a.unit), a)
out.append(row)
records.append({"asset": a.asset, "kind": a.kind, "rows": out})
if records:
@@ -83,7 +83,7 @@ async def collect(client: HAClient, mapping, since: datetime, until: datetime, p
continue
for r in rows:
v = number(r.get("mean"))
v = None if v is None else scaled(convert(v, unit, a.unit), a)
v = None if v is None else scaled(convert(v, getattr(a, "unit_in", "") or unit, a.unit), a)
if v is not None:
out.setdefault(a.asset, []).append({"start": _ts(r["start"]), "mean": v})
start = end