05-16-2018, 04:56 PM
(This post was last modified: 05-16-2018, 05:22 PM by FizzyTea.
Edit Reason: speeling, ease of reading etc
)
My Moode experience has really improved since I added an IR remote.
Headless setups are great but if you do not have your interface ready to go (unlocked, opened and connected etc) there is often quite a bit of lag between wanting to do something - like pause the music - and achieving it. Added to this the fact that my amp has no remote means unlocking my tablet and loading the web ui is a little slow for tasks that warrant some immediacy such as mute and volume adjustments. And since my dac (Pifi DAC+ v2.0) has a built in IR receiver the decision was a no brainer and has vastly improved the usability of my system. I used a cheap generic remote like you used to get with car stereos.
The bump to raspbian stretch brings the latest version of lirc which seems to be classed as a disruptive update. As a result many online guides are now outdated and indeed many newer ones seem to include hangover steps from previous versions which are no longer required. This guide seems to point out and drop the unnecessary steps still mentioned in many guides.
In summary
Install lirc
Edit /boot/config.txt to include
For my built-in IR receiver gpio_in_pin=26 is the correct choice. Adjust as appropriate.
Edit /etc/lirc/lirc_options.conf
Now you must make a config file for your particular remote control.
You can either find a config file online, many remotes are available, or you can use the irrecord program to record the pulses from each button in sequence. It seems the irrecord may be giving problems with stretch but I am using a previously generated working config file so haven't needed to generate one on stretch. So if you can, find a working lircd.conf for your remote. If not give irrecord a go.
Try
Anyway now add your remote config file lircd.conf to
If it is in this directory it can have any name as long as it ends with .conf apparently.
And Reboot.
You can now check for the presence of the services and modules with commands like
You can also now (it is probably advisable on initial install) check if lirc is recieving commands using irsend.
Most tutorials have a section showing you how to test at this stage.
All that is left to do is setup irexec as a service and create a file with the commands irexec should run upon button presses.
I am trying to get a handle on the whole systemd services thing but this has worked for me.
I set irexec up as a user service for better security rather than having it run as root.
I added a file irexec.service to /etc/systemd/system/ containing
Then I create the file of commands specified in irexec.service - /home/pi/.lircrc in this case.
It contains commands of the form
Now reboot.
Check the status of your services with
Now you can control your moOde!
(I have a warning in my systemctl status report for lircd but all works well so I'm ignoring it for now)
Headless setups are great but if you do not have your interface ready to go (unlocked, opened and connected etc) there is often quite a bit of lag between wanting to do something - like pause the music - and achieving it. Added to this the fact that my amp has no remote means unlocking my tablet and loading the web ui is a little slow for tasks that warrant some immediacy such as mute and volume adjustments. And since my dac (Pifi DAC+ v2.0) has a built in IR receiver the decision was a no brainer and has vastly improved the usability of my system. I used a cheap generic remote like you used to get with car stereos.
The bump to raspbian stretch brings the latest version of lirc which seems to be classed as a disruptive update. As a result many online guides are now outdated and indeed many newer ones seem to include hangover steps from previous versions which are no longer required. This guide seems to point out and drop the unnecessary steps still mentioned in many guides.
In summary
Install lirc
Quote:sudo apt-get install lirc
Edit /boot/config.txt to include
Quote:dtoverlay=lirc-rpi,gpio_in_pin=26
For my built-in IR receiver gpio_in_pin=26 is the correct choice. Adjust as appropriate.
Edit /etc/lirc/lirc_options.conf
Quote:change: driver = devinput to driver = default
change: device = auto to device = /dev/lirc0
Now you must make a config file for your particular remote control.
You can either find a config file online, many remotes are available, or you can use the irrecord program to record the pulses from each button in sequence. It seems the irrecord may be giving problems with stretch but I am using a previously generated working config file so haven't needed to generate one on stretch. So if you can, find a working lircd.conf for your remote. If not give irrecord a go.
Try
Quote:https://sourceforge.net/projects/lirc-remotes/or
Quote:sudo irrecord -n -d /dev/lirc0 ~/lircd.confand follow instructions?
Anyway now add your remote config file lircd.conf to
Quote:/etc/lirc/lircd.conf.d/
If it is in this directory it can have any name as long as it ends with .conf apparently.
And Reboot.
You can now check for the presence of the services and modules with commands like
Quote:dmesg | grep lirc
lsmod | grep lirc
ls -l /dev/lirc0
ps aux | grep lirc
You can also now (it is probably advisable on initial install) check if lirc is recieving commands using irsend.
Quote:irsend SEND_ONCE you_remote_name some_key_nameshould execute without error.
Most tutorials have a section showing you how to test at this stage.
All that is left to do is setup irexec as a service and create a file with the commands irexec should run upon button presses.
I am trying to get a handle on the whole systemd services thing but this has worked for me.
I set irexec up as a user service for better security rather than having it run as root.
I added a file irexec.service to /etc/systemd/system/ containing
Quote:[Unit]
Description=LIRC command handler
After=network.target
[Service]
User=pi
Group=pi
Type=forking
ExecStart=/usr/bin/irexec --daemon /home/pi/.lircrc
[Install]
WantedBy=multi-user.target
Wants=lircd.service
Then I create the file of commands specified in irexec.service - /home/pi/.lircrc in this case.
It contains commands of the form
Quote:begin
prog = irexec
button = KEY_VOLUMEUP
config = /var/www/vol.sh up 2
end
begin
prog = irexec
button = KEY_PLAYPAUSE
config = mpc toggle
repeat = 0
end
Now reboot.
Check the status of your services with
Quote:systemctl status lircd
systemctl status irexec
Now you can control your moOde!
(I have a warning in my systemctl status report for lircd but all works well so I'm ignoring it for now)