readability optimization

This commit is contained in:
Setsuna
2025-10-18 23:30:26 +08:00
parent 80e646637a
commit b2bf61f85c

View File

@@ -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: