Prevent blocking event loop in ps4 (#126151)

* Prevent blocking event loop in ps4

* Process code review comment
pull/125763/head
Jan-Philipp Benecke 2024-09-19 10:45:26 +02:00 committed by GitHub
parent 8ca3310401
commit 3981c87860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -96,11 +96,10 @@ class PS4Device(MediaPlayerEntity):
self._retry = 0
self._disconnected = False
@callback
def status_callback(self) -> None:
"""Handle status callback. Parse status."""
self._parse_status()
self.async_write_ha_state()
self.schedule_update_ha_state()
@callback
def subscribe_to_protocol(self) -> None:
@ -157,7 +156,7 @@ class PS4Device(MediaPlayerEntity):
self._ps4.ddp_protocol = self.hass.data[PS4_DATA].protocol
self.subscribe_to_protocol()
self._parse_status()
await self.hass.async_add_executor_job(self._parse_status)
def _parse_status(self) -> None:
"""Parse status."""