Add fan direction controls - #2883
Conversation
There was a problem hiding this comment.
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.
Summary
turn-left/turn-rightactions or a writablemotor-controlproperty with LEFT/RIGHT valuesreverse/leftandforward/rightto the corresponding MIoT action or property valueWhy
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.DIRECTIONand work with Home Assistant'sfan.set_directionaction. 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
custom_components/xiaomi_miotwithpython3 -m compileallha core checkand tested on Home Assistant Core 2026.7.0xiaomi.fan.p45returned MIoT code0dmaker.fan.p33returned MIoT code0git show --check