Add select platform for the oscillation angle (fixes #293) - #345
Open
juanpebalsa wants to merge 2 commits into
Open
Add select platform for the oscillation angle (fixes #293)#345juanpebalsa wants to merge 2 commits into
juanpebalsa wants to merge 2 commits into
Conversation
Adds a `select` entity exposing the horizontal oscillation angle
(30/60/90/120/140) for the dmaker MIOT fans (P5/P9/P10/P11/P15/P18/P30).
The oscillation angle is not a native attribute of Home Assistant `fan`
entities, so until now it could only be changed through the
`xiaomi_miio_fan.fan_set_oscillation_angle` service. After HA's fan card
redesign removed the old angle buttons, there was no UI control left for
it. This select restores a first-class UI control (a dropdown) that reads
the current angle from the device and calls `set_angle`.
Config mirrors the `fan` platform (host, token, optional model):
select:
- platform: xiaomi_miio_fan
name: Ventilador Dormitorio - Angulo Oscilacion
host: 192.168.1.50
token: !secret fan_token
model: dmaker.fan.p18
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <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.
Summary
Fixes #293.
Adds a
selectplatform to the integration that exposes the fan's horizontal oscillation angle (30/60/90/120/140) as a dropdown entity, so it can be set from the UI again.Why
The oscillation angle is not a native attribute of Home Assistant
fanentities. Until now it could only be changed via thexiaomi_miio_fan.fan_set_oscillation_angleservice. After the fan more-info card redesign in Home Assistant, the old angle buttons disappeared, leaving no UI control for the angle (see #293). This restores a first-class control.What
select.pywithasync_setup_platformmirroring thefanplatform config (host,token, optionalmodel).XiaomiFanAngleSelect(SelectEntity): options are the angles supported by the model,current_optionis read from the device (status().angle), andselect_optioncallsset_angle.fan.py(e.g. P18/P30 → P10, P15 → P11), and per-model angle lists (P5 = 30/60/90/120; P9/P10/P11/P15/P18/P30 = 30/60/90/120/140).Config example
Testing
Tested on a real dmaker.fan.p18 (Mi Smart Standing Fan 2 P18):
['30','60','90','120','140']and correctly read the current angle.🤖 Generated with Claude Code