Skip to content

feat: Add Smart Mix (unoccupied behavior) support for Haiku H/I fans#190

Open
jhesketh wants to merge 2 commits intojfroy:mainfrom
jhesketh:feature/smart-mix-control
Open

feat: Add Smart Mix (unoccupied behavior) support for Haiku H/I fans#190
jhesketh wants to merge 2 commits intojfroy:mainfrom
jhesketh:feature/smart-mix-control

Conversation

@jhesketh
Copy link
Contributor

  • Add support for Smart Mix unoccupied behavior observed on Haiku H/I Series devices.
  • Model smart_mix as a protobuf sub-message at Properties field 42 with:
    • smart_mix_enable (on/off behavior)
    • speed (1-7)
  • Expose new library properties on Device:
    • has_smart_mix
    • smart_mix_enable (read/write)
    • smart_mix_speed (read/write)

Behavior

  • When motion sense is enabled:
    • smart_mix_enable absent/false => Turn Off
    • smart_mix_enable true + speed => Smart Mix
  • Writes preserve existing Smart Mix sub-fields to avoid clearing sibling values during partial updates.

Fixes Included

  • Fix nested protobuf merge behavior so incoming sub-messages replace stale state correctly.
    • Before this, omitted nested fields could remain incorrectly set after MergeFrom.
    • Example: smart_mix_enable could remain true after firmware omitted it to indicate Turn Off.
  • Update smart_mix_speed write handling:
    • Do not force-enable Smart Mix in the speed setter.
    • Perform a follow-up query after speed writes so local state reflects confirmed values.

Device Scope

  • Implemented from reverse-engineering/testing against Haiku H/I Series firmware behavior.
  • Intended for devices that report Smart Mix/unoccupied behavior via Properties.smart_mix (field 42).

Notes

  • This PR intentionally excludes TUI/tooling changes and is library/protocol focused.
  • Disclaimer: developed with Claude + Codex assistance and validated via limited reverse-engineering hardware coverage; please review and validate on target devices.

Add SmartMixProperties at Properties field 42, matching behavior observed on Haiku H/I Series devices when motion sense is enabled and unoccupied behavior is changed in the BAF app. The schema models smart_mix_enable and speed (1-7), where absent/false represents Turn Off and true+speed represents Smart Mix.

Expose has_smart_mix, smart_mix_enable, and smart_mix_speed on Device with read/write support. Writes preserve existing sub-message fields via copy-before-commit semantics so updates to one Smart Mix value do not unintentionally clear the other.

Disclaimer: This commit was developed with assistance from Claude and Codex and is based on reverse-engineering/experimentation on limited hardware. Please review carefully and validate behavior on your own target devices before relying on it.
…eed writes

Fix query merge semantics for nested protobuf messages by clearing incoming sub-message fields before MergeFrom. Without this, omitted inner fields could remain stuck from previous state (for example, smart_mix_enable staying true when firmware omits it to indicate Turn Off).

Also update smart_mix_speed writes to avoid forcing smart_mix_enable and issue a follow-up query after commit. This handles a firmware/client quirk where speed writes are accepted but not always pushed immediately to connected clients, ensuring local Device state reflects confirmed values.

Disclaimer: This commit was developed with assistance from Claude and Codex and is based on reverse-engineering/experimentation on limited hardware. Please review carefully and validate behavior on your own target devices before relying on it.
@jfroy jfroy force-pushed the feature/smart-mix-control branch from ac2c287 to 62b872e Compare February 24, 2026 04:24
Copy link
Owner

@jfroy jfroy left a comment

Choose a reason for hiding this comment

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

Separate the subfield merge fix/change in a PR and add unit tests for it. I don't see obvious issues with the code, but I'd like an independent commit to look at if a bug report comes in later.

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.

2 participants