Mark as `assumed_state` LG Netcast media player (#93543)
Mark as assumed_state LG Netcast media playerpull/93561/head
parent
a71c097aeb
commit
70e20815c7
|
@ -74,6 +74,7 @@ def setup_platform(
|
||||||
class LgTVDevice(MediaPlayerEntity):
|
class LgTVDevice(MediaPlayerEntity):
|
||||||
"""Representation of a LG TV."""
|
"""Representation of a LG TV."""
|
||||||
|
|
||||||
|
_attr_assumed_state = True
|
||||||
_attr_device_class = MediaPlayerDeviceClass.TV
|
_attr_device_class = MediaPlayerDeviceClass.TV
|
||||||
_attr_media_content_type = MediaType.CHANNEL
|
_attr_media_content_type = MediaType.CHANNEL
|
||||||
|
|
||||||
|
@ -83,8 +84,6 @@ class LgTVDevice(MediaPlayerEntity):
|
||||||
self._name = name
|
self._name = name
|
||||||
self._muted = False
|
self._muted = False
|
||||||
self._on_action_script = on_action_script
|
self._on_action_script = on_action_script
|
||||||
# Assume that the TV is in Play mode
|
|
||||||
self._playing = True
|
|
||||||
self._volume = 0
|
self._volume = 0
|
||||||
self._channel_id = None
|
self._channel_id = None
|
||||||
self._channel_name = ""
|
self._channel_name = ""
|
||||||
|
@ -106,7 +105,7 @@ class LgTVDevice(MediaPlayerEntity):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with self._client as client:
|
with self._client as client:
|
||||||
self._attr_state = MediaPlayerState.PLAYING
|
self._attr_state = MediaPlayerState.ON
|
||||||
|
|
||||||
self.__update_volume()
|
self.__update_volume()
|
||||||
|
|
||||||
|
@ -233,23 +232,12 @@ class LgTVDevice(MediaPlayerEntity):
|
||||||
"""Select input source."""
|
"""Select input source."""
|
||||||
self._client.change_channel(self._sources[source])
|
self._client.change_channel(self._sources[source])
|
||||||
|
|
||||||
def media_play_pause(self) -> None:
|
|
||||||
"""Simulate play pause media player."""
|
|
||||||
if self._playing:
|
|
||||||
self.media_pause()
|
|
||||||
else:
|
|
||||||
self.media_play()
|
|
||||||
|
|
||||||
def media_play(self) -> None:
|
def media_play(self) -> None:
|
||||||
"""Send play command."""
|
"""Send play command."""
|
||||||
self._playing = True
|
|
||||||
self._attr_state = MediaPlayerState.PLAYING
|
|
||||||
self.send_command(LG_COMMAND.PLAY)
|
self.send_command(LG_COMMAND.PLAY)
|
||||||
|
|
||||||
def media_pause(self) -> None:
|
def media_pause(self) -> None:
|
||||||
"""Send media pause command to media player."""
|
"""Send media pause command to media player."""
|
||||||
self._playing = False
|
|
||||||
self._attr_state = MediaPlayerState.PAUSED
|
|
||||||
self.send_command(LG_COMMAND.PAUSE)
|
self.send_command(LG_COMMAND.PAUSE)
|
||||||
|
|
||||||
def media_next_track(self) -> None:
|
def media_next_track(self) -> None:
|
||||||
|
|
Loading…
Reference in New Issue