This commit is contained in:
Home Assistant Version Control
2026-09-09 13:41:09 +00:00
parent 06228b4138
commit 3f5a84f2e5
14 changed files with 76 additions and 65 deletions
+36 -25
View File
@@ -505,8 +505,11 @@ class MideaACClimate(MideaClimate):
if self._customize_swing is not None:
return self._customize_swing
caps = getattr(self._device, "capabilities", {})
if "swing_vertical" in caps or "swing_horizontal" in caps:
return bool(caps.get("swing_vertical") or caps.get("swing_horizontal"))
if not isinstance(caps, dict):
return True
swing_modes = caps.get("swing_modes")
if isinstance(swing_modes, list):
return bool("vertical" in swing_modes or "horizontal" in swing_modes)
return True
@property
@@ -519,20 +522,23 @@ class MideaACClimate(MideaClimate):
if self._customize_hvac_modes is not None:
return self._customize_hvac_modes
caps = getattr(self._device, "capabilities", {})
if not caps:
if not isinstance(caps, dict) or not caps:
return list(self._mode_index)
modes = [HVACMode.OFF]
if caps.get("auto_mode"):
modes.append(HVACMode.AUTO)
if caps.get("cool_mode"):
modes.append(HVACMode.COOL)
if caps.get("dry_mode"):
modes.append(HVACMode.DRY)
if caps.get("heat_mode"):
modes.append(HVACMode.HEAT)
modes_list = caps.get("modes")
if not isinstance(modes_list, list):
return list(self._mode_index)
hvac_modes = [HVACMode.OFF]
if "auto" in modes_list:
hvac_modes.append(HVACMode.AUTO)
if "cool" in modes_list:
hvac_modes.append(HVACMode.COOL)
if "dry" in modes_list:
hvac_modes.append(HVACMode.DRY)
if "heat" in modes_list:
hvac_modes.append(HVACMode.HEAT)
# fan-only is always available on AC devices
modes.append(HVACMode.FAN_ONLY)
return modes
hvac_modes.append(HVACMode.FAN_ONLY)
return hvac_modes
@property
def preset_modes(self) -> list[str]:
@@ -553,15 +559,17 @@ class MideaACClimate(MideaClimate):
if self._customize_preset_modes is not None:
return self._customize_preset_modes
caps = getattr(self._device, "capabilities", {})
if not caps:
if not isinstance(caps, dict) or not caps:
return all_presets
modes_list = caps.get("modes")
has_heat = isinstance(modes_list, list) and "heat" in modes_list
keep = {
PRESET_NONE: True,
PRESET_COMFORT: True,
PRESET_ECO: bool(caps.get("eco")),
PRESET_BOOST: bool(caps.get("turbo_cool") or caps.get("turbo_heat")),
PRESET_SLEEP: True,
PRESET_AWAY: bool(caps.get("heat_mode")),
PRESET_AWAY: has_heat,
}
return [preset for preset in all_presets if keep[preset]]
@@ -658,21 +666,24 @@ class MideaACClimate(MideaClimate):
if self._customize_fan_modes is not None:
return self._customize_fan_modes
caps = getattr(self._device, "capabilities", {})
if not caps:
if not isinstance(caps, dict) or not caps:
return list(self._fan_speeds.keys())
fan_speeds_list = caps.get("fan_speeds")
if not isinstance(fan_speeds_list, list):
return list(self._fan_speeds.keys())
# stepless/inverter fan: expose every discrete speed, not just "full"
if caps.get("fan_custom"):
if "custom" in fan_speeds_list:
return list(self._fan_speeds.keys())
cap_by_fan = {
FAN_SILENT: "fan_silent",
FAN_LOW: "fan_low",
FAN_MEDIUM: "fan_medium",
FAN_HIGH: "fan_high",
FAN_FULL_SPEED: "fan_custom",
FAN_AUTO: "fan_auto",
FAN_SILENT: "silent",
FAN_LOW: "low",
FAN_MEDIUM: "medium",
FAN_HIGH: "high",
FAN_FULL_SPEED: "custom",
FAN_AUTO: "auto",
}
modes = [
name for name in self._fan_speeds if caps.get(cap_by_fan.get(name, ""))
name for name in self._fan_speeds if cap_by_fan.get(name) in fan_speeds_list
]
return modes or list(self._fan_speeds.keys())
+2 -2
View File
@@ -15,7 +15,7 @@
"midealan"
],
"requirements": [
"midea-lan==2026.9.0"
"midea-lan==2026.9.1"
],
"version": "2026.9.0"
"version": "2026.9.1"
}
@@ -22,7 +22,7 @@
"account": "Konto",
"password": "Passwort"
},
"description": "Mit dem Midea-Konto anmelden. Das Konto wird nur verwendet, um die Geräteinformationen zu erhalten.\nDie Konfiguration kann wieder entfernt werden, nachdem alle Geräte konfiguriert wurden.",
"description": "Melden Sie sich an und rufen Sie das Geräte-Token ab.\n\n\nDerzeit können nur persönliche SmartHome- und Meiju-Konten Geräte-Tokens abrufen. Details finden Sie in der README-Dokumentation.",
"title": "Login"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "Account",
"password": "Password"
},
"description": "Login and storage your Midea account only for getting the appliance info.\nYou can remove this configuration after all appliance configured.",
"description": "Login and get the appliance token.\n\n\nCurrently, only personal SmartHome and Meiju accounts can retrieve appliance Tokens. See README doc for details.",
"title": "Login"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "Cuenta",
"password": "Contraseña"
},
"description": "Inicie sesión y guarde su cuenta Midea solo para obtener la información del electrodoméstico.\nPuede eliminar esta configuración después de haber configurado todos los dispositivos.",
"description": "Inicie sesión y obtenga el token del electrodoméstico.\n\n\nActualmente, solo las cuentas personales de SmartHome y Meiju pueden recuperar los Tokens de electrodomésticos. Consulte la documentación README para obtener más detalles.",
"title": "Iniciar sesión"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "Account",
"password": "Password"
},
"description": "Login and storage your Midea account only for getting the appliance info.\nYou can remove this configuration after all appliance configured.",
"description": "Connectez-vous et récupérez le token de l'appareil.\n\n\nActuellement, seuls les comptes personnels SmartHome et Meiju peuvent récupérer les Tokens des appareils. Consultez la documentation README pour plus de détails.",
"title": "Login"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "Fiók",
"password": "Jelszó"
},
"description": "Jelentkezzen be és tárolja el Midea-fiókját, kizárólag a készülékei információinak a megszerzéséhez.\nAz összes készülékének beállítása után eltávolíthatja ezt a konfigurációt.",
"description": "Jelentkezzen be, és kérje le a készülék tokenjét.\n\n\nJelenleg csak személyes SmartHome- és Meiju-fiókokkal lehet lekérni a készülékek Tokenjeit. Részletekért lásd a README dokumentációt.",
"title": "Bejelentkezés"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "Account",
"password": "Password"
},
"description": "Accedi e salva il tuo account Midea solo per ottenere le informazioni sugli elettrodomestici.\nPuoi rimuovere questa configurazione dopo aver completato la configurazione di tutti gli elettrodomestici.",
"description": "Accedi e ottieni il token dell'elettrodomestico.\n\n\nAttualmente, solo gli account personali SmartHome e Meiju possono recuperare i Token degli elettrodomestici. Per i dettagli, consulta la documentazione README.",
"title": "Accesso"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "Аккаунт",
"password": "Пароль"
},
"description": "Login and storage your Midea account only for getting the appliance info.\nYou can remove this configuration after all appliance configured.",
"description": "Войдите в аккаунт и получите токен устройства.\n\n\nВ настоящее время токены устройств могут получать только личные аккаунты SmartHome и Meiju. Подробности см. в документации README.",
"title": "Login"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "Account",
"password": "Password"
},
"description": "Login and storage your Midea account only for getting the appliance info.\nYou can remove this configuration after all appliance configured.",
"description": "Prihláste sa a získajte token zariadenia.\n\n\nAktuálne môžu Tokeny zariadení získať iba osobné účty SmartHome a Meiju. Podrobnosti nájdete v dokumentácii README.",
"title": "Login"
},
"discovery": {
@@ -22,7 +22,7 @@
"account": "账号",
"password": "密码"
},
"description": "登录并保存你的美的账户,仅用于获取添加设备时设备信息\n添加设备完成后,你可以删除该配置",
"description": "登录并获取设备 Token。\n\n\n目前仅个人 SmartHome 和 Meiju 账号可获取设备 Token。详情请参考 README 文档。",
"title": "登录"
},
"discovery": {