Skip to content
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
19 changes: 12 additions & 7 deletions homeassistant/components/media_player/pjlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,19 @@ def projector(self):
def update(self):
"""Get the latest state from the device."""
with self.projector() as projector:
pwstate = projector.get_power()
if pwstate == 'off':
try:
pwstate = projector.get_power()
if pwstate == 'on' or pwstate == 'warm-up':
self._pwstate = STATE_ON
else:
self._pwstate = STATE_OFF
self._muted = projector.get_mute()[1]
self._current_source = \
format_input_source(*projector.get_input())
except:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use bare except'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to only catch exceptions we expect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could make the changes you mentioned, but I'm new to Github and don't know the processes yet. Do I have to open a new pull request or is it possible to modify the existing pull request?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just commit and push to the same branch and this PR will be updated.

self._pwstate = STATE_OFF
else:
self._pwstate = STATE_ON
self._muted = projector.get_mute()[1]
self._current_source = \
format_input_source(*projector.get_input())
self._muted = False
self._current_source = None

@property
def name(self):
Expand Down