Skip to content

Commit c476a24

Browse files
committed
Update MockMicrogrid to send states with EVChargerData
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent fc484bd commit c476a24

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/timeseries/mock_microgrid.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def __init__(self, grid_side_meter: bool, sample_rate_s: float = 0.01):
7979
self.evc_ids: list[int] = []
8080
self.meter_ids: list[int] = [4]
8181

82+
self.evc_states: dict[int, ev_charger_pb2.State] = {}
83+
8284
self._streaming_coros: list[typing.Coroutine[None, None, None]] = []
8385
self._streaming_tasks: list[asyncio.Task[None]] = []
8486
self._actors: list[typing.Any] = []
@@ -206,11 +208,12 @@ def _start_ev_charger_streaming(self, evc_id: int) -> None:
206208
current=common_pb2.Metric(value=value + 12.0)
207209
),
208210
)
209-
)
211+
),
212+
state=self.evc_states[evc_id],
210213
),
211-
)
214+
),
212215
),
213-
)
216+
),
214217
)
215218

216219
def add_batteries(self, count: int) -> None:
@@ -294,7 +297,10 @@ def add_ev_chargers(self, count: int) -> None:
294297
self._id_increment += 1
295298

296299
self.evc_ids.append(evc_id)
297-
300+
self.evc_states[evc_id] = ev_charger_pb2.State(
301+
cable_state=ev_charger_pb2.CABLE_STATE_UNPLUGGED,
302+
component_state=ev_charger_pb2.COMPONENT_STATE_READY,
303+
)
298304
self._components.add(
299305
Component(
300306
evc_id,

0 commit comments

Comments
 (0)