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.

The Videos

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:

  1. Using Mac
  2. Have an iPhone4s or iPhone5 (No jail break required)
  3. Using Z-Wave Home Automation with Vera

You will require the following:

  1. A Raspberry Pi
  2. An empty SD Card in FAT32 format (and a USB reader)
  3. A copy of Raspberry Pi SD image with SiriProxy installed (get here)
  4. A never say die attitude (get here….. ok i’m kidding)
Steps:
  1. Open Terminal and go to the directory that you have downloaded the SD card image
  2. Plugin your SD card reader with the SD card
  3. 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.
  4. 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.
  5. Login with user id root and password siriproxy
  6. 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
  7. Setup the DNS (this is to make Siri believe Raspberry Pi is apple server) by using the following command vi /etc/dnsmasq.conf
  8. Find this line address=/guzzoni.apple.com/###.###.###.###
  9. Replace ###.###.###.### with the IP address of your Raspberry Pi and save the changes with the following command :wq
  10. Restart the DNS by using the following command sh /etc/init.d/dnsmasq restart
  11. The next step is to generate the certificate to be installed on your iPhone and to point your iPhone DNS to Raspberry Pi.
  12. Generate the certificate by using the following command siriproxy gencerts
  13. Copy the certificate to your proxy server directory cp /root/.siriproxy/ca.pem /root/SiriProxy
  14. 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.
  15. Tab the email attachment on your iPhone to install the certificate.
  16. Goto the wifi settings on your iPhone and change the DNS IP address to the IP address of your Raspberry Pi.
  17. On your Raspberry Pi, goto the the SiriProxy directory it should already have a sample SiriProxy plugin installed.
  18. Rebuild and run the SiriProxy server with the siriproxy update .followed by siriproxy server
  19. Activate Siri on your iPhone and say “Test SiriProxy” it should reply “SiriProxy up and running”
  20. 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.
  21. 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)
  22. 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”
  23. Install the dependency with the command gem install httparty
  24. Rebuild and restart the server with siriproxy update . and siriproxy server
  25. Make your custom voice command to Siri and enjoy!
I’ve not gone into details on the coding for the custom codes but I hope my code sample can give you a rough idea. Pardon the mess as I have not cleaned up the codes and there are still quite alot of hardcoding here and there.
Domotics

 

Advertisements

5 Replies to “Siri + Raspberry Pi + Z-Wave, your DIY Voice Pod”

  1. Before vi /etc/dnsmasq.conf need to install dnsmasq package

    install DNSMASQ

    apt-get install dnsmasq
    Add address=/guzzoni.apple.com/###.###.###.### to the /etc/dnsmasq.conf
    sh /etc/init.d/dnsmasq restart

    Like

    1. Hi,

      The DNSmasq is already installed in the SD card image. Thus do not need any additional installation step.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.