Recover from rare error condition from LIRC (#2267)
* More resilient accessing of LIRC codes to handle rare error case. * Line length fix in LIRC
This commit is contained in:
parent
abc353c083
commit
c229d9e90f
1 changed files with 6 additions and 1 deletions
|
@ -66,7 +66,12 @@ class LircInterface(threading.Thread):
|
||||||
"""Main loop of LIRC interface thread."""
|
"""Main loop of LIRC interface thread."""
|
||||||
import lirc
|
import lirc
|
||||||
while not self.stopped.isSet():
|
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
|
# interpret result from python-lirc
|
||||||
if code:
|
if code:
|
||||||
code = code[0]
|
code = code[0]
|
||||||
|
|
Loading…
Add table
Reference in a new issue