Skip to content

Fix #1309 #1124#1317

Open
ohyeah521 wants to merge 3 commits intoXiaoMi:mainfrom
ohyeah521:main
Open

Fix #1309 #1124#1317
ohyeah521 wants to merge 3 commits intoXiaoMi:mainfrom
ohyeah521:main

Conversation

@ohyeah521
Copy link

HomeKit Bridge: fan_modes must be "auto"、"low"、"medium"、"high"

# HomeKit Bridge: fan_modes must be "auto"、"low"、"medium"、"high"
@CLAassistant
Copy link

CLAassistant commented Jul 28, 2025

CLA assistant check
All committers have signed the CLA.

@SusanPhevos
Copy link
Contributor

SusanPhevos commented Aug 1, 2025

The PR is rejected for the following reasons:

  1. Home Assistant climate entity is allowed to use custom fan modes that is not restricted to be auto, low, medium or high. The fact that HomeKit can not show a mode name which is not auto, low, medium or high is not the fault of xiaomi_home. Home Bridge or HomeKit should be responsible for it.
  2. The PR breaks the the code’s structure, and the feature you added only benefits users who have selected Chinese in xiaomi_home and are using the Chinese version of HomeKit. It lacks universality.
  3. A compromised solution is to modify the fan modes' Chinese langurage settings in multi_lang.json.
    Example of qdhkl.aircondition.ac, adding the following json object to multi_lang.json changes the simplified Chinese descriptions of the fan mode values to be auto, low, medium and high.
"urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-ac": {
    "zh-Hans": {
      "service:003:property:002:valuelist:000": "Low",
      "service:003:property:002:valuelist:001": "Medium",
      "service:003:property:002:valuelist:002": "High",
      "service:003:property:002:valuelist:003": "Auto"
    }
}

This is the change with the smallest possible impact scope and also it will not be merged into the main branch.

@allenli-pixel
Copy link

The PR is rejected for the following reasons:

  1. Home Assistant climate entity is allowed to use custom fan modes that is not restricted to be auto, low, medium or high. The fact that HomeKit can not show a mode name which is not auto, low, medium or high is not the fault of xiaomi_home. Home Bridge or HomeKit should be responsible for it.
  2. The PR breaks the the code’s structure, and the feature you added only benefits users who have selected Chinese in xiaomi_home and are using the Chinese version of HomeKit. It lacks universality.
  3. A compromised solution is to modify the fan modes' Chinese langurage settings in multi_lang.json.
    Example of qdhkl.aircondition.ac, adding the following json object to multi_lang.json changes the simplified Chinese descriptions of the fan mode values to be auto, low, medium and high.
"urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-ac": {
    "zh-Hans": {
      "service:003:property:002:valuelist:000": "Low",
      "service:003:property:002:valuelist:001": "Medium",
      "service:003:property:002:valuelist:002": "High",
      "service:003:property:002:valuelist:003": "Auto"
    }
}

This is the change with the smallest possible impact scope and also it will not be merged into the main branch.

I followed your suggestion to add zh-Hans → English mapping in custom_components/xiaomi_home/miot/specs/multi_lang.json for my air-conditioner (Low / Medium / High / Auto).
After restarting Home Assistant, fan_modes still showed Chinese (低风, 中风, 高风, 自动).

Findings:
• multi_lang.json is correctly loaded (miot_spec.py confirms path).
• Clearing .storage cache and restarting did not help.
• In climate.py, fan_modes are taken directly from:
self._attr_fan_modes = prop.value_list.descriptions which bypasses multi_lang.json.

Solution Tested:
Replacing that line with:
mapping = {"低风": "Low", "中风": "Medium", "高风": "High", "自动": "Auto"} self._attr_fan_modes = [mapping.get(v, v) for v in prop.value_list.descriptions]
Immediately fixed the display after restart.

Conclusion:
multi_lang.json is not applied to climate fan_modes because the code never references it. Suggest updating climate.py to use multi_lang mapping for fan_modes.

@allenli-pixel
Copy link

补充一下,修改对应关系只能使风速出现,但无法调节。

@ohyeah521
Copy link
Author

补充一下,修改对应关系只能使风速出现,但无法调节。

我提交的补丁是可以调节的

@SusanPhevos
Copy link
Contributor

The PR is rejected for the following reasons:

  1. Home Assistant climate entity is allowed to use custom fan modes that is not restricted to be auto, low, medium or high. The fact that HomeKit can not show a mode name which is not auto, low, medium or high is not the fault of xiaomi_home. Home Bridge or HomeKit should be responsible for it.
  2. The PR breaks the the code’s structure, and the feature you added only benefits users who have selected Chinese in xiaomi_home and are using the Chinese version of HomeKit. It lacks universality.
  3. A compromised solution is to modify the fan modes' Chinese langurage settings in multi_lang.json.
    Example of qdhkl.aircondition.ac, adding the following json object to multi_lang.json changes the simplified Chinese descriptions of the fan mode values to be auto, low, medium and high.
"urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-ac": {
    "zh-Hans": {
      "service:003:property:002:valuelist:000": "Low",
      "service:003:property:002:valuelist:001": "Medium",
      "service:003:property:002:valuelist:002": "High",
      "service:003:property:002:valuelist:003": "Auto"
    }
}

This is the change with the smallest possible impact scope and also it will not be merged into the main branch.

I followed your suggestion to add zh-Hans → English mapping in custom_components/xiaomi_home/miot/specs/multi_lang.json for my air-conditioner (Low / Medium / High / Auto). After restarting Home Assistant, fan_modes still showed Chinese (低风, 中风, 高风, 自动).

Findings: • multi_lang.json is correctly loaded (miot_spec.py confirms path). • Clearing .storage cache and restarting did not help. • In climate.py, fan_modes are taken directly from: self._attr_fan_modes = prop.value_list.descriptions which bypasses multi_lang.json.

Solution Tested: Replacing that line with: mapping = {"低风": "Low", "中风": "Medium", "高风": "High", "自动": "Auto"} self._attr_fan_modes = [mapping.get(v, v) for v in prop.value_list.descriptions] Immediately fixed the display after restart.

Conclusion: multi_lang.json is not applied to climate fan_modes because the code never references it. Suggest updating climate.py to use multi_lang mapping for fan_modes.

Have you checked the option xiaomi_home > CONFIGURE > Update entity conversion rules?
修改 multi_lang.json 之后需要勾选 xiaomi_home > 配置 > 更新实体转换规则

@donh20
Copy link

donh20 commented Sep 10, 2025

请问这个补丁什么时候可以合并进主分支?

@SusanPhevos
Copy link
Contributor

qdhkl

The value list element's description is translated by local multi_lang.json, cloud multi_langurage urn or std_lib.
https://github.com/XiaoMi/ha_xiaomi_home/blob/main/custom_components/xiaomi_home/miot/miot_spec.py#L1507
I do not have qdhkl.aircondition.ac or qdhkl.gateway.lonink. I tested it with lemesh.airc.air02. The original fan mode shows as:
Screenshot from 2025-12-09 09-17-26
After adding the following codes in multi_lang.json, the fan modes are translated to Auto, Low, Medium and High.

  "urn:miot-spec-v2:device:air-conditioner:0000A004:lemesh-air02": {
    "zh-Hans": {
      "service:003:property:001:valuelist:000": "Auto",
      "service:003:property:001:valuelist:001": "Low",
      "service:003:property:001:valuelist:002": "Medium",
      "service:003:property:001:valuelist:003": "High"
    }
  }
Screenshot from 2025-12-09 09-18-39

@wz69699
Copy link

wz69699 commented Jan 21, 2026

The PR is rejected for the following reasons:

  1. Home Assistant climate entity is allowed to use custom fan modes that is not restricted to be auto, low, medium or high. The fact that HomeKit can not show a mode name which is not auto, low, medium or high is not the fault of xiaomi_home. Home Bridge or HomeKit should be responsible for it.
  2. The PR breaks the the code’s structure, and the feature you added only benefits users who have selected Chinese in xiaomi_home and are using the Chinese version of HomeKit. It lacks universality.
  3. A compromised solution is to modify the fan modes' Chinese langurage settings in multi_lang.json.
    Example of qdhkl.aircondition.ac, adding the following json object to multi_lang.json changes the simplified Chinese descriptions of the fan mode values to be auto, low, medium and high.
"urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-ac": {
    "zh-Hans": {
      "service:003:property:002:valuelist:000": "Low",
      "service:003:property:002:valuelist:001": "Medium",
      "service:003:property:002:valuelist:002": "High",
      "service:003:property:002:valuelist:003": "Auto"
    }
}

This is the change with the smallest possible impact scope and also it will not be merged into the main branch.

I followed your suggestion to add zh-Hans → English mapping in custom_components/xiaomi_home/miot/specs/multi_lang.json for my air-conditioner (Low / Medium / High / Auto). After restarting Home Assistant, fan_modes still showed Chinese (低风, 中风, 高风, 自动).
Findings: • multi_lang.json is correctly loaded (miot_spec.py confirms path). • Clearing .storage cache and restarting did not help. • In climate.py, fan_modes are taken directly from: self._attr_fan_modes = prop.value_list.descriptions which bypasses multi_lang.json.
Solution Tested: Replacing that line with: mapping = {"低风": "Low", "中风": "Medium", "高风": "High", "自动": "Auto"} self._attr_fan_modes = [mapping.get(v, v) for v in prop.value_list.descriptions] Immediately fixed the display after restart.
Conclusion: multi_lang.json is not applied to climate fan_modes because the code never references it. Suggest updating climate.py to use multi_lang mapping for fan_modes.

Have you checked the option xiaomi_home > CONFIGURE > Update entity conversion rules? 修改 multi_lang.json 之后需要勾选 xiaomi_home > 配置 > 更新实体转换规则

我的VRF型号是qdhkl.airc.b19m,按您的方法在multi_lang.json中增加了以下内容,成功把风速修改成英文了,homekit中也有了风量调节滑块,从0-100共有四档可以调节。
"urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-b19m": {
"zh-Hans": {
"service:003:property:001:valuelist:000": "Auto",
"service:003:property:001:valuelist:001": "Low",
"service:003:property:001:valuelist:002": "Medium",
"service:003:property:001:valuelist:003": "High"
}
}
然后我测试了一下调节风速:
①墙上的温控面板、ha、米家之间可以完美同步;
②调节homekit,空调风速不会发生变化:无法同步至温控面板、ha、米家;
③调节温控面板或ha或米家:homekit只能同步低中高(无法同步自动);

另外还有一个问题:homekit里正常的空调卡片,点击左侧或者左上角是打开/关闭空调,点击右侧是打开空调详情界面。但是现在点击左侧或者左上角也是打开空调详情界面,不能快捷的打开/关闭空调。

谢谢!

@wz69699
Copy link

wz69699 commented Jan 21, 2026

The PR is rejected for the following reasons:

  1. Home Assistant climate entity is allowed to use custom fan modes that is not restricted to be auto, low, medium or high. The fact that HomeKit can not show a mode name which is not auto, low, medium or high is not the fault of xiaomi_home. Home Bridge or HomeKit should be responsible for it.
  2. The PR breaks the the code’s structure, and the feature you added only benefits users who have selected Chinese in xiaomi_home and are using the Chinese version of HomeKit. It lacks universality.
  3. A compromised solution is to modify the fan modes' Chinese langurage settings in multi_lang.json.
    Example of qdhkl.aircondition.ac, adding the following json object to multi_lang.json changes the simplified Chinese descriptions of the fan mode values to be auto, low, medium and high.
"urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-ac": {
    "zh-Hans": {
      "service:003:property:002:valuelist:000": "Low",
      "service:003:property:002:valuelist:001": "Medium",
      "service:003:property:002:valuelist:002": "High",
      "service:003:property:002:valuelist:003": "Auto"
    }
}

This is the change with the smallest possible impact scope and also it will not be merged into the main branch.

I followed your suggestion to add zh-Hans → English mapping in custom_components/xiaomi_home/miot/specs/multi_lang.json for my air-conditioner (Low / Medium / High / Auto). After restarting Home Assistant, fan_modes still showed Chinese (低风, 中风, 高风, 自动).
Findings: • multi_lang.json is correctly loaded (miot_spec.py confirms path). • Clearing .storage cache and restarting did not help. • In climate.py, fan_modes are taken directly from: self._attr_fan_modes = prop.value_list.descriptions which bypasses multi_lang.json.
Solution Tested: Replacing that line with: mapping = {"低风": "Low", "中风": "Medium", "高风": "High", "自动": "Auto"} self._attr_fan_modes = [mapping.get(v, v) for v in prop.value_list.descriptions] Immediately fixed the display after restart.
Conclusion: multi_lang.json is not applied to climate fan_modes because the code never references it. Suggest updating climate.py to use multi_lang mapping for fan_modes.

Have you checked the option xiaomi_home > CONFIGURE > Update entity conversion rules? 修改 multi_lang.json 之后需要勾选 xiaomi_home > 配置 > 更新实体转换规则

我的VRF型号是qdhkl.airc.b19m,按您的方法在multi_lang.json中增加了以下内容,成功把风速修改成英文了,homekit中也有了风量调节滑块,从0-100共有四档可以调节。 "urn:miot-spec-v2:device:air-conditioner:0000A004:qdhkl-b19m": { "zh-Hans": { "service:003:property:001:valuelist:000": "Auto", "service:003:property:001:valuelist:001": "Low", "service:003:property:001:valuelist:002": "Medium", "service:003:property:001:valuelist:003": "High" } } 然后我测试了一下调节风速: ①墙上的温控面板、ha、米家之间可以完美同步; ②调节homekit,空调风速不会发生变化:无法同步至温控面板、ha、米家; ③调节温控面板或ha或米家:homekit只能同步低中高(无法同步自动);

另外还有一个问题:homekit里正常的空调卡片,点击左侧或者左上角是打开/关闭空调,点击右侧是打开空调详情界面。但是现在点击左侧或者左上角也是打开空调详情界面,不能快捷的打开/关闭空调。

谢谢!

对了,还要补充下:在homekit里开关、制热制冷、调节温度,是可以正常同步至温控面板、ha和米家的。

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.

6 participants