WIP: ✨ Real-time power via the stream: sum FLOW polyphase instances (streaming 3/5) #58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/stream-power"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Slice 3 of 5 (stacked on #57). Routes FLOW measurements to live power entities in real time (~15s, vs the 2-min poll).
What
_apply_power_updatespure helper instream.py: routes FLOW measurements viacapacity_map, sums polyphase instances per device (per-batch accumulator → true sum, not partial overwrites), writes tocoordinator.data["devices"][id]["power"].POWER_SENSOR_NATURES = ("CLAMP", "POWER_SENSOR")— skips switches and non-power natures._process_batchextended to apply BOTH switch + power updates, notify viaasync_update_listeners()if either changed (preserves the 2-min poll timer — no regression to power/energy polling)._apply_switch_updatesuntouched.UPDATE_INTERVALunchanged (2 min). Energy still polls (Slice 4).Why sum
A multi-instance device (e.g. 3-phase solar inverter) pushes all its instances in the same ~15s burst. Summing within one batch yields the device's true instantaneous power (spike confirmed: 629+622+604=1855 W).
Tests
6 new tests (T1-T6). T6 is a real end-to-end: multi-instance solar device → start manager → queue 3 FLOW instances → assert power == 1855 through the real consumer. 57/57 passing, ruff + mypy clean.
Stacking
Base:
feat/stream-switches(PR #57). Rebase once #57 merges.Landed in
mainvia the linear stack fast-forward (commit9d016f7). This slice is part of the streaming feature merged as #56…#62 — closing (its commits are already inmain).Pull request closed