WIP: ✨ Build capacity map from get_connected_objects() (streaming prep, 1/5) #56
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/capacity-map"
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 1 of a 5-slice effort to bring real-time WebSocket streaming (power/switch/energy) to the Comwatt integration. This slice is pure prep — no behavior change.
What
Builds a
capacityId -> (deviceId, nature, production)map onComwattCoordinatorby fetchingget_connected_objects(site_id)each_fetch_allcycle and folding every capacity whosedeviceIdis non-null.Why get_connected_objects and not get_devices
A live spike confirmed
get_devices()hides the capacities of the grid meter and battery (theirfeaturesare empty).get_connected_objects()returns every connected object (theco.{N}segment of each streamedcapacityId) with all its capacities, each carryingdeviceId. This is the only source that maps grid exchange (...withdrawal.data/...injection.data) and battery (...battery_charge.data/...battery_discharge.data) — confirmed by mapping withdrawal→23599, injection→23598, battery_charge→147223, battery_discharge→147224 on a real account.Scope
coordinator.py: initcapacity_map, reset once per_fetch_all,_try_fetch(get_connected_objects, site_id)+_fold_capacity_map.conftest.py: mock default forget_connected_objects.test_capacity_map_built_from_connected_objects.Tests
44/44 passing, ruff + mypy clean. TDD (RED
AttributeError: no attribute 'capacity_map'-> GREEN).Stacking
This is slice 1/5. Slices 2-5 stack on this branch (
feat/capacity-map).