Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions benchmarks/data_ingestion/benchmark_microgrid_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def gen_market_data(component_id: int) -> MeterData:
"""
timestamp = Timestamp()
timestamp.GetCurrentTime()
return MeterData(
return MeterData.from_proto(
microgrid_pb.ComponentData(
id=component_id,
ts=timestamp,
Expand All @@ -69,7 +69,7 @@ def gen_pv_data(component_id: int) -> MeterData:
"""
timestamp = Timestamp()
timestamp.GetCurrentTime()
return MeterData(
return MeterData.from_proto(
microgrid_pb.ComponentData(
id=component_id,
ts=timestamp,
Expand All @@ -93,7 +93,7 @@ def gen_battery_data(component_id: int) -> BatteryData:
"""
timestamp = Timestamp()
timestamp.GetCurrentTime()
return BatteryData(
return BatteryData.from_proto(
microgrid_pb.ComponentData(
id=component_id,
ts=timestamp,
Expand Down Expand Up @@ -123,7 +123,7 @@ def gen_inverter_data(component_id: int) -> InverterData:
"""
timestamp = Timestamp()
timestamp.GetCurrentTime()
return InverterData(
return InverterData.from_proto(
microgrid_pb.ComponentData(
id=component_id,
ts=timestamp,
Expand Down
10 changes: 6 additions & 4 deletions src/frequenz/sdk/microgrid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ async def meter_data(
A channel receiver that provides realtime meter data.
"""
await self._expect_category(component_id, ComponentCategory.METER)
return self._get_component_data_channel(component_id, MeterData).get_receiver()
return self._get_component_data_channel(
component_id, MeterData.from_proto
).get_receiver()

async def battery_data(
self,
Expand All @@ -436,7 +438,7 @@ async def battery_data(
"""
await self._expect_category(component_id, ComponentCategory.BATTERY)
return self._get_component_data_channel(
component_id, BatteryData
component_id, BatteryData.from_proto
).get_receiver()

async def inverter_data(
Expand All @@ -460,7 +462,7 @@ async def inverter_data(
"""
await self._expect_category(component_id, ComponentCategory.INVERTER)
return self._get_component_data_channel(
component_id, InverterData
component_id, InverterData.from_proto
).get_receiver()

async def ev_charger_data(
Expand All @@ -484,7 +486,7 @@ async def ev_charger_data(
"""
await self._expect_category(component_id, ComponentCategory.EV_CHARGER)
return self._get_component_data_channel(
component_id, EVChargerData
component_id, EVChargerData.from_proto
).get_receiver()

async def set_power(self, component_id: int, power_w: int) -> Empty:
Expand Down
Loading