Skip to content

sim2bot.Robot.room_devices

room_devices(timeout: float = 2.0) -> list[RoomDeviceInfo]

Return authored doors and windows available for scene-level control.

Parameters:

  • timeout (float, default: 2.0 ) –

    Discovery timeout in seconds when the scene is not cached.

Returns:

Raises:

  • RuntimeError

    If discovery is needed and the client is not connected.

  • ConnectionClosed

    If the WebSocket closes during discovery.

  • OSError

    If the selected transport cannot send a discovery request.

Notes

Room actuation is experimental while browser-side mechanisms are being revised.

Source code in sim2bot/client.py
def room_devices(self, timeout: float = 2.0) -> list[RoomDeviceInfo]:
    """Return authored doors and windows available for scene-level control.

    Args:
        timeout: Discovery timeout in seconds when the scene is not cached.

    Returns:
        Discovered [`RoomDeviceInfo`][sim2bot.client.RoomDeviceInfo] entries.

    Raises:
        RuntimeError: If discovery is needed and the client is not connected.
        ConnectionClosed: If the WebSocket closes during discovery.
        OSError: If the selected transport cannot send a discovery request.

    Notes:
        Room actuation is experimental while browser-side mechanisms are
        being revised.
    """
    if self._scene is None:
        self.describe(timeout)
    return [
        RoomDeviceInfo.from_json(item)
        for item in (self._scene or {}).get("devices", [])
    ]

Practical examples

Examples use objects discovered from the current scene rather than hard-coded robot metadata.

Inspect doors and windows

for device in sim.room_devices():
    print(device.id, device.kind, device.motion)

Find doors only

doors = [
    device for device in sim.room_devices()
    if device.kind == "door"
]

Guidance

Important behavior

Room-device motion is experimental while browser-side actuation is being revised.


See also