Skip to content

Commit

Permalink
add missing reponse
Browse files Browse the repository at this point in the history
  • Loading branch information
flxdot committed May 1, 2024
1 parent e3e0346 commit fa7050b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/py_edge_server/carlos/edge/server/device_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
EdgeProtocol,
MessageType,
)
from carlos.edge.interface.messages import DeviceConfigResponsePayload

from carlos.edge.server.constants import CLIENT_NAME

Expand Down Expand Up @@ -116,3 +117,25 @@ async def handle_device_config(
driver_identifier=driver.identifier,
signals=signals,
)

timeseries_index: dict[str, dict[str, int]] = {}
update_drivers = await get_device_drivers(
context=context, device_id=self.device_id
)
for driver in update_drivers:
updated_signals = await get_device_signals(
context=context,
device_id=self.device_id,
driver_identifier=driver.driver_identifier,
)
for signal in updated_signals:
timeseries_index.setdefault(driver.driver_identifier, {})[
signal.signal_identifier
] = signal.timeseries_id

await protocol.send(
CarlosMessage(
message_type=MessageType.DEVICE_CONFIG_RESPONSE,
payload=DeviceConfigResponsePayload(timeseries_index=timeseries_index),
)
)

0 comments on commit fa7050b

Please sign in to comment.