mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-20 01:09:36 +08:00
Compare commits
No commits in common. "2446d69c74fe884954f0364ac535f8579d5dbb24" and "ae4107da2dbe14e2027412e12dc7807a67626ddb" have entirely different histories.
2446d69c74
...
ae4107da2d
@ -851,26 +851,25 @@ class MIoTClient:
|
|||||||
async def remove_device_async(self, did: str) -> None:
|
async def remove_device_async(self, did: str) -> None:
|
||||||
if did not in self._device_list_cache:
|
if did not in self._device_list_cache:
|
||||||
return
|
return
|
||||||
sub_from = self._sub_source_list.pop(did, None)
|
self._mips_cloud.unsub_prop(did=did)
|
||||||
# Unsub
|
self._mips_cloud.unsub_event(did=did)
|
||||||
if sub_from:
|
if self._ctrl_mode == CtrlMode.AUTO:
|
||||||
if sub_from == 'cloud':
|
if did in self._device_list_gateway:
|
||||||
self._mips_cloud.unsub_prop(did=did)
|
mips = self._mips_local.get(
|
||||||
self._mips_cloud.unsub_event(did=did)
|
self._device_list_gateway[did]['group_id'], None)
|
||||||
elif sub_from == 'lan':
|
if mips:
|
||||||
|
mips.unsub_prop(did=did)
|
||||||
|
mips.unsub_event(did=did)
|
||||||
|
elif self._miot_lan.init_done and did in self._device_list_lan:
|
||||||
self._miot_lan.unsub_prop(did=did)
|
self._miot_lan.unsub_prop(did=did)
|
||||||
self._miot_lan.unsub_event(did=did)
|
self._miot_lan.unsub_event(did=did)
|
||||||
elif sub_from in self._mips_local:
|
self._sub_source_list.pop(did, None)
|
||||||
mips = self._mips_local[sub_from]
|
self._device_list_cache.pop(did, None)
|
||||||
mips.unsub_prop(did=did)
|
|
||||||
mips.unsub_event(did=did)
|
|
||||||
# Storage
|
# Storage
|
||||||
await self._storage.save_async(
|
await self._storage.save_async(
|
||||||
domain='miot_devices',
|
domain='miot_devices',
|
||||||
name=f'{self._uid}_{self._cloud_server}',
|
name=f'{self._uid}_{self._cloud_server}',
|
||||||
data=self._device_list_cache)
|
data=self._device_list_cache)
|
||||||
# Update notify
|
|
||||||
self.__request_show_devices_changed_notify()
|
|
||||||
|
|
||||||
def __get_exec_error_with_rc(self, rc: int) -> str:
|
def __get_exec_error_with_rc(self, rc: int) -> str:
|
||||||
err_msg: str = self._i18n.translate(key=f'error.common.{rc}')
|
err_msg: str = self._i18n.translate(key=f'error.common.{rc}')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user