Skip to content

fix: remaining bug fixes and missing features#66

Merged
markus-lassfolk merged 2 commits into
mainfrom
fix/remaining-issues
Mar 1, 2026
Merged

fix: remaining bug fixes and missing features#66
markus-lassfolk merged 2 commits into
mainfrom
fix/remaining-issues

Conversation

@markus-lassfolk

@markus-lassfolk markus-lassfolk commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Closes #32, #35, #50, #61, #64


Note

Medium Risk
Adds new MQTT control commands including shutdown and obstacle/person detection toggles, which can affect robot behavior and safety if misused. Also changes protocol enum mappings and plan start payload shape, which could impact downstream integrations expecting previous values.

Overview
Adds new YarboLocalClient command wrappers for system control and safety-related features, including shutdown, restart_container, read_clean_area, set_person_detect (inverted disable flag), and set_ignore_obstacles (explicitly documented as hazardous).

Extends plan execution by adding an optional percent parameter to start_plan, and corrects telemetry attachment typing by remapping HeadType to the actual wire values (including Trimmer=99) plus a head_serial` alias; unit tests are updated accordingly.

Documentation and project metadata are refreshed to point to in-repo docs/index.md protocol docs (and update RSA key guidance) rather than external reverse-engineering references.

Written by Cursor Bugbot for commit a503560. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings March 1, 2026 11:56
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Comment thread src/yarbo/local.py
"""
await self._ensure_controller()
return await self._publish_and_wait("start_plan", {"planId": plan_id})
return await self._publish_and_wait("start_plan", {"planId": plan_id, "percent": percent})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YarboClient.start_plan doesn't forward new percent parameter

Medium Severity

YarboLocalClient.start_plan was updated to accept a new percent parameter (defaulting to 100), but the YarboClient facade in client.py still has the old signature start_plan(self, plan_id: str) and forwards the call without percent. Users of the primary YarboClient entry point cannot pass percent, and the parameter is silently ignored if somehow provided. The facade signature and delegation call need to match the updated YarboLocalClient method.

Fix in Cursor Fix in Web

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the library’s protocol mapping and local MQTT command surface to align with newly confirmed wire-level details, and refreshes documentation to reference in-repo/community protocol sources (closing several protocol-correction issues).

Changes:

  • Correct HeadType wire values (including 99=Trimmer) and update model tests accordingly.
  • Extend YarboLocalClient with additional protocol commands (plan start percent, shutdown/restart container, read_clean_area, ignore_obstacles) and add a head-serial alias on telemetry.
  • Replace multiple references to the external reversing repo with generic “protocol documentation” references and update project/docs metadata links.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_models.py Updates expectations for corrected head type wire values and trimmer handling.
src/yarbo/mqtt.py Adjusts module docstring/protocol reference wording.
src/yarbo/models.py Corrects HeadType enum values and adds head_serial alias on telemetry.
src/yarbo/local.py Adds/renames local MQTT commands (plan percent, shutdown/restart, read_clean_area, ignore_obstacles, person detect).
src/yarbo/keys/README.md Updates guidance for providing the RSA public key.
src/yarbo/discovery.py Updates reference wording to “protocol documentation”.
src/yarbo/const.py Tweaks protocol source wording and telemetry leaf comments.
src/yarbo/cloud_mqtt.py Updates reference wording to “protocol documentation”.
src/yarbo/cloud.py Updates reference wording and rsa key docstring hint.
src/yarbo/auth.py Updates key guidance wording and error message text.
src/yarbo/_codec.py Updates reference wording to “community protocol documentation”.
src/yarbo/init.py Updates package-level description wording.
pyproject.toml Replaces external reversing link with an in-repo “Protocol Documentation” link.
examples/cloud_login.py Updates RSA key help text to point at keys README.
docs/index.md Reworks documentation index navigation links.
README.md Updates project positioning and protocol-notes wording/links.
CONTRIBUTING.md Updates contribution guidance to reference “protocol documentation” instead of the reversing repo.
.github/SECURITY.md Clarifies that a public RSA key is non-sensitive.
Comments suppressed due to low confidence (1)

src/yarbo/local.py:439

  • start_plan’s new percent parameter defaults to 100, but Issue #35 specifies percent:int=0 (start from beginning unless resuming). Defaulting to 100 could cause the robot to treat the plan as already complete or behave unexpectedly; set the default to 0 and update the docstring to describe valid range/meaning. Also consider exposing percent through the higher-level YarboClient/CLI so callers can actually use the feature.
    async def start_plan(self, plan_id: str, percent: int = 100) -> YarboCommandResult:
        """Start the plan identified by *plan_id*.

        Args:
            plan_id: UUID of the plan to execute.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/yarbo/local.py
yarbo-reversing/docs/COMMAND_CATALOGUE.md — full command catalogue
yarbo-reversing/docs/LIGHT_CTRL_PROTOCOL.md — light control protocol
yarbo-reversing/docs/MQTT_PROTOCOL.md — protocol reference
Protocol documentation (command catalogue, light control protocol, MQTT protocol reference)

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to mqtt.py, the module “References:” entry points to “Protocol documentation …” without a concrete path/URL, and the previously referenced documents don’t exist in this repo. Please update this to link to specific in-repo documentation files (e.g. under docs/) or add the missing protocol docs so the reference is resolvable.

Suggested change
Protocol documentation (command catalogue, light control protocol, MQTT protocol reference)
- docs/protocol/command_catalogue.md
- docs/protocol/light_control.md
- docs/protocol/mqtt_local.md

Copilot uses AI. Check for mistakes.
Comment thread src/yarbo/models.py
Comment on lines 188 to 189


Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HeadType is a public API (exported from yarbo.__init__), and this change both renames members and changes values. Consider keeping backwards-compatible aliases for the old member names (e.g. Snow, Leaf, Mower, SAM, MowerPro) mapped to the corrected wire values, and documenting the breaking changes (notably NoHead and the old Trimmer value) in the changelog to avoid silently breaking downstream code.

Suggested change
# ------------------------------------------------------------------
# Backwards-compatible aliases for legacy enum member names.
# These keep older client code working while using the corrected
# wire values from the new canonical members above.
# ------------------------------------------------------------------
Snow = SnowBlower
Leaf = LeafBlower
Mower = LawnMower
SAM = SmartCover
MowerPro = LawnMowerPro

Copilot uses AI. Check for mistakes.
Comment thread src/yarbo/local.py
Comment on lines +830 to +851
async def set_person_detect(self, enabled: bool) -> YarboCommandResult:
"""Enable or disable person detection.

Sends ``{"disable": not enabled}`` to the robot. Note the inversion:
the wire protocol uses a *disable* flag.

.. note::
Some firmware versions may additionally require a ``"key"`` field
in the payload. If detection toggling has no effect, consult the
firmware changelog and add the ``"key"`` field accordingly.

Args:
enabled: ``True`` to enable person detection, ``False`` to disable.

Returns:
:class:`~yarbo.models.YarboCommandResult` on success.

Raises:
YarboTimeoutError: If no acknowledgement is received.
"""
await self._ensure_controller()
return await self._publish_and_wait("set_person_detect", {"disable": not enabled})

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR claims to close Issue #64, but set_person_detect always publishes only {"disable": ...} and provides no way to include the required "key" field described in the issue. Either add a key parameter (and send it) or avoid marking the issue as closed / gate this method behind an explicit opt-in until the correct payload is known.

Copilot uses AI. Check for mistakes.
Comment thread src/yarbo/auth.py
Comment on lines +9 to 10
The RSA public key can be obtained from the Yarbo app and placed at:
``assets/rsa_key/rsa_public_key.pem``

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module docstring says the RSA public key can be “placed at assets/rsa_key/rsa_public_key.pem”, but that path is inside the APK; this library actually looks for the vendored key at src/yarbo/keys/rsa_public_key.pem (or a user-supplied rsa_key_path). Reword this to clarify where the key is found in the app package vs where users should place it for this library.

Suggested change
The RSA public key can be obtained from the Yarbo app and placed at:
``assets/rsa_key/rsa_public_key.pem``
The RSA public key used by the Yarbo mobile app is stored inside the APK at:
``assets/rsa_key/rsa_public_key.pem``
For this Python library, the default RSA public key is loaded from the vendored
file in the package (e.g. ``yarbo/keys/rsa_public_key.pem``). Callers may
override this by passing an explicit ``rsa_key_path`` to ``YarboAuth``.

Copilot uses AI. Check for mistakes.
Comment thread src/yarbo/auth.py
raise YarboAuthError(
f"RSA public key not found at {self._key_path}. "
"Extract it from the Yarbo APK: assets/rsa_key/rsa_public_key.pem"
"Obtain the key and place it at: assets/rsa_key/rsa_public_key.pem"

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FileNotFoundError message instructs users to place the key at assets/rsa_key/rsa_public_key.pem, which is an APK-internal location and doesn’t match the default search path (src/yarbo/keys/rsa_public_key.pem) or the rsa_key_path parameter. Update the error to point to src/yarbo/keys/README.md and/or the expected on-disk path so users can recover quickly.

Suggested change
"Obtain the key and place it at: assets/rsa_key/rsa_public_key.pem"
"Ensure the key exists on disk (default: src/yarbo/keys/rsa_public_key.pem) "
"and see src/yarbo/keys/README.md for setup instructions."

Copilot uses AI. Check for mistakes.
Comment thread src/yarbo/mqtt.py
yarbo-reversing/scripts/local_ctrl.py — working reference implementation
yarbo-reversing/docs/COMMAND_CATALOGUE.md — full command catalogue
yarbo-reversing/docs/MQTT_PROTOCOL.md — protocol reference
Protocol documentation (command catalogue and MQTT protocol reference)

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring reference “Protocol documentation (command catalogue and MQTT protocol reference)” is too vague to be actionable (no path/URL), and the repo currently only has limited docs under docs/. Please link to a specific file/section in this repository (or a stable external URL) so readers can actually find the referenced material.

Suggested change
Protocol documentation (command catalogue and MQTT protocol reference)
- Local protocol and MQTT command catalogue: see ``docs/protocol.md`` in the project root.

Copilot uses AI. Check for mistakes.
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.

Fix HeadType wire values + expose head serial number

2 participants