In this Howto I want to show you that controlling infrared devices is nearly as easy as controlling 433Mhz devices. I really did little on my own because there are already tons of tutorials for lirc (Linux Infrared Remote Control).
A ) Set up your hardware
Pictures say more than 1000 words.
This is not my picture, but i included some important information for beginners.
You can see my soldered hardware here: http://forum.pimatic.org/topic/182/show-your-hardware/11
B ) Set up the software
As i completly followed THIS guide i wont repeat every single command. Its a very well written article and easy to understand, so i got nothing to do here
C ) Learning your remote
This section is also described on the website given above but i want to add one more thing:
After you successfully recorded your own remote and copied it in /etc/lirc/ you may want to give it a name in the config file so you can later send commands like irsend SEND_ONCE <YourRemoteName> KEY_MUTE
.
- Stop lirc if running:
sudo /etc/init.d/lirc stop
- Open config file
sudo nano /etc/lirc/lircd.conf
You can change the name of your remote by changing (guess what:) the line ‘name’. - Close and save config file and start lirc again:
sudo /etc/init.d/lirc start
D1) Infrared Pimatic (scripts by @georg90)
Create and open file lircrc: sudo nano /etc/lirc/lircrc
like following picture:
Note: Try " […] >/dev/null 2>&1 " without the third / if above is not working.
Then create and open the used script (in this example first make the directory /opt/scripts/)
- Go to /opt/ directory:
cd /opt/
- Create new folder:
mkdir scripts
- Go into the folder:
cd scripts/
- Create following python script:
sudo nano pimatic.py
(if you want to copy+paste: pastebin)
If you didnt yet work with api commands this thread should be helpful: http://forum.pimatic.org/topic/46/trigger-by-url/3
Still got Errors? Try this:
-
If lirc is running you can execute
sudo irw
and then press the recorded buttons of your remote to look if lirc does recognize your remote buttons. In the following picture i tested if my volume buttons are recognized:
-
If you are curious about your python script you can also run it manually with:
sudo python /opt/scripts/pimatic.py an
D2) Pimatic Infrared
Of course there is also a way to send IR signals with the Pimatic GUI. Follow these few steps:
- Add a new device to your config file:
{
"id": "yamaha",
"name": "Yamaha",
"class": "ButtonsDevice",
"buttons": [
{
"id": "yamahavoldown",
"text": "Vol-"
},
{
"id": "yamahamute",
"text": "Mute"
},
...
...
]
}
- Add rules for each button:
if yamahavolumedown is pressed then execute "irsend SEND_ONCE yamaha KEY_VOLUMEDOWN"
if yamahamute is pressed then execute "irsend SEND_ONCE yamaha KEY_MUTE"
...
- Voila! There you are:
Resources:
http://opensourceuniversalremote.com/
http://alexba.in/blog/2013/06/08/open-source-universal-remote-parts-and-pictures/
http://forum.pimatic.org/topic/218/tsop4838-and-pimatic-homeduino/7 thanks @georg90