Fix non-thread-safe operations in wake_on_lan (#116069)

Fix unsafe thread operations in wake_on_lan

https://github.com/home-assistant/core/actions/runs/8808429751/job/24177715837?pr=116066
This commit is contained in:
J. Nick Koston 2024-04-24 03:32:07 +02:00 committed by GitHub
parent f2336a5a3a
commit b1b8b8ba00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,7 +129,7 @@ class WolSwitch(SwitchEntity):
if self._attr_assumed_state: if self._attr_assumed_state:
self._state = True self._state = True
self.async_write_ha_state() self.schedule_update_ha_state()
def turn_off(self, **kwargs: Any) -> None: def turn_off(self, **kwargs: Any) -> None:
"""Turn the device off if an off action is present.""" """Turn the device off if an off action is present."""
@ -138,7 +138,7 @@ class WolSwitch(SwitchEntity):
if self._attr_assumed_state: if self._attr_assumed_state:
self._state = False self._state = False
self.async_write_ha_state() self.schedule_update_ha_state()
def update(self) -> None: def update(self) -> None:
"""Check if device is on and update the state. Only called if assumed state is false.""" """Check if device is on and update the state. Only called if assumed state is false."""