mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-11-12 07:51:54 +00:00
readability optimization
This commit is contained in:
@@ -97,7 +97,7 @@ async def load_device_config(hass: HomeAssistant, device_type, sn8):
|
||||
# # 如果像映射体(包含 entities/centralized 等关键字段),直接使用
|
||||
# if any(k in raw for k in ["entities", "centralized", "queries", "manufacturer"]):
|
||||
# json_data = raw
|
||||
if not json_data:
|
||||
# if not json_data:
|
||||
device_path = f".device_mapping.{'T0x%02X' % device_type}"
|
||||
try:
|
||||
mapping_module = import_module(device_path, __package__)
|
||||
@@ -106,7 +106,7 @@ async def load_device_config(hass: HomeAssistant, device_type, sn8):
|
||||
if (key == sn8) or (isinstance(key, tuple) and sn8 in key) or (isinstance(key, str) and re.match(key, sn8)):
|
||||
json_data = config
|
||||
break
|
||||
else:
|
||||
if not json_data:
|
||||
if "default" in mapping_module.DEVICE_MAPPING:
|
||||
json_data = mapping_module.DEVICE_MAPPING["default"]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user