Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactor miot mips & fix type errors #365

Merged
merged 14 commits into from
Jan 10, 2025
4 changes: 2 additions & 2 deletions custom_components/xiaomi_home/miot/miot_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ async def deinit_async(self) -> None:
# Cloud mips
self._mips_cloud.unsub_mips_state(
key=f'{self._uid}-{self._cloud_server}')
self._mips_cloud.disconnect()
self._mips_cloud.deinit()
# Cancel refresh cloud devices
if self._refresh_cloud_devices_timer:
self._refresh_cloud_devices_timer.cancel()
Expand All @@ -370,7 +370,7 @@ async def deinit_async(self) -> None:
for mips in self._mips_local.values():
mips.on_dev_list_changed = None
mips.unsub_mips_state(key=mips.group_id)
mips.disconnect()
mips.deinit()
if self._mips_local_state_changed_timers:
for timer_item in (
self._mips_local_state_changed_timers.values()):
Expand Down
324 changes: 0 additions & 324 deletions custom_components/xiaomi_home/miot/miot_ev.py

This file was deleted.

4 changes: 2 additions & 2 deletions custom_components/xiaomi_home/miot/miot_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import asyncio
import logging
import os
from typing import Optional
from typing import Optional, Union

# pylint: disable=relative-beyond-top-level
from .common import load_json_file
Expand Down Expand Up @@ -98,7 +98,7 @@ async def deinit_async(self) -> None:

def translate(
self, key: str, replace: Optional[dict[str, str]] = None
) -> str | dict | None:
) -> Union[str, dict, None]:
result = self._data
for item in key.split('.'):
if item not in result:
Expand Down
Loading
Loading