LIRC - Linux Infrared Remote Control¶
With LIRC you can receive IR control codes of hundreds of known remote controls.
You can run it as a daemon and listen to incoming codes on it's network socket.
You can build the hardware yourself, or use one of the many supported IR receivers supplied with Multimedia PC's.
Look at the LIRC website for more info.
The ways this interface is integrated in the DomotiGa code is that for each IR code you receive you define an IRRemote trigger in the Events module.
See below for a detailed example.
How to install:
Install LIRC software:
$ sudo apt-get install lirc
It should give you a menu of remotes to pick from. If not, or you want to reconfigure it later try:
$ sudo dpkg-reconfigure lirc
I have a USB IR receiver, a Windows Media Center compatible one.
You can look in dmesg output for more information.
[445027.342540] input: PHILIPS MCE USB IR Receiver- Spinel plus as /devices/pci0000:00/0000:00:04.1/usb1/1-1/1-1.1/1-1.1:1.0/input/input11 [445027.342995] generic-usb 0003:0471:0613.0007: input,hiddev96,hidraw2: USB HID v1.00 Keyboard [PHILIPS MCE USB IR Receiver- Spinel plus] on usb-0000:00:04.1-1.1/input0 [446033.847572] lirc_dev: IR Remote Control driver registered, major 61 [446033.858284] lirc_mceusb: Windows Media Center Edition USB IR Transceiver driver for LIRC 1.90 [446033.858293] lirc_mceusb: Daniel Melander <email@example.com>, Martin Blatter <firstname.lastname@example.org>, Dan Conti <email@example.com> [446033.858398] usbcore: registered new interface driver lirc_mceusb
Setting up lirc (0.8.6-0ubuntu2) ... * Loading LIRC modules [ OK ] * Starting remote control daemon(s) : LIRC [ OK ]
With this command you can check if your receiver detects commands, simply start it and press some buttons.
$ irw 000000037ff07bfe 00 One mceusb 000000037ff07bfe 01 One mceusb 000000037ff07bfd 00 Two mceusb 000000037ff07bfd 01 Two mceusb CTRL-C to break
Adjust your config file so the lird daemon listen for connections on port 8765.
This is my current one, you have to add '--listen' to REMOTE_LIRCD_ARGS
$ sudo vi /etc/lirc/hardware.conf # /etc/lirc/hardware.conf # #Chosen Remote Control REMOTE="Windows Media Center Transceivers/Remotes (all)" REMOTE_MODULES="lirc_dev lirc_mceusb" REMOTE_DRIVER="" REMOTE_DEVICE="/dev/lirc0" REMOTE_SOCKET="" REMOTE_LIRCD_CONF="mceusb/lircd.conf.mceusb" REMOTE_LIRCD_ARGS="--listen" #Chosen IR Transmitter TRANSMITTER="None" TRANSMITTER_MODULES="" TRANSMITTER_DRIVER="" TRANSMITTER_DEVICE="" TRANSMITTER_SOCKET="" TRANSMITTER_LIRCD_CONF="" TRANSMITTER_LIRCD_ARGS="" #Enable lircd START_LIRCD="true" #Don't start lircmd even if there seems to be a good config file #START_LIRCMD="false" #Try to load appropriate kernel modules LOAD_MODULES="true" # Default configuration files for your hardware if any LIRCMD_CONF="" #Forcing noninteractive reconfiguration #If lirc is to be reconfigured by an external application #that doesn't have a debconf frontend available, the noninteractive #frontend can be invoked and set to parse REMOTE and TRANSMITTER #It will then populate all other variables without any user input #If you would like to configure lirc via standard methods, be sure #to leave this set to "false" FORCE_NONINTERACTIVE_RECONFIGURATION="false" START_LIRCMD=""
2010/09/23 19:27:05 [LIRC] Parse String: 000000037ff07bfe 00 One mceusb 2010/09/23 19:27:05 [LIRC] Remote: mceusb Button: One 2010/09/23 19:27:05 [LIRC] Parse String: 000000037ff07bfe 01 One mceusb 2010/09/23 19:27:05 [LIRC] Remote: mceusb Button: One 2010/09/23 19:27:09 [LIRC] Parse String: 000000037ff07bfd 00 Two mceusb 2010/09/23 19:27:09 [LIRC] Remote: mceusb Button: Two 2010/09/23 19:27:10 [LIRC] Parse String: 000000037ff07bfd 01 Two mceusb 2010/09/23 19:27:10 [LIRC] Remote: mceusb Button: Two
Enter the Remote string and Button name you see into the Event Trigger like so:
Do this for all buttons you want to map.
Don't forget to disable debug if all works ok.
Added by OWK over 6 years ago
Works perfectly using a verry old Creative infra receiver CIMR100 on serial!
Only comment: you have to restart LIRC program after editing hardware.conf
Added by kasteleman about 5 years ago
Recently i attached a IR Toy (Dangerous Prototypes) to my Domotiga system and added support for LIRC to it. Now i can also transmit IR commands with my Domotiga Linux system and integrated it with the new SmartVisu webinterface:
It took me some time to figure it out, but it is working now. First you have to create a virtual device. This device will be used to store the value you want to send with the command irsend that comes with LIRC:
Keep the option "Device can be switched" not checked in the option tab of the device.
Now you have to create a script as follows:
para=`xmlrpc localhost:9009 device.getstate "s/IRknop"`
paralenght=$[$lenght - 19]
/usr/bin/irsend SEND_ONCE $irpara
and make this script executable.
Once you have finished that, you create a new action in Domotiga that executes the script:
Now that you have come this far, you have to make a trigger that monitors the device you have created at the beginning:
Finally you can create an event as shown below:
At this moment smartVISU comes into play. You have to design the interface like the first picture and put some code into it. The following code is used for the NETTV button:
basic.button('NETTV', 'IRknop_value', 'NETTV', 'home', '9604 nettv', 'midi')
What will happen if you now push the NETTV button on the smartVISU webinterface? It updates the irknop device and sets the value to 9604 NETTV. This then triggers the event in Domotiga. This event then executes the above created bash script and the irsignal is send by the irtransmitter (in my case the IR Toy). Bare in mind that the code is an example. You have to configure LIRC for you're ir transmitter and learn the codes for you're tv, receiver or what ever ircontrolled device you want to send ircommands.