Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report webOS media player state #113774

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions homeassistant/components/webostv/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@
name=self._device_name,
)

if (
rale marked this conversation as resolved.
Show resolved Hide resolved
self._client.media_state is not None
and self._client.media_state.get("foregroundAppInfo") is not None
):
thecode marked this conversation as resolved.
Show resolved Hide resolved
for entry in self._client.media_state.get("foregroundAppInfo"):
if entry.get("playState") == "playing":
self._attr_state = MediaPlayerState.PLAYING
elif entry.get("playState") == "paused":
self._attr_state = MediaPlayerState.PAUSED
elif entry.get("playState") == "unloaded":
self._attr_state = MediaPlayerState.IDLE

Check warning on line 254 in homeassistant/components/webostv/media_player.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/webostv/media_player.py#L249-L254

Added lines #L249 - L254 were not covered by tests

if self._client.system_info is not None or self.state != MediaPlayerState.OFF:
maj_v = self._client.software_info.get("major_ver")
min_v = self._client.software_info.get("minor_ver")
Expand Down