diff --git a/CHANGELOG.md b/CHANGELOG.md index b5acb751..a672ac4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### ✨ Improved * `SpectrographSet.reset` now accepts `full=True` which performs additional checks and opens/closes the shutter and hartmann doors as needed. `reset` with `full=True` is run automatically during the `cleanup` recipe. +* The GORT websocket now uses the CLU model for `lvmecp` instead of asking the PLC to report its status on each call to `WebsocketServer.enclosure_status()`. ## 0.7.1 - December 20, 2023 diff --git a/src/gort/websocket.py b/src/gort/websocket.py index ba7c7f50..07ae0889 100644 --- a/src/gort/websocket.py +++ b/src/gort/websocket.py @@ -76,8 +76,12 @@ async def start(self): """Start the server and AMQP client.""" # self.gort.add_reply_callback(self._handle_reply) + await self.gort.init() + # Add lvmecp to models. + await self.gort.models.add_actor("lvmecp") + self.websocket_server = await serve( self._handle_websocket_connection, *self.wparams, @@ -181,8 +185,12 @@ async def enclosure_status( ): """Returns the enclosure status.""" - # status = await self.gort.enclosure.status() - status = {} + # Use the model instead of actively polling for the status except + # if info is missing. + if self.gort.models["lvmecp"]["registers"].value is None: + await self.gort.enclosure.status() + + status = self.gort.models["lvmecp"].flatten() await self.reply_to_client(client, command_id, status)