@@ -234,7 +234,7 @@ def stub(self) -> ReportingStub:
234234 return self ._stub
235235
236236 # pylint: disable=too-many-arguments
237- async def list_single_component_data (
237+ async def receive_single_component_data (
238238 self ,
239239 * ,
240240 microgrid_id : int ,
@@ -263,20 +263,21 @@ async def list_single_component_data(
263263 * timestamp: The timestamp of the metric sample.
264264 * value: The metric value.
265265 """
266- async for batch in self ._list_microgrid_components_data_batch (
266+ receiver = await self ._receive_microgrid_components_data_batch (
267267 microgrid_components = [(microgrid_id , [component_id ])],
268268 metrics = [metrics ] if isinstance (metrics , Metric ) else metrics ,
269269 start_time = start_time ,
270270 end_time = end_time ,
271271 resampling_period = resampling_period ,
272272 include_states = include_states ,
273273 include_bounds = include_bounds ,
274- ):
274+ )
275+ async for batch in receiver :
275276 for entry in batch :
276277 yield entry
277278
278279 # pylint: disable=too-many-arguments
279- async def list_microgrid_components_data (
280+ async def receive_microgrid_components_data (
280281 self ,
281282 * ,
282283 microgrid_components : list [tuple [int , list [int ]]],
@@ -307,21 +308,22 @@ async def list_microgrid_components_data(
307308 * timestamp: The timestamp of the metric sample.
308309 * value: The metric value.
309310 """
310- async for batch in self ._list_microgrid_components_data_batch (
311+ receiver = await self ._receive_microgrid_components_data_batch (
311312 microgrid_components = microgrid_components ,
312313 metrics = [metrics ] if isinstance (metrics , Metric ) else metrics ,
313314 start_time = start_time ,
314315 end_time = end_time ,
315316 resampling_period = resampling_period ,
316317 include_states = include_states ,
317318 include_bounds = include_bounds ,
318- ):
319+ )
320+ async for batch in receiver :
319321 for entry in batch :
320322 yield entry
321323
322324 # pylint: disable=too-many-arguments
323325 # pylint: disable=too-many-locals
324- async def _list_microgrid_components_data_batch (
326+ async def _receive_microgrid_components_data_batch (
325327 self ,
326328 * ,
327329 microgrid_components : list [tuple [int , list [int ]]],
@@ -343,7 +345,7 @@ async def _list_microgrid_components_data_batch(
343345 include_states: Whether to include the state data.
344346 include_bounds: Whether to include the bound data.
345347
346- Yields :
348+ Returns :
347349 A ComponentsDataBatch object of microgrid components data.
348350 """
349351 microgrid_components_pb = [
@@ -426,9 +428,7 @@ async def stream_method() -> (
426428 retry_strategy = None ,
427429 )
428430
429- receiver = broadcaster .new_receiver ()
430- async for data in receiver :
431- yield data
431+ return broadcaster .new_receiver ()
432432
433433 # pylint: disable=too-many-arguments
434434 async def receive_single_sensor_data (
0 commit comments