@@ -157,6 +157,44 @@ async def list_single_component_data(
157157 for entry in page :
158158 yield entry
159159
160+ # pylint: disable=too-many-arguments
161+ async def list_multiple_microgrid_components_data (
162+ self ,
163+ * ,
164+ microgrid_components : list [tuple [int , list [int ]]],
165+ metrics : Metric | list [Metric ],
166+ start_dt : datetime ,
167+ end_dt : datetime ,
168+ page_size : int = 1000 ,
169+ ) -> AsyncIterator [MetricSample ]:
170+ """Iterate over the data for multiple microgrids and components.
171+
172+ Args:
173+ microgrid_components: List of tuples where each tuple contains
174+ microgrid ID and corresponding component IDs.
175+ metrics: The metric name or list of metric names.
176+ start_dt: The start date and time.
177+ end_dt: The end date and time.
178+ page_size: The page size.
179+
180+ Yields:
181+ A named tuple with the following fields:
182+ * microgrid_id: The microgrid ID.
183+ * component_id: The component ID.
184+ * metric: The metric name.
185+ * timestamp: The timestamp of the metric sample.
186+ * value: The metric value.
187+ """
188+ async for page in self ._list_microgrid_components_data_pages (
189+ microgrid_components = microgrid_components ,
190+ metrics = [metrics ] if isinstance (metrics , Metric ) else metrics ,
191+ start_dt = start_dt ,
192+ end_dt = end_dt ,
193+ page_size = page_size ,
194+ ):
195+ for entry in page :
196+ yield entry
197+
160198 # pylint: disable=too-many-arguments
161199 async def _list_microgrid_components_data_pages (
162200 self ,
0 commit comments