diff --git a/custom_components/xiaomi_home/miot/miot_device.py b/custom_components/xiaomi_home/miot/miot_device.py index 993f2e5..a9da062 100644 --- a/custom_components/xiaomi_home/miot/miot_device.py +++ b/custom_components/xiaomi_home/miot/miot_device.py @@ -550,8 +550,9 @@ class MIoTDevice: # Optional actions # Optional events miot_service.platform = platform - # entity_category: - if entity_category := SPEC_SERVICE_TRANS_MAP[service_name].get('entity_category'): + # entity_category + if entity_category := SPEC_SERVICE_TRANS_MAP[service_name].get( + 'entity_category', None): miot_service.entity_category = entity_category return entity_data diff --git a/custom_components/xiaomi_home/miot/miot_spec.py b/custom_components/xiaomi_home/miot/miot_spec.py index 7581c6c..d2292e8 100644 --- a/custom_components/xiaomi_home/miot/miot_spec.py +++ b/custom_components/xiaomi_home/miot/miot_spec.py @@ -465,7 +465,7 @@ class _MIoTSpecBase: iid: int type_: str description: str - description_trans: str + description_trans: Optional[str] proprietary: bool need_filter: bool name: str @@ -476,7 +476,7 @@ class _MIoTSpecBase: device_class: Any state_class: Any external_unit: Any - entity_category: str | None + entity_category: Optional[str] spec_id: int diff --git a/custom_components/xiaomi_home/miot/specs/specv2entity.py b/custom_components/xiaomi_home/miot/specs/specv2entity.py index 462ed27..b3039de 100644 --- a/custom_components/xiaomi_home/miot/specs/specv2entity.py +++ b/custom_components/xiaomi_home/miot/specs/specv2entity.py @@ -332,7 +332,7 @@ SPEC_DEVICE_TRANS_MAP: dict = { 'actions': set }, 'entity': str, - 'entity_category'?: str, + 'entity_category'?: str } } """ @@ -365,7 +365,7 @@ SPEC_SERVICE_TRANS_MAP: dict = { } }, 'entity': 'light', - 'entity_category': EntityCategory.CONFIG, + 'entity_category': EntityCategory.CONFIG }, 'fan': { 'required': {