Skip to content

Commit 833ba4c

Browse files
committed
Stop filtering LOAD components from microgrid component lists
We used to filter out `LOAD` components in the MicrogridClient, because those were always just placeholders, and not actual active components that can stream data. Now that the LOAD components are going away, we don't have to filter by them anymore. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 10bb82d commit 833ba4c

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/frequenz/sdk/microgrid/client/_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,7 @@ async def components(self) -> Iterable[Component]:
244244
)
245245
components_only = filter(
246246
lambda c: c.category
247-
not in (
248-
microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_SENSOR,
249-
microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_LOAD,
250-
),
247+
is not microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_SENSOR,
251248
component_list.components,
252249
)
253250
result: Iterable[Component] = map(

tests/microgrid/test_client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,10 @@ async def test_components(self) -> None:
7474
Component(0, ComponentCategory.METER),
7575
}
7676

77-
# sensors/loads are not counted as components by the API client
77+
# sensors are not counted as components by the API client
7878
servicer.add_component(
7979
1, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_SENSOR
8080
)
81-
servicer.add_component(
82-
2, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_LOAD
83-
)
8481
assert set(await microgrid.components()) == {
8582
Component(0, ComponentCategory.METER),
8683
Component(0, ComponentCategory.BATTERY),
@@ -91,7 +88,6 @@ async def test_components(self) -> None:
9188
[
9289
(9, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_METER),
9390
(99, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_INVERTER),
94-
(66, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_LOAD),
9591
(666, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_SENSOR),
9692
(999, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_BATTERY),
9793
]
@@ -104,7 +100,6 @@ async def test_components(self) -> None:
104100

105101
servicer.set_components(
106102
[
107-
(66, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_LOAD),
108103
(99, microgrid_pb.ComponentCategory.COMPONENT_CATEGORY_SENSOR),
109104
(
110105
100,

0 commit comments

Comments
 (0)