Skip to content

Commit

Permalink
Recover from rare error condition from LIRC (home-assistant#2267)
Browse files Browse the repository at this point in the history
* More resilient accessing of LIRC codes to handle rare error case.

* Line length fix in LIRC
  • Loading branch information
partofthething authored and balloob committed Jun 12, 2016
1 parent 31c1b7f commit 491c06f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion homeassistant/components/lirc.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ def run(self):
"""Main loop of LIRC interface thread."""
import lirc
while not self.stopped.isSet():
code = lirc.nextcode() # list; empty if no buttons pressed
try:
code = lirc.nextcode() # list; empty if no buttons pressed
except lirc.NextCodeError:
_LOGGER.warning('Encountered error reading '
'next code from LIRC')
code = None
# interpret result from python-lirc
if code:
code = code[0]
Expand Down

0 comments on commit 491c06f

Please sign in to comment.