# HomeKit fan speed exposed with incorrect percentage mapping ## Bug Description I am using a Midea PortaSplit AC integrated via `midea-ac-py` in Home Assistant. The device works correctly inside Home Assistant, but when exposed to Apple HomeKit through the Home Assistant HomeKit Bridge integration, the fan speed values appear to be mapped inconsistently between Home Assistant and HomeKit. ## What happens ### Example 1 * In Home Assistant: * `number.klimi_luftergeschwindigkeit` reports `1%` * In HomeKit: * the exposed climate entity `climate.klimi` shows `100%` ### Example 2 * Setting the fan speed to `33%` in HomeKit changes the value in Home Assistant to `40%` ### Example 3 The device exposes the following supported fan speeds: ```json id="8h3mbk" "supported_fan_speeds": [ 20, 40, 60, 80, 102, 100 ] ``` However, Home Assistant can still report values such as `1%`. ## Additional Observations The device has an outdoor silent/whisper mode (`OUT_SILENT` capability). When this mode is enabled: * Home Assistant reports the indoor fan speed as `1%` * The fan mode in the UI is shown as `Custom` * Discrete fan modes start at: * `20%` = Silent * `40%` = Low ## Expected Behavior Fan speed percentages should remain synchronized between Home Assistant and HomeKit. Examples: * `1%` in HA should not appear as `100%` in HomeKit * Setting `33%` in HomeKit should either: * remain at `33%`, or * update consistently to the internally applied value ## Actual Behavior * Very low values may appear as `100%` in HomeKit * Arbitrary percentages set in HomeKit are converted to different values in Home Assistant (e.g. `33%` → `40%`) * HomeKit and Home Assistant may show different fan speed percentages for the same state ## Environment * Home Assistant version: `2026.5.4` * midea-ac-py version: `2026.4.0` * HomeKit Bridge integration: built-in HA integration * Device: Midea PortaSplit ## Additional Information * The fan speed entity in HA is: * `number.klimi_luftergeschwindigkeit` * The HomeKit exposed entity is: * `climate.klimi` Any help or clarification regarding the expected fan speed behavior and HomeKit synchronization would be appreciated. ## Logs <details> <summary>Logs</summary> ```text id="efv1b8" { "home_assistant": { "arch": "x86_64", "dev": false, "docker": true, "hassio": true, "installation_type": "Home Assistant OS", "os_name": "Linux", "os_version": "6.12.77-haos", "python_version": "3.14.2", "timezone": "Europe/Berlin", "version": "2026.5.4", "virtualenv": false, "container_arch": "amd64", "supervisor": "2026.05.1", "host_os": "Home Assistant OS 17.2", "docker_version": "29.3.1", "chassis": "vm", "run_as_root": true }, "custom_components": { "spook": { "documentation": "https://spook.boo", "version": "4.0.1", "requirements": [] }, "midea_ac": { "documentation": "https://github.com/mill1000/midea-ac-py", "version": "2026.4.0", "requirements": [ "msmart-ng==2026.4.1", "pyyaml" ] } }, "integration_manifest": { "domain": "midea_ac", "name": "Midea Smart AC", "codeowners": [ "mill1000" ], "config_flow": true, "dependencies": [], "documentation": "https://github.com/mill1000/midea-ac-py", "iot_class": "local_polling", "issue_tracker": "https://github.com/mill1000/midea-ac-py/issues", "loggers": [ "msmart" ], "requirements": [ "msmart-ng==2026.4.1", "pyyaml" ], "version": "2026.4.0", "is_built_in": false, "overwrites_built_in": false }, "setup_times": { "null": { "setup": 2.8315997042227536e-05 }, "01KSCVNNTHGNPB7628GKA9PAVY": { "wait_import_platforms": -3.8634080340052606, "config_entry_setup": 6.062900239994633 } }, "data": { "config_entry": { "created_at": "2026-05-24T11:24:37.585622+00:00", "data": { "device_type": 172, "host": "192.168.178.67", "id": 152832117718098, "k1": "**REDACTED**", "port": 6444, "token": "**REDACTED**" }, "discovery_keys": {}, "disabled_by": null, "domain": "midea_ac", "entry_id": "01KSCVNNTHGNPB7628GKA9PAVY", "minor_version": 6, "modified_at": "2026-05-26T13:02:53.011282+00:00", "options": { "energy_sensor": { "energy_data_format": "binary", "energy_data_scale": 1.0 }, "fan_speed_step": 1.0, "merge_capability_overrides": true, "power_sensor": { "energy_data_format": "binary", "energy_data_scale": 1.0 }, "prompt_tone": true, "swing_angle_rtl": false, "temp_step": 1.0, "workarounds": { "use_fan_only_workaround": false } }, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "user", "subentries": [], "title": "midea_ac 152832117718098", "unique_id": "152832117718098", "version": 1 }, "device": { "ip": "192.168.178.67", "port": 6444, "id": 152832117718098, "online": true, "supported": true, "type": 172, "name": null, "sn": null, "key": "**REDACTED**", "token": "**REDACTED**", "min_target_temperature": 16.0, "max_target_temperature": 30.0, "supported_modes": [ 5, 3, 2, 4, 1 ], "supported_swing_modes": [ 0, 12 ], "supported_fan_speeds": [ 20, 40, 60, 80, 102, 100 ], "supported_aux_modes": [ 0 ], "supported_rate_selects": [ 100, 75, 50 ], "additional_capabilities": [ { "__type": "<flag 'Capability'>", "repr": "<Capability.CUSTOM_FAN_SPEED: 1>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.ECO: 2>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.FREEZE_PROTECTION: 4>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.IECO: 8>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.TURBO: 16>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.DISPLAY_CONTROL: 32>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.FILTER_REMINDER: 128>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.OUT_SILENT: 131072>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.PURIFIER: 262144>" }, { "__type": "<flag 'Capability'>", "repr": "<Capability.SELF_CLEAN: 524288>" } ], "enable_energy_usage_requests": true, "_supported_properties": [ 72, 57, 227, 205 ] } }, "issues": [] } ``` </details>