From 6f1c45257a6eaa0a096dc0e050cbcbcf3c37ff79 Mon Sep 17 00:00:00 2001 From: Josh Bendavid Date: Sat, 25 Jan 2020 19:24:21 +0100 Subject: [PATCH] Fix state handling for older webos versions (#31099) * fix state handling for older webos versions * update aiopylgtv to 0.3.2 --- homeassistant/components/webostv/manifest.json | 2 +- homeassistant/components/webostv/media_player.py | 7 +++---- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/webostv/manifest.json b/homeassistant/components/webostv/manifest.json index 4328ff96b56..e55867432cc 100644 --- a/homeassistant/components/webostv/manifest.json +++ b/homeassistant/components/webostv/manifest.json @@ -2,7 +2,7 @@ "domain": "webostv", "name": "LG webOS Smart TV", "documentation": "https://www.home-assistant.io/integrations/webostv", - "requirements": ["aiopylgtv==0.3.0"], + "requirements": ["aiopylgtv==0.3.2"], "dependencies": ["configurator"], "codeowners": ["@bendavid"] } diff --git a/homeassistant/components/webostv/media_player.py b/homeassistant/components/webostv/media_player.py index c34fb376d31..72e5d16cfe3 100644 --- a/homeassistant/components/webostv/media_player.py +++ b/homeassistant/components/webostv/media_player.py @@ -227,11 +227,10 @@ class LgWebOSMediaPlayerEntity(MediaPlayerDevice): @property def state(self): """Return the state of the device.""" - client_state = self._client.power_state.get("state") - if client_state in [None, "Power Off", "Suspend", "Active Standby"]: - return STATE_OFF + if self._client.is_on: + return STATE_ON - return STATE_ON + return STATE_OFF @property def is_volume_muted(self): diff --git a/requirements_all.txt b/requirements_all.txt index 93d879f6629..6033b578fda 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -190,7 +190,7 @@ aionotion==1.1.0 aiopvapi==1.6.14 # homeassistant.components.webostv -aiopylgtv==0.3.0 +aiopylgtv==0.3.2 # homeassistant.components.switcher_kis aioswitcher==2019.4.26 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 0ed261e21ab..7581173b534 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -69,7 +69,7 @@ aiohue==1.10.1 aionotion==1.1.0 # homeassistant.components.webostv -aiopylgtv==0.3.0 +aiopylgtv==0.3.2 # homeassistant.components.switcher_kis aioswitcher==2019.4.26