Skip to content

Fix child-lock write payload: send switch instead of switch_key #11

Closed

Description

@Repsay

Current status (17 October 2026)

Fixed the remaining request-shape defect in PR #43: exactly integer user_device_id and switch, no legacy aliases or target overrides. A live lock transition and restoration both matched fresh readback after two seconds. validate_lock.py now polls GET readback after one write. Physical button behavior on additional models is not claimed.

Delivered: implementation/contracts and dedicated validation tooling. PR #43 consolidates the fixes, 666 passing tests on HA 2026.10.1/2026.3.0, strict mypy/Ruff and the coverage guide. This implementation ticket closes on merge; outstanding external acceptance is explicitly retained in #42, with #21/#22/#41 covering their separate work. Closing this ticket does not certify unperformed physical/app tests.

Historical audit and earlier development notes

The child-lock entity uses the read-state field switch_key as the outbound request key. The decoded app uses switch. The endpoint matches, but the request contract does not. Acceptance of a server-side alias has not been established.

APK evidence

view/tabs/device/device_setting/setting/setting_controller.dart, SettingController::setLitterBoxLock: 0xcd3ebc inserts switch, 0xcd3ee0 inserts user_device_id, and 0xcd3ef8 / 0xcd3f04 select /device/litter_box/set_key and POST it.

Evidence source: NOTTY Smart Pet 1.1.30, SHA-256 3b6dc21037f2802e92233ecd9f685e76b03a79afa2d82dd52a5dfcd689a18e6a, decoded locally with Blutter. These are inspected request-construction paths, not just URL-string matches. Decoded app files and private captures remain outside the public repository.

Integration baseline

switch.py at commit 9b1b7c3.

Acceptance criteria

  • Keep reading state from switch_key, but serialize the APK-backed write field switch.
  • Trace the captured value to establish its exact type and on/off encoding instead of assuming them.
  • Add synthetic request-contract tests for on/off and unchanged physical device targeting.
  • Verify with owner-observed readback before declaring the control production-validated.

Validation boundary

The request-key mismatch is established statically. Server alias acceptance and physical effects have not been established by this APK review.

No hardware actions or cloud-setting changes were performed while creating this issue.

Live validation update (2026-10-17)

PR #40 adds a separate lock/app validation command, private before/after/restoration journals and explicit API readback comparison. An owner-authorized temporary integer switch change was acknowledged by the API, but immediate switch_key readback remained unchanged. Restoring the original setting produced matching baseline readback. This does not confirm the lock changed physically or in the phone app; delayed readback versus ineffective payload/device behavior still needs investigation. Keep this issue open. No empty/motor command was sent.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions