8000 fix panasonic viera doing I/O in event loop by balloob · Pull Request #4341 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix panasonic viera doing I/O in event loop #4341

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

Merged
merged 1 commit into from
Nov 11, 2016
Merged
Changes from all commits
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: 3 additions & 9 deletions homeassistant/components/media_player/panasonic_viera.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ def __init__(self, name, remote):
self._playing = True
self._state = STATE_UNKNOWN
self._remote = remote
self._volume = 0

def update(self):
"""Retrieve the latest data."""
try:
self._muted = self._remote.get_mute()
self._volume = self._remote.get_volume() / 100
self._state = STATE_ON
except OSError:
self._state = STATE_OFF
return False
return True

def send_key(self, key):
"""Send a key to the tv and handles exceptions."""
Expand All @@ -113,13 +113,7 @@ def state(self):
@property
def volume_level(self):
"""Volume level of the media player (0..1)."""
volume = 0
try:
volume = self._remote.get_volume() / 100
self._state = STATE_ON
except OSError:
self._state = STATE_OFF
return volume
return self._volume

@property
def is_volume_muted(self):
Expand Down
0