With script you can conect with SSH to remote machine and send command to ITUNES (tested form Orange Pi to Macosx). I used Python, because send commands over bash script was quite difficult and it was easier to control with Python.
1.
On Mac side you need
https://github.com/mischah/itunes-remote
Code: Select all
npm install --global itunes-remote
On Domoticz server side you need
Python and paramiko module
Code: Select all
pip install paramiko
create imacssh.py in /scripts/python
Code: Select all
import paramiko
import sys
import time
nbytes = 4096
hostname = '192.168.2.253'
port = 22
username = 'XXXX'
password = 'XXX'
command = '/usr/local/bin/itunes-remote search artist'
client = paramiko.Transport((hostname, port))
client.connect(username=username, password=password)
session = client.open_channel(kind='session')
session.exec_command(command)
time.sleep(5)
print command
print "PLAY"
Code: Select all
#!/bin/bash
if [[ $# -eq 1 && $1 == "ON" ]]; then
python /home/jandevera/domoticz/scripts/python/imacssh.py ON
echo "ON"
elif [[ $# -eq 1 && $1 == "OFF" ]]; then
python /home/jandevera/domoticz/scripts/python/imacssh.py OFF
echo "OFF"
else
echo -e "Usage : `basename $0` <ON>|<OFF>" && exit 0
fi
script://python/imac_ssh ON as ON
and script://python/imac_ssh OFF as OFF
Script is simple and could be improved (i have no check if Mac is ON). But could be usefull for sending other comands and is quite simple...