Fix state handling for older webos versions (#31099)

* fix state handling for older webos versions

* update aiopylgtv to 0.3.2
This commit is contained in:
Josh Bendavid 2020-01-25 19:24:21 +01:00 committed by Charles Garwood
parent e16e192b3c
commit 6f1c45257a
4 changed files with 6 additions and 7 deletions

View File

@ -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"]
}

View File

@ -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):

View File

@ -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

View File

@ -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