This entry talks through the steps required to create a SiriProxy on your RPi that will enable you to trap custom Siri commands made on an iPhone and then perform a custom action using the RPi, which I’ll cover in a later entry.
First of all credits, these steps are taken from a few sources so here they are:
This entry assumes that your RPi is setup and instructions are based upon a Occidentalis Distro on the RPi as per the previous RPi posts:
- Basic Setup
- SSHRemote Desktop
Installing SiriProxy
These steps are a combintaion of the sites credited above, if you require background information please look at the sites, this is a quick set-up post and won;t explain why we do anyof the steps.
- you first need to switch to root to ensure this works, I forgot this step and failed the first time. To do this run the following command:
sudo su -
Note that from a security perspective this isn’t great practice but for speed we’ll do it. We’ll look at making it more secure in a later post.
- download the relevant code
sudo apt-get install dnsmasq ruby build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
Select’y’ when prompted
- Setup the proxy listener
sudo nano /etc/dnsmasq.conf
Find the following line on approximately line 62: #address=/double-click.net/127.0.0.1
Directly beneath that line type:address=/guzzoni.apple.com/(your_machine's_ip_address)
Replace (your_machine’s_ip_address) with the IP address of your machine as shown in the video.
Entre Ctrl+x, press y to accept and exit the editor -
sudo /etc/init.d/dnsmasq restart
-
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
-
[[ -s "$HOME/.rvm/scripts/rvm"; ]] && . "$HOME/.rvm/scripts/rvm"
-
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
-
rvm install 1.9.3
This command takes a while so be patient
-
rvm use 1.9.3 --default
-
git clone git://github.com/plamoni/SiriProxy.git
-
cd SiriProxy
Select y to continue
-
mkdir ~/.siriproxy
-
cp ./config.example.yml ~/.siriproxy/config.yml
-
rake install
- Generate the certs for your phone
siriproxy gencerts
-
siriproxy bundle
- We’ll now copy the certs to your phone, you can either email them to yourself and open them on your phone or alternatively use DropBox as I did
- Copy the certificates to the pi users desktop so theyare easily accessible
cp ~/.siriproxy/ca.pem /home/pi/desktop/ca.pem
- Open DropBox in a browser and log in
- Upload the ca.pem file fron the desktop
- Once synced open the ca.pem file on your phone. If you have the DropBox app it may not work, if this is the case select the option to email the file, then copy the url in the email body and paste into Safari, download the file and then follow the instructions.
- The certificate is now installed on your iPhone
- Copy the certificates to the pi users desktop so theyare easily accessible
- Now startup the SiriProxy on your RPi
rvmsudo siriproxy server
The terminal should say SiriProxy up and running
Do not close the terminal window as this is the proxy.
If you recieve a warning regarding Secure_Path then do as it says and run the following command when SiriProxy is stoppedexport rvmsudo_secure_path=1
- On your iPhone we need to tell it to route Siri via your proxy.
Within settingswifi select the blue arrow to teh right of your wireless network
Enter the RPi IPAddress into the DNS section (if you don’t know the IP Address open a new LX Terminal on the RPi and enterifconfig
- We now need to test SiriProxy
- Open Siri on your phone (hold down the home key) then say “Test Siri Proxy”. You should see the commands in the terminal window and should recieve a response stating “Siri Proxy is up and running!”
- That’s it!
When I set up SiriProxy using teh above I recieved an error when I tried to use Siri stating there was an InvalidByteSequence look out for this and if it occurs follow the below steps to correct it
- Ensure you are in the SiriProxy directory
-
sudo vi siriproxy.gemspec
- Replace the line approx 4 from bottom which contains “CFPropertyList” with the below:
s.add_runtime_dependency('CFPropertyList', '2.1.2')
-
siriproxy update
-
rake install
- This fix is from the github issues library
- Start the SiriProxy
rvmsudo siriproxy server
- Open Siri on your phone (hold down the home key) then say “Test Siri Proxy”. You should see the commands in the terminal window and should recieve a response stating “Siri Proxy is up and running!”
- That’s it!
If you experience any other issues leave a comment or checkout the issues section on Git Hub.
The next post shows how to create custom Siri commands
Now Siri is working the next post will be on using Siri to control devices via RPi.
I am also looking at options to autostartrestart siriproxy, at the moment you have to start it manually.