Guide for setting up a Siri Proxy server to control Vera

I’ve got a SiriProxy server running and controlling Vera scenes. While it was fresh… I wanted to put together a guide for those who want to try to set up Siri on their IPhone 4S/5 to control Vera.

A couple of things first:

  1. I did this with my iPhone 5 (or 4S). You do not have to Jailbreak your phone. All that’s required on the phone is to add a certificate (which can be easily removed) and set the DNS address in your Wi-Fi connection.
  2. I used an old (really old) laptop and it runs Linux Server fine. You can probably use the GUI version? or Virtual Machine. I did a fresh Install.
  3. Be patient? I wiped the computer and started over with a fresh copy of Linux several times before I got it running. Hopefully this guide will help things go smooth.
  4. A BIG thanks for the folks at am3yrus.com for their script to install the Three Little Pigs Siri Proxy. This automates the task of performing the install. If you?ve seen the procedure to do it manually, you know what I mean!
  5. I used Ubuntu Version 11.10 because I could not get the current version 12 to run on my old laptop. I believe it should work with the current version

Install Ubuntu 11.10

  1. Download Ubuntu 11.10 Index of /releases/11.10 (pick version for your computer)
  2. Burn a CD, boot the computer you?re going to use using the CD and follow the install prompts.

Create a root password
sudo passwd root

sudo passwd -u root

Log into the Root
su -

Install the Three Little Pigs Siri Proxy
apt-get install -qq wget
wget http://www.am3yrus.com/downloads/TTLPinstaller-1.10.sh
chmod u+x TTLPinstaller-1.10.sh
./TTLPinstaller-1.10.sh

I used Static IP and Private Server. All other parameters I kept the default

Install the Certificate on your iPhone

  1. Copy the ca.pem certificate from the Linus box to your PC. It’s located in the root/.siriproxy directory. I use Winscp to access the files.
  2. E-mail the ca.pem file to yourself so you can open it on your iPhone.
  3. On the phone, select the ca.pem file and when the certificate box opens, install it. It will say it’s not trusted. Do it anyway.

Set DNS in the Wi-Fi Settings
Go to the Wi-Fi settings on your phone and select your current Wi-Fi account. Change the DNS to the Static IP address of your server.

Forward 443 and 53
Go into your router and port forward ports 443 and 53 to the Static IP of the server

Create a server startup script
I had to stop and start the server DNS every time I powered up. So here is a script that will automate the process and start the server.

nano StartServer.sh

sudo /etc/init.d/dnsmasq stop
sudo killall named
sudo /etc/init.d/dnsmasq start
cd ~/The-Three-Little-Pigs-Siri-Proxy && ./siriproxy-restarter

and accept saving the file as StartServer.sh
to exit the editor

Chmod +x StartServer.sh

Start the server
Sh StartServer.sh

Hopefully, the server will start without error. Go to your iPhone and activate Siri and say “Test Siri Proxy”. If Siri response with, Siri Proxy is up and running. YOU DID IT!

To Control Vera
Thanks to Autotronto, I had an example for modifying the siriproxy-example Ruby file to control Vera THANKS!

Follow his code:
[url=http://forum.micasaverde.com/index.php/topic,8199.msg97472.html#msg97472]http://forum.micasaverde.com/index.php/topic,8199.msg97472.html#msg97472[/url]

After editing the code you have to compile it.
cd The-Little-Pigs-Siri-Proxy/plugins
siriproxy update .

Then start the server and see if you can control your Vera

Notes:
Watch the screen when you activate Siri. You should see a bunch of text when you press the button to activate Siri. If not, Your DNS is not working. Search the web for dnsmasq for debugging.

If you are not talking with Vera, Ping Vera from the sever and verify you are seeing it:
Ping xxx.xxx.xxx.xxx

If you get the server running and want to learn more about Ruby. Great Site:
[url=http://www.ruby-lang.org/en/documentation/]http://www.ruby-lang.org/en/documentation/[/url]

The next step is to create a plug-in. I know some of you are far ahead of me… so I hope you’ll share when you get it done.

I was planning on waiting a little while to see if anyone comes up with a Plugin for a SiriProxy Server to control Vera… But as I think about it… since everyones needs are so vaired… I was just wondering if it makes more sense to write my own. Any thoughts?

I am very interested in this. A rasberry PI would be perfect for this project.

THanks.

I have a Siri proxy server running on a Raspberry Pi which simply sends URLs to Vera to run scenes or control devices. It works very well, so I’m not sure what advantages a dedicated plug-in would have.

Yeah… Kinda finding the same thing. I’ve been able to do everything I need by just modifying the siriproxy_example.rb file.

MDoc
Looks like great directions here. Couple of questions. With the IPhone DNS set know to the proxy box, will the proxy box then forward DNS requests to the internet for non Siri translations.
Why are you forwarding Ports 443, and 53. Is this not all local to the one local network and the router does not come into play?
See discussions of “SPIRE” on other forums. Needed to keep keys valid with Apple. I see this does not come into play here. Any idea what they are talking about.
The script to start the DNS server. Does this script get run automatically from the init.d folder by default
Looking forward to setting up a Linux box again and giving this a try or using VM for it.

Thanks

@spudjr

Yes, once the Proxy Server searches for your Ruby Listen strings, if there are no matches, then the server passes the request to the Apple server the normal Siri processing. The Siri response is then passed to your phone.

Ports 443 and 53 are used by the Proxy Server I believe to pass control over to the Apple Server… Someone who knows more about the technical workings of the proxy server may be able to chime in here.

Spire is used when a jailbroken “Non-Siri” iPhone (iPhone 4) is using the proxy server to give that device Siri capability. As long as you use a Siri compatible phone to access the server every 24 hours (settable during setup) then the keys are reset and the non Siri phones will have Siri capability. I am using only an Ipnone 5.

No… the script to I show is simply like a DOS batch file and is run manually so you don’t have to key the commands each time you power up. You could run it automatically on power up though.

I curious about this… with Siri proxy setup with the Vera. Would I just tell Siri “Living Room Lights on” or “Garage Door Open”. What commands will Siri accept?

Thanks you

Siri Proxy will accept anything you put into the siriproxy_example.rb file. If it’s not in there, the request gets passed to Siri’s servers to be dealt with in the normal way.

Just an update. It appears the auto install script in no longer available from Three Little Pigs. They have fairly good directions for a manual install. Gave it a try and all worked fine until “rake install” section. figuring out the error will be for another night.

Has anyone gotten this to work lately? I have tried probably close to 10 times with several versions of Ubuntu, Xubuntu, desktop and server, TTLP, regular SiriProxy Server, etc. etc.

I just cannot seem to get it to work. It doesn’t help that I don’t really know what I’m doing, but I am great at following directions :wink:

Are you getting an error? Couple of things to make sure…Did you install the Certificate and enter proxy server IP address on your iPhone? What iPhone are you using…4, 4S,5?

I tackled this project last week. I have it running on a Raspberry Pi. It certainly wasn’t easy, but eventually I got it working. I have very little Unix experience, so that was my biggest hurdle.

Of the many set of instructions I found the following to be the most accurate (for the Raspberry Pi install).

Are you getting an error? Couple of things to make sure…Did you install the Certificate and enter proxy server IP address on your iPhone? What iPhone are you using…4, 4S,5?[/quote]

I finally got it working tonight on a VM of Ubuntu Server 12.10 using the step by step install of the Three Little Pigs. This is so awesome. Now I just need to get it working on my old desktop server instead of the VM on my laptop.

I’ve used this SiriProxy build for the raspberry pi for a couple different installs

[url=http://sourceforge.net/projects/siriproxyrpi/]http://sourceforge.net/projects/siriproxyrpi/[/url]

[quote=“cubs2b23, post:15, topic:174013”]I’ve used this SiriProxy build for the raspberry pi for a couple different installs

[url=http://sourceforge.net/projects/siriproxyrpi/]http://sourceforge.net/projects/siriproxyrpi/[/url][/quote]

I decided to pick up a Raspberry Pi instead of running a huge desktop 24/7. I used this build and it is running and responds to the test. The only problem is, I can’t find the siriproxy-example.rb file :o I don’t seem to have a ~/SiriProxy directory, but the file must be somewhere.

Edit: I found it. Its located at /usr/local/rvm/gems/ruby-2.0.0-p0/gems/siriproxy-0.5.2/plugins/siriproxy-example/lib/siriproxy-example.rb

Edit 2: Got it working.

I have SiriProxy running and can control most of my devices (on/off, lock/unlock, etc) using simple open http TargetValue= commands in the siriproxy-example.rb file.

I figured out how to associate multiple voice commands for a single action by separating the Listen_for variable with a pipe. I did this so that my wife and I (mostly the wife) don’t have to memorize the exact command required to activate a device.

example: (listen_for /Unlock Front Door|Unlock Patio|Unlock Foyer/i do).

I think I saw a video showing someone querying Siri for device status. Something like ‘Is the front door locked?’, to which Siri responded ‘The front door is locked’. Anyone have any idea if this can be accomplished using the simple methods I currently use in the siriproxy-example.rb file?

Thanks in advance for any assistance.

Sorry @knewmania, Lost track of this.

Here’s what I used to check door status: (Remember to change your IP Address and Device Number)

FRONT DOOR LOCK#####

listen_for /\bfront door (locked|unlocked)/i do |state|
response = open(“Http://YOUR_IP_ADDRESS:3480/data_request?id=variableget&DeviceNum=18&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status”)
if(response.read[0] == “1”)
say “The Front door is locked.”
else
response = ask “The front door is unlocked. Would you like me to lock it for you?”
if(response =~ /yes\b/i) #process their response
open(‘http://YOUR_IP ADDDRESS:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget&newTargetValue=1&DeviceNum=18’)
say “OK, I’ve locked the front door.”
else
say “OK. No problem!”
end
end
request_completed
end

No worries, and thank you very much for the help. I will give this a shot as soon as I get some time to tinker.

just got my model B Raspberry Pi, time to get SiriProxy up and running!