Skip to content

Conversation

@clawd139
Copy link

@clawd139 clawd139 commented Feb 3, 2026

Summary

This PR adds a standalone camera module for streaming video/audio from Roborock vacuums with cameras. Addresses part of #738 (Camera Livestream, Remote Control).

Features

  • Live video streaming (HD/SD quality selection)
  • Bidirectional voice calls (speak to and hear from robot)
  • Snapshot capture (single frame to PIL Image)
  • Video recording (to file with optional audio)
  • Audio transmission (for intercom/voice functionality)

Implementation

The module uses:

  • MQTT for WebRTC signaling - reuses the existing roborock.protocol encoders
  • aiortc for WebRTC - handles peer connection and media tracks
  • paho-mqtt - standalone MQTT connection (not aiomqtt)

This is provided as a standalone module (roborock/camera.py) that manages its own MQTT connection. Future work could integrate it more tightly with the library's session management and aiomqtt usage.

Protocol Documentation

Full protocol documentation is included in docs/CAMERA_PROTOCOL.md, covering:

  • MQTT topics and credentials
  • All camera/voice/RC commands
  • SDP/ICE exchange format
  • Audio format specifications (48kHz, stereo from robot, mono to robot)

Dependencies

New optional dependencies:

  • aiortc - WebRTC implementation
  • paho-mqtt - MQTT client
  • pyaudio - Voice call audio playback (optional)
  • opencv-python - Video display (optional)

Usage Example

from roborock.camera import RoborockCamera

camera = RoborockCamera(
    duid="YOUR_DEVICE_ID",
    local_key="YOUR_LOCAL_KEY",
    rriot_u="YOUR_RRIOT_U",
    rriot_k="YOUR_RRIOT_K",
    rriot_s="YOUR_RRIOT_S",
    password="9876"  # Pattern password as digits
)

async with camera:
    # Take a snapshot
    frame = await camera.get_frame()
    frame.save("snapshot.jpg")
    
    # Record video
    await camera.record("output.mp4", duration=10)

Tested On

  • Roborock Qrevo Curv (model a135)

Other camera-equipped models likely work but are untested.

Notes

  • Only one client can preview the camera at a time (close phone app first)
  • The start_voice_chat command must be called to receive audio frames
  • Robot sends stereo interleaved audio; client sends mono

Happy to iterate on this if you'd prefer different structuring or tighter integration with the existing codebase!

Closes part of #738

Adds a standalone camera module for streaming video/audio from Roborock
vacuums with cameras. This addresses part of Python-roborock#738.

Features:
- Live video streaming (HD/SD quality)
- Bidirectional voice calls (speak to and hear from robot)
- Snapshot capture
- Video recording
- Audio sending for intercom functionality

The implementation uses:
- MQTT for WebRTC signaling (via existing protocol encoders)
- aiortc for WebRTC peer connection
- paho-mqtt for MQTT connection (standalone, not using aiomqtt)

This is provided as a standalone module that could be integrated more
tightly with the library's session management in future work.

See docs/CAMERA_PROTOCOL.md for full protocol documentation.

New dependencies (optional):
- aiortc: WebRTC implementation
- paho-mqtt: MQTT client
- pyaudio: Voice call audio (optional)
- opencv-python: Video display (optional)
@allenporter
Copy link
Contributor

Impressive result and use of AI.

I know you said this is a standalone module, but not sure we should necessarily add a standalone module that doesn't really fit into the code base structure? Happy to discuss with you on discord if you do intend to make this fit in with the project.

@Lash-L
Copy link
Collaborator

Lash-L commented Feb 3, 2026

Impressive result and use of AI.

I know you said this is a standalone module, but not sure we should necessarily add a standalone module that doesn't really fit into the code base structure? Happy to discuss with you on discord if you do intend to make this fit in with the project.

Agreed!

We should utilize the existing mqtt topic rather than making a new one.

Just so I can understand, what did your base this off of? Did you grab the mitm packets yourself? Did you use https://github.com/AlexxIT/go2rtc/tree/master/pkg/roborock or did you use the decompiled app code?

I do think we may be able to do these mqtt commands over the local connection as well (not sure for these, but worth trying)

Then maybe to make it easier to review - once the logic is more integrated with our existing logic, let's remove the ability to talk to the stream for now to minimize functionality being added and make it a bit easier to review, then that can be added in a follow up!

Thanks for tackling this! It has been on my todo list for a long time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants