fix: fix __init__ type error

This commit is contained in:
topsworld 2025-01-17 12:00:15 +08:00
parent 22f843d7ff
commit b16d158dc2

View File

@ -93,7 +93,7 @@ async def async_setup_entry(
"""Send messages in Notifications dialog box.""" """Send messages in Notifications dialog box."""
if title: if title:
persistent_notification.async_create( persistent_notification.async_create(
hass=hass, message=message, hass=hass, message=message or '',
title=title, notification_id=notify_id) title=title, notification_id=notify_id)
else: else:
persistent_notification.async_dismiss( persistent_notification.async_dismiss(
@ -126,9 +126,8 @@ async def async_setup_entry(
miot_devices: list[MIoTDevice] = [] miot_devices: list[MIoTDevice] = []
er = entity_registry.async_get(hass=hass) er = entity_registry.async_get(hass=hass)
for did, info in miot_client.device_list.items(): for did, info in miot_client.device_list.items():
spec_instance: MIoTSpecInstance = await spec_parser.parse( spec_instance = await spec_parser.parse(urn=info['urn'])
urn=info['urn']) if not isinstance(spec_instance, MIoTSpecInstance):
if spec_instance is None:
_LOGGER.error('spec content is None, %s, %s', did, info) _LOGGER.error('spec content is None, %s, %s', did, info)
continue continue
device: MIoTDevice = MIoTDevice( device: MIoTDevice = MIoTDevice(
@ -156,7 +155,8 @@ async def async_setup_entry(
for entity in filter_entities: for entity in filter_entities:
device.entity_list[platform].remove(entity) device.entity_list[platform].remove(entity)
entity_id = device.gen_service_entity_id( entity_id = device.gen_service_entity_id(
ha_domain=platform, siid=entity.spec.iid) ha_domain=platform,
siid=entity.spec.iid) # type: ignore
if er.async_get(entity_id_or_uuid=entity_id): if er.async_get(entity_id_or_uuid=entity_id):
er.async_remove(entity_id=entity_id) er.async_remove(entity_id=entity_id)
if platform in device.prop_list: if platform in device.prop_list: