flury_sti
Posts: 34
Joined: Thu May 08, 2014 12:51 am

Using LIRC from Python

Thu May 08, 2014 12:54 am

I setup LIRC to control my AC unit with an IR LED. I have this command which works great:

irsend SEND_ONCE ac KEY_POWER

Now, is there a way to issue the same command using a Python script?

Thanks!

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: Using LIRC from Python

Thu May 08, 2014 8:31 am

Of course, simplest way is probably:

Code: Select all

import subprocess
rtn = subprocess.call(["irsend", "SEND_ONCE", "ac", "KEY_POWER"])
# rtn should equal 0 if command ran without error
EDIT: I think there is a python lirc module but I've never used. Plus, if all you're doing is commands such as the one you posted, then it's probably not even necessary.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

flury_sti
Posts: 34
Joined: Thu May 08, 2014 12:51 am

Re: Using LIRC from Python

Thu May 08, 2014 6:04 pm

Works perfect, thanks!!

Return to “Python”