Run remote commands with an old VCR remote and a Raspberry Pi Zero W


  • administrators

    I followed this tutorial to get my Pi Zero W on wifi without even connecting a keyboard and monitor to it.

    I followed this tutorial to get it setup with lirc to run commands when I press corresponding buttons on an old VCR remote.

    I setup the lircrc file to call the TRIGGERcmd API using curl commands when I press those buttons.

    I found the curl commands to be much faster than these commands.

    I also found that some remotes work better than others - like my Window Media Center remote works, but each button alternates between two different IR codes, so it works every other time you press a button. I settled on an old Toshiba VCR remote.

    Picture of the Raspberry Pi Zero with IR receiver connected

    My /etc/lirc/lircrc file looks like this:

      begin
           button = KEY_PLAY
           prog = irexec
           config = export HOME=/root ; /root/triggertest.sh calculator downstairs
      end
      begin
           prog = irexec
           button = KEY_RIGHT
           config = export HOME=/root ; /root/triggertest.sh notepad downstairs
      end
    

    My /root/triggertest.sh file looks like this:

    #!/bin/sh

    trigger=$1
    computer=$2
    token=`cat /root/.TRIGGERcmdData/token.tkn`

    curl -X POST https://www.triggercmd.com/api/run/triggerSave \
    -H "authorization: Bearer ${token}" \
    -H 'content-type: application/json' \
    -d "{\"computername\":\"${computer}\",\"triggername\":\"${trigger}\"}"


Log in to reply
 

Looks like your connection to TRIGGERcmd Forum was lost, please wait while we try to reconnect.