Repository navigation
Fix the app agreement route, fan power from set_clean_motor_mode, and device rename - #260
Merged
Merged
Conversation
The route that answers is /api/v4/app/agreement/latest, but the public path list named /api/v4/agreement/latest, so the route that answers needed a token. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The handler only read an int or a list of ints, so the app's [{fan_power, water_box_mode, ...}] body left the stored fan power stale.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Store local overrides under device_overrides in the web inventory, mirror them onto inventory device records, apply them to device detail and home data (over the cloud snapshot), and keep them across cloud inventory imports. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three small fixes found while using the official app against the local server. Each is its own commit.
Let the app agreement route be read before login
The route that answers is
/api/v4/app/agreement/latest, but the list of public paths named/api/v4/agreement/latest, so the route that answers needed a token. The real path is now in the list (the old onestays).
Record fan power from the dict
set_clean_motor_modesendsThe fan power handler only read an int or a list of ints. The app's
set_clean_motor_modesends[{"fan_power": 102, "water_box_mode": 202, ...}], so the stored fan power went stale. The handler now readsfan_powerfrom a dict, alone or as the first item of a list, and ignores non-int values.Persist device name and
silentOtaSwitchfromPUT /user/devices/<duid>Renaming a robot in the app, or toggling silent OTA, was never stored, so the app showed the old values again. The
server now handles the
PUT: for a known device it stores the change underdevice_overridesin the web inventoryand answers with the updated device detail. The override is applied to the device detail and home data (over the
cloud snapshot), mirrored onto the inventory's device records, and kept across cloud inventory imports. Names are
trimmed and limited to 64 characters,
silentOtaSwitchmust betrueorfalse, and anything else (including otherfields) is ignored.
Testing
New tests in
tests/test_device_put.py(name and switch stored and shown in the detail and home data, bad values andother fields ignored, unknown device stores nothing, override kept across a reload and a cloud import) and
tests/test_fan_power_handler.py, and a case intests/test_protocol_auth.pyfor the agreement pathwith and without a trailing slash. Full suite: 468 passed.