mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Switch lifx to use async_call_later (#99217)
This commit is contained in:
parent
ccb91e3676
commit
1bf7b4b2c7
@ -8,7 +8,6 @@ from typing import Any
|
|||||||
import aiolifx_effects as aiolifx_effects_module
|
import aiolifx_effects as aiolifx_effects_module
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import util
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_EFFECT,
|
ATTR_EFFECT,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
@ -24,7 +23,7 @@ from homeassistant.exceptions import HomeAssistantError
|
|||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
from homeassistant.helpers.event import async_call_later
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
@ -187,10 +186,10 @@ class LIFXLight(LIFXEntity, LightEntity):
|
|||||||
"""Refresh the state."""
|
"""Refresh the state."""
|
||||||
await self.coordinator.async_refresh()
|
await self.coordinator.async_refresh()
|
||||||
|
|
||||||
self.postponed_update = async_track_point_in_utc_time(
|
self.postponed_update = async_call_later(
|
||||||
self.hass,
|
self.hass,
|
||||||
|
timedelta(milliseconds=when),
|
||||||
_async_refresh,
|
_async_refresh,
|
||||||
util.dt.utcnow() + timedelta(milliseconds=when),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user