mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-10-15 18:58:29 +00:00
feat: fix device support for T0x13.
This commit is contained in:
@@ -120,7 +120,7 @@ class MideaLightEntity(MideaEntity, LightEntity):
|
|||||||
"""返回支持的色彩模式"""
|
"""返回支持的色彩模式"""
|
||||||
modes = set()
|
modes = set()
|
||||||
if self._brightness_is_range and self._color_temp_is_range:
|
if self._brightness_is_range and self._color_temp_is_range:
|
||||||
modes.add(ColorMode.BRIGHTNESS)
|
# 如果同时支持亮度和色温,优先支持色温模式(更高级的功能)
|
||||||
modes.add(ColorMode.COLOR_TEMP)
|
modes.add(ColorMode.COLOR_TEMP)
|
||||||
elif self._brightness_is_range:
|
elif self._brightness_is_range:
|
||||||
modes.add(ColorMode.BRIGHTNESS)
|
modes.add(ColorMode.BRIGHTNESS)
|
||||||
@@ -134,7 +134,7 @@ class MideaLightEntity(MideaEntity, LightEntity):
|
|||||||
def color_mode(self):
|
def color_mode(self):
|
||||||
"""返回当前色彩模式"""
|
"""返回当前色彩模式"""
|
||||||
if self._brightness_is_range and self._color_temp_is_range:
|
if self._brightness_is_range and self._color_temp_is_range:
|
||||||
# 如果同时支持亮度和色温,优先返回色温模式
|
# 如果同时支持亮度和色温,优先返回色温模式(与supported_color_modes保持一致)
|
||||||
return ColorMode.COLOR_TEMP
|
return ColorMode.COLOR_TEMP
|
||||||
elif self._brightness_is_range:
|
elif self._brightness_is_range:
|
||||||
return ColorMode.BRIGHTNESS
|
return ColorMode.BRIGHTNESS
|
||||||
@@ -227,11 +227,9 @@ class MideaLightEntity(MideaEntity, LightEntity):
|
|||||||
):
|
):
|
||||||
new_status = {}
|
new_status = {}
|
||||||
# 处理预设模式/效果 - 支持 effect 和 preset_mode 参数
|
# 处理预设模式/效果 - 支持 effect 和 preset_mode 参数
|
||||||
selected_effect = effect or preset_mode
|
selected_effect = effect or _key_preset_modes
|
||||||
MideaLogger.debug(f"effect: {effect}, preset_mode: {preset_mode}, selected_effect: {selected_effect}")
|
|
||||||
if selected_effect is not None and self._key_preset_modes is not None:
|
if selected_effect is not None and self._key_preset_modes is not None:
|
||||||
effect_config = self._key_preset_modes.get(selected_effect, {})
|
effect_config = self._key_preset_modes.get(selected_effect, {})
|
||||||
MideaLogger.debug(f"effect_config: {effect_config}")
|
|
||||||
new_status.update(effect_config)
|
new_status.update(effect_config)
|
||||||
|
|
||||||
# 处理亮度设置 - 支持多种参数格式
|
# 处理亮度设置 - 支持多种参数格式
|
||||||
|
Reference in New Issue
Block a user