Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Add config for ir sleep time #23

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
'ir': {
'enabled': 0,
'sleep': 0.2,
}
}

Expand Down Expand Up @@ -247,6 +248,7 @@ def cec_send(cmd, id=None):

def ir_listen_thread():
try:
sleep_time = float(config['ir']['sleep'])
while True:
try:
code = lirc.nextcode()
Expand All @@ -261,7 +263,7 @@ def ir_listen_thread():
code = code[1].strip()
mqtt_send(config['mqtt']['prefix'] + '/ir/' + remote + '/rx', code)
else:
time.sleep(0.2)
time.sleep(sleep_time)
except:
return

Expand Down
3 changes: 3 additions & 0 deletions config.default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@
[ir]
; Enable LIRC
;enabled=1

; Set sleep time between ir code fetches
;sleep=0.2