So I finally worked out a method to control my stereo via the command line on my Mac using the IP2IR device I just bought. I tried using this https://www.kolinahr.com/documentation/wagner-ir-extractor/getting-started-with-the-wire-utility/ but it wouldn't run on the Mac out of the box.
However, I used part of this excellent code to come up with this script. This works to turn off my NAD C 356.
A things are needed for this script to work.
- Change the IP address for your IP2IR.
- Install nmap via brew install nmap since ncat doesn't come with the Mac.
- Get the IR code for your device from the Global Cache database.
I'm not a professional programmer but thought this might help someone...
ncat=/usr/local/bin/ncat # brew install nmap
# create the script for ncat
cat <<'EOF' > /tmp/ir.sh
echo -e -n "$1\r" ; read -t 5 -d $'\r' input ; rc=$?
if [ $rc -ne 0 ]; then input="ERR:$rc, iTach command timeout" ; fi
echo $input > /tmp/ir.out
chmod a+x /tmp/ir.sh
# IR codes from https://irdb.globalcache.com/Home/Database
# send the code
cmd="$ncat -w 3 --exec '/tmp/ir.sh $off' $ip $port"
eval $cmd > /dev/null 2>&1
if [ "$?" != "0" ] ; then echo "ERR: could not send IR code." ; exit 1 ; fi
if ! `grep -q completeir /tmp/ir.out` ; then echo "ERR: IR code did not work" ; exit 1 ; fi
rm /tmp/ir.sh /tmp/ir.out > /dev/null 2>&1