mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Delay state update after switch is toggled for TP-Link HS210 device (#55671)
* delay state update for HS210 * Update workaround comment
This commit is contained in:
parent
b10fc89a6b
commit
0dc8fb497b
@ -1,6 +1,7 @@
|
||||
"""Support for TPLink HS100/HS110/HS200 smart switch."""
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import sleep
|
||||
from typing import Any
|
||||
|
||||
from pyHS100 import SmartPlug
|
||||
@ -89,9 +90,15 @@ class SmartPlugSwitch(CoordinatorEntity, SwitchEntity):
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
await self.hass.async_add_executor_job(self.smartplug.turn_on)
|
||||
# Workaround for delayed device state update on HS210: #55190
|
||||
if "HS210" in self.device_info["model"]:
|
||||
await sleep(0.5)
|
||||
await self.coordinator.async_refresh()
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch off."""
|
||||
await self.hass.async_add_executor_job(self.smartplug.turn_off)
|
||||
# Workaround for delayed device state update on HS210: #55190
|
||||
if "HS210" in self.device_info["model"]:
|
||||
await sleep(0.5)
|
||||
await self.coordinator.async_refresh()
|
||||
|
Loading…
x
Reference in New Issue
Block a user