mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Fix non threadsafe call xiaomi_aqara (#93405)
This commit is contained in:
parent
fdf40fd1e5
commit
761943e1e6
@ -2,6 +2,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from xiaomi_gateway import AsyncXiaomiGatewayMulticast, XiaomiGateway
|
from xiaomi_gateway import AsyncXiaomiGatewayMulticast, XiaomiGateway
|
||||||
@ -351,9 +352,13 @@ class XiaomiDevice(Entity):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def push_data(self, data: dict[str, Any], raw_data: dict[Any, Any]) -> None:
|
||||||
|
"""Push from Hub running in another thread."""
|
||||||
|
self.hass.loop.call_soon(self.async_push_data, data, raw_data)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def push_data(self, data, raw_data):
|
def async_push_data(self, data: dict[str, Any], raw_data: dict[Any, Any]) -> None:
|
||||||
"""Push from Hub."""
|
"""Push from Hub handled in the event loop."""
|
||||||
_LOGGER.debug("PUSH >> %s: %s", self, data)
|
_LOGGER.debug("PUSH >> %s: %s", self, data)
|
||||||
was_unavailable = self._async_track_unavailable()
|
was_unavailable = self._async_track_unavailable()
|
||||||
is_data = self.parse_data(data, raw_data)
|
is_data = self.parse_data(data, raw_data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user