AlexxIT/go2rtc · error
camera not ready
Error message
camera not ready
What it means
Connect stops any existing camera preview before starting a new one, retrying StopCameraPreview up to 5 iterations (1s apart). If after 5 attempts the camera still cannot be stopped/prepared, it returns "camera not ready".
Solutions
- Ensure no other session is streaming from the camera before connecting
- Power-cycle / restart the robot or camera device
- Wait and retry Connect after a few seconds
- Check the device is online in the Roborock app and not in DND mode
Example fix
// before
err := client.Connect(ctx) // "camera not ready"
// after
if err != nil && err.Error() == "camera not ready" {
time.Sleep(10 * time.Second)
err = client.Connect(ctx) // retry after device frees up
} Defensive patterns
Strategy: retry
Validate before calling
// check device availability before Connect
if !isDeviceOnline(deviceID) || isOtherStreamActive(deviceID) {
return errors.New("camera busy or offline; retry later")
} Try / catch
err := client.Connect(ctx)
if err != nil && err.Error() == "camera not ready" {
time.Sleep(10 * time.Second)
err = client.Connect(ctx) // bounded retry
} Prevention
- Ensure exclusive access — stop other streams before connecting
- Check device online status via the Roborock IoT API first
- Space out reconnections to let the camera release its previous session
When it happens
Trigger: Calling Connect (directly or via Dial/Start) when the roborock camera stays busy — StopCameraPreview keeps failing or the device never becomes free within the 5-second window.
Common situations: Another client/app is actively streaming from the camera; the robot vacuum is offline or in Do-Not-Disturb; lingering previous session on the device.
Related errors
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/9ee5fb6b68946607.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/roborock/client.go:82
return nil
}
func (c *Client) Connect() error {
// 1. Check if camera ready for connection
for i := 0; ; i++ {
clientID, err := c.GetHomesecConnectStatus()
if err != nil {
return err
}
if clientID == "none" {
break
}
if err = c.StopCameraPreview(clientID); err != nil {
return err
}
if i == 5 {
return errors.New("camera not ready")
}
time.Sleep(time.Second)
}
// 2. Start camera
if err := c.StartCameraPreview(); err != nil {
return err
}
// 3. Get TURN config
conf := pion.Configuration{}
if turn, _ := c.GetTurnServer(); turn != nil {
conf.ICEServers = append(conf.ICEServers, *turn)
}
// 4. Create Peer Connection
api, err := webrtc.NewAPI()View on GitHub (pinned to c245815e75)