mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Correct philips_js usage of the overloaded coordinator (#66287)
This commit is contained in:
parent
4d944e35fd
commit
ad09e875a6
@ -82,7 +82,7 @@ async def async_setup_entry(
|
|||||||
class PhilipsTVMediaPlayer(CoordinatorEntity, MediaPlayerEntity):
|
class PhilipsTVMediaPlayer(CoordinatorEntity, MediaPlayerEntity):
|
||||||
"""Representation of a Philips TV exposing the JointSpace API."""
|
"""Representation of a Philips TV exposing the JointSpace API."""
|
||||||
|
|
||||||
_coordinator: PhilipsTVDataUpdateCoordinator
|
coordinator: PhilipsTVDataUpdateCoordinator
|
||||||
_attr_device_class = MediaPlayerDeviceClass.TV
|
_attr_device_class = MediaPlayerDeviceClass.TV
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -91,7 +91,6 @@ class PhilipsTVMediaPlayer(CoordinatorEntity, MediaPlayerEntity):
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the Philips TV."""
|
"""Initialize the Philips TV."""
|
||||||
self._tv = coordinator.api
|
self._tv = coordinator.api
|
||||||
self._coordinator = coordinator
|
|
||||||
self._sources = {}
|
self._sources = {}
|
||||||
self._channels = {}
|
self._channels = {}
|
||||||
self._supports = SUPPORT_PHILIPS_JS
|
self._supports = SUPPORT_PHILIPS_JS
|
||||||
@ -125,7 +124,7 @@ class PhilipsTVMediaPlayer(CoordinatorEntity, MediaPlayerEntity):
|
|||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Flag media player features that are supported."""
|
"""Flag media player features that are supported."""
|
||||||
supports = self._supports
|
supports = self._supports
|
||||||
if self._coordinator.turn_on or (
|
if self.coordinator.turn_on or (
|
||||||
self._tv.on and self._tv.powerstate is not None
|
self._tv.on and self._tv.powerstate is not None
|
||||||
):
|
):
|
||||||
supports |= SUPPORT_TURN_ON
|
supports |= SUPPORT_TURN_ON
|
||||||
@ -170,7 +169,7 @@ class PhilipsTVMediaPlayer(CoordinatorEntity, MediaPlayerEntity):
|
|||||||
await self._tv.setPowerState("On")
|
await self._tv.setPowerState("On")
|
||||||
self._state = STATE_ON
|
self._state = STATE_ON
|
||||||
else:
|
else:
|
||||||
await self._coordinator.turn_on.async_run(self.hass, self._context)
|
await self.coordinator.turn_on.async_run(self.hass, self._context)
|
||||||
await self._async_update_soon()
|
await self._async_update_soon()
|
||||||
|
|
||||||
async def async_turn_off(self):
|
async def async_turn_off(self):
|
||||||
|
@ -30,7 +30,7 @@ async def async_setup_entry(
|
|||||||
class PhilipsTVRemote(CoordinatorEntity, RemoteEntity):
|
class PhilipsTVRemote(CoordinatorEntity, RemoteEntity):
|
||||||
"""Device that sends commands."""
|
"""Device that sends commands."""
|
||||||
|
|
||||||
_coordinator: PhilipsTVDataUpdateCoordinator
|
coordinator: PhilipsTVDataUpdateCoordinator
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -63,7 +63,7 @@ class PhilipsTVRemote(CoordinatorEntity, RemoteEntity):
|
|||||||
if self._tv.on and self._tv.powerstate:
|
if self._tv.on and self._tv.powerstate:
|
||||||
await self._tv.setPowerState("On")
|
await self._tv.setPowerState("On")
|
||||||
else:
|
else:
|
||||||
await self._coordinator.turn_on.async_run(self.hass, self._context)
|
await self.coordinator.turn_on.async_run(self.hass, self._context)
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs):
|
async def async_turn_off(self, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user