Siri + Raspberry Pi + Z-Wave, your DIY Voice Pod
Siri, Raspberry Pi and Z-Wave
In my previous post, I’ve introduced consumer product, Voice Pod: a voice control device which you can place anywhere in your home to compliment your home automation. However, that is only for expensive Control4 system. Is there any hope for DIY enthusiasts? The answer is yes!
In this article, I’m actually guiding you on how you can create such a device, assuming you are already using Z-Wave based home automation. For not so technical readers, you can simply watch the videos of the end product below. For geeks, please read on. It is gonna be a long article.
I had previously managed to create a SiriProxy server on my Macbook so that I make voice commands with Siri as shown above. However, it doesn’t make sense to turn on my Macbook 24 hrs a day. I need a tiny computer to take the place of the Macbook and I have only S$50.
The answer is Raspberry Pi, a USD$35 barebones computer which can be on 24 hrs a day with minimal power. With a little help and advice from this guru (Elvis Impersonator) who create the following video, I’ve managed to move my codes to Raspberry Pi.
The How To
Now this part is for geeks. So how can you do this? We know Siri works only when there is an Internet connection. Basically you are trying to trick Siri into believing that it is talking an Apple server. Thus you are making the SiriProxy on the Raspberry Pi to disguise as an Apple server. Once the disguise is done, when you make a command through Siri, the Siri Proxy will forward the command to Apple server, get the response and reply to Siri while pretending to be an Apple server. However, if its a home automation command like “Turn on the lights”, the Siri Proxy will simply perform the command, response to Siri as if it is a legit response from Apple server.
This means you can make Siri respond to anything in anyway you want. And yes, you do not need to jailbreak your iPhone to trick Siri.
I’m assuming you are:
- Using Mac
- Have an iPhone4s or iPhone5 (No jail break required)
- Using Z-Wave Home Automation with Vera
You will require the following:
- A Raspberry Pi
- An empty SD Card in FAT32 format (and a USB reader)
- A copy of Raspberry Pi SD image with SiriProxy installed (get here)
- A never say die attitude (get here….. ok i’m kidding)
- Open Terminal and go to the directory that you have downloaded the SD card image
- Plugin your SD card reader with the SD card
- Follow the instruction stated here to copy the image onto the SD card. The copy process will run for a long time (I waited around 1hr). To check the progress you can press Option + T.
- Once done, insert the SD card into the Raspberry Pi, connect to a HDMI display, LAN cable, keyboard and connect the power to start the device.
- Login with user id root and password siriproxy
- You may want to find out the IP address assigned to your Raspberry Pi. You may want to reserve this IP address to Raspberry Pi on your router
- Setup the DNS (this is to make Siri believe Raspberry Pi is apple server) by using the following command vi /etc/dnsmasq.conf
- Find this line address=/guzzoni.apple.com/###.###.###.###
- Replace ###.###.###.### with the IP address of your Raspberry Pi and save the changes with the following command :wq
- Restart the DNS by using the following command sh /etc/init.d/dnsmasq restart
- The next step is to generate the certificate to be installed on your iPhone and to point your iPhone DNS to Raspberry Pi.
- Generate the certificate by using the following command siriproxy gencerts
- Copy the certificate to your proxy server directory cp /root/.siriproxy/ca.pem /root/SiriProxy
- Copy the file out of Raspberry Pi and email the certificate to your iPhone. You may access the file system on Raspberry Pi over samba with same user id and password.
- Tab the email attachment on your iPhone to install the certificate.
- Goto the wifi settings on your iPhone and change the DNS IP address to the IP address of your Raspberry Pi.
- On your Raspberry Pi, goto the the SiriProxy directory it should already have a sample SiriProxy plugin installed.
- Rebuild and run the SiriProxy server with the siriproxy update .followed by siriproxy server
- Activate Siri on your iPhone and say “Test SiriProxy” it should reply “SiriProxy up and running”
- Once you made sure that SiriProxy is working fine, wse Control + T to stop the SiriProxy. Siri Proxy is built on Ruby and this is the part where I included my own Ruby codes.
- Edit the Ruby code in /SiriProxy/plugins/siriproxy-example/siriproxy-example.rb with your custom codes (My Ruby codes can be found here for reference)
- Edit the dependancy file in /SiriProxy/plugins/siriproxy-example/siriproxy-example.gemspec by including a line before the end with s.add_runtime_dependency “httparty”
- Install the dependency with the command gem install httparty
- Rebuild and restart the server with siriproxy update . and siriproxy server
- Make your custom voice command to Siri and enjoy!