@@ -92,8 +92,8 @@ def __iter__(self) -> Iterator[MetricSample]:
9292 for item in items :
9393 cid = getattr (item , self .id_attr )
9494 for sample in getattr (item , "metric_samples" , []):
95- ts = sample .sampled_at .ToDatetime ().replace (tzinfo = timezone .utc )
96- met = sample .metric .name
95+ ts = sample .sample_time .ToDatetime ().replace (tzinfo = timezone .utc )
96+ met = Metric ( sample .metric ) .name
9797
9898 # Handle simple_metric
9999 if sample .value .HasField ("simple_metric" ):
@@ -127,7 +127,7 @@ def __iter__(self) -> Iterator[MetricSample]:
127127 )
128128
129129 for state in getattr (item , "states" , []):
130- ts = state .sampled_at .ToDatetime ().replace (tzinfo = timezone .utc )
130+ ts = state .sample_time .ToDatetime ().replace (tzinfo = timezone .utc )
131131 for category , category_items in {
132132 "state" : getattr (state , "states" , []),
133133 "warning" : getattr (state , "warnings" , []),
@@ -150,7 +150,10 @@ def __init__(self, data_pb: PBReceiveMicrogridComponentsDataStreamResponse):
150150 data_pb: The underlying protobuf message.
151151 """
152152 super ().__init__ (
153- data_pb , id_attr = "component_id" , items_attr = "components" , has_bounds = True
153+ data_pb ,
154+ id_attr = "electrical_component_id" ,
155+ items_attr = "components" ,
156+ has_bounds = True ,
154157 )
155158
156159
0 commit comments