AlexxIT/go2rtc · error

wrong pin code

Error message

wrong pin code

What it means

Roborock homesec guard: the IoT RPC 'check_homesec_password' succeeded but returned ok=false, meaning the configured pin does not match the device's home-security password. Pure credential rejection — the device rejected the pin supplied on the client.

Solutions

  1. Verify the PIN in the Roborock app and update the client's pin field
  2. Re-check which device the pin belongs to (per-device PINs)
  3. Clear the device PIN in the app if you intend to connect without one
  4. Ensure the pin is set on the client before Dial

Example fix

// before
c := NewClient(...)
c.pin = "0000" // stale
c.CheckHomesecPassword()
// after
c.pin = "1234" // current PIN from the Roborock app
c.CheckHomesecPassword()
Defensive patterns

Strategy: validation

Validate before calling

if c.pin == "" {
    return errors.New("device PIN required before CheckHomesecPassword")
}
// verify pin format (e.g. 4-8 digits)
if matched, _ := regexp.MatchString(`^\d{4,8}$`, c.pin); !matched {
    return errors.New("pin format looks invalid")
}

Try / catch

err := client.CheckHomesecPassword()
if err != nil && err.Error() == "wrong pin code" {
    return ErrInvalidPin // surface a typed error to prompt the user for the PIN
}

Prevention

When it happens

Trigger: Calling CheckHomesecPassword (via Dial) with a Client whose `pin` does not match the device's home-security PIN — wrong PIN typed, PIN changed in the app, or pin field never set.

Common situations: User changed the Roborock app lock-screen PIN; passing an empty/default pin when the device has one configured; copying the wrong credential into the client config.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/bb300d324765ea95. Report an issue: GitHub.

Appendix: source

Thrown at pkg/roborock/client.go:211

			if !ok {
				return errors.New("can't connect")
			}

			return nil
		}
	}
}

func (c *Client) CheckHomesecPassword() (err error) {
	var ok bool

	params := `{"password":"` + c.pin + `"}`
	if err = c.iot.Call("check_homesec_password", params, &ok); err != nil {
		return
	}

	if !ok {
		return errors.New("wrong pin code")
	}

	return nil
}

func (c *Client) GetHomesecConnectStatus() (clientID string, err error) {
	var res []byte

	if err = c.iot.Call("get_homesec_connect_status", nil, &res); err != nil {
		return
	}

	var v struct {
		Status   int    `json:"status"`
		ClientID string `json:"client_id"`
	}
	if err = json.Unmarshal(res, &v); err != nil {
		return

View on GitHub (pinned to c245815e75)