Skip to content

Add fan direction controls - #2883

Draft
darekxan wants to merge 2 commits into
al-one:masterfrom
darekxan:agent/add-fan-direction-controls
Draft

Add fan direction controls#2883
darekxan wants to merge 2 commits into
al-one:masterfrom
darekxan:agent/add-fan-direction-controls

Conversation

@darekxan

@darekxan darekxan commented Jul 9, 2026

Copy link
Copy Markdown

Summary

  • expose Home Assistant's native fan direction feature when a MIoT fan provides either parameterless turn-left/turn-right actions or a writable motor-control property with LEFT/RIGHT values
  • map reverse/left and forward/right to the corresponding MIoT action or property value
  • stop active oscillation before a manual direction step, matching the Xiaomi Miio integration

Why

The converter-based MIoT fan entity detects power, speed, preset, and oscillation properties, but ignores direction actions and left/right motor-control properties. As a result, supported Xiaomi fans lose the left/right controls available through Home Assistant's Xiaomi Miio integration.

Impact

Compatible fans now expose FanEntityFeature.DIRECTION and work with Home Assistant's fan.set_direction action. Native direction actions take precedence over the motor-control fallback. Fans without either complete capability remain unchanged, and existing standalone button, select, and cover entities remain available.

Validation

  • compiled custom_components/xiaomi_miot with python3 -m compileall
  • exercised action and motor-control detection, left/right mapping, oscillation shutdown, and unsupported-input behavior with a targeted async harness
  • ran ha core check and tested on Home Assistant Core 2026.7.0
  • confirmed both action-based direction calls on xiaomi.fan.p45 returned MIoT code 0
  • confirmed LEFT and RIGHT motor-control writes on dmaker.fan.p33 returned MIoT code 0
  • checked the committed diff with git show --check

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds support for controlling the fan direction in the xiaomi_miot integration. It imports direction constants, initializes left and right turn actions from the MIoT service, and enables the DIRECTION feature if both actions are available. Additionally, it implements the async_set_direction method to handle direction changes, which also stops oscillation if it is currently active. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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.

1 participant