DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Siri: Open my garage door..

Sun Dec 09, 2012 12:06 pm

Hi, this is my first real Raspberry Pi project - SiriProxy running on the Raspberry Pi, along with wiringPi to access the Pi's GPIO pins and turn a relay on/off. The relay is then hooked up to my automatic garage door system. So, I have control of the door with Siri on my iPhone.

There are probably other ways to do the same thing, such as running a web server on the Pi and have that access the GPIO's etc but I basically cobbled this together for my own needs - and it works fine.

I am running the Pi as "root" for this whole setup as it just makes things easier for me and I'm using the "wheezy" distro.
Follwing the instructions here: http://www.idownloadblog.com/2011/12/09 ... ial-video/ should get SiriProxy up and running, if you do follow these instructions then swap commands 11, 12 and 13 to 12, 13, 11. Command 7 by the way will take about 90 minutes to compile on the pi!

Then install wiringPi from https://projects.drogon.net/raspberry-p ... d-install/

Once these are installed its just a case of modifying the example ruby script included with siriproxy.
Edit this file: /root/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb

Look for the lines:

Code: Select all

  listen_for /test siri proxy/i do
    say "Siriproxy is up and running!" #say something to the user!

    request_completed #always complete your request! Otherwise the phone will "spin" at the user!
  end
And add this directly under them:

Code: Select all

  listen_for /open the garage door/i do
    say "Opening the garage door.."
    request_completed
    system("gpio mode 1 out")
    system("gpio write 1 1")
    system("sleep 0.5")
    system("gpio write 1 0")
  end

  listen_for /close the garage door/i do
    say "Closing the garage door.."
    request_completed
    system("gpio mode 1 out")
    system("gpio write 1 1")
    system("sleep 0.5")
    system("gpio write 1 0")
  end
As you can see, the ruby script is basically calling "system" commands to access wiringPi. Setting a GPIO pin as an output then setting it high for half a second then low again.

You can have siri to call any command you can type in a terminal window, such as a passwordless SSH login to a remote pc to have it shut down or rebooted.

Code: Select all

  listen_for /turn off my laptop/i do
    response = ask "Are you sure you want me to shut down your laptop?"

    if(response =~ /yes/i)
      say "OK, I'll shut it down now.."
      system("ssh [email protected] shutdown -h now")
    else
      say "OK, I wont!"
    end

    request_completed
  end
You could have RasPI's in different rooms with different commands to follow, all from one siriproxy server. Note: each time you modify the example plugin you must run the "siriproxy bundle" command before restarting the server.

Anyway, here is a video of my setup.

http://youtu.be/NUJ5z76Xv5o

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5220
Joined: Thu Jul 28, 2011 7:22 pm

Re: Siri: Open my garage door..

Sun Dec 09, 2012 5:09 pm

Coming to a front page near you very soon! Than you very much for posting this - lovely bit of work.
Director of Communications, Raspberry Pi

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Sun Dec 09, 2012 5:29 pm

liz wrote:Coming to a front page near you very soon! Than you very much for posting this - lovely bit of work.
Thank you for the positive feedback Liz.

User avatar
Paul Webster
Posts: 860
Joined: Sat Jul 30, 2011 4:49 am
Location: London, UK

Re: Siri: Open my garage door..

Sun Dec 09, 2012 5:51 pm

Next challenge - "Siri, make space in the garage for my car"

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Sun Dec 09, 2012 5:54 pm

Paul Webster wrote:Next challenge - "Siri, make space in the garage for my car"
More importantly, "Siri: get me driving lessons, and a car to replace my bicycle"

:0)

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Siri: Open my garage door..

Sun Dec 09, 2012 9:34 pm

Nice project. I've got a garage door......but no garage ;)
However, it'd be pretty cool to be able to control other things via siri.
Currently compiling ruby..............

One thing i,d didn't do though is add the -k curl additional option - what effect will this have?
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Schorschi
Posts: 362
Joined: Thu Nov 22, 2012 9:38 pm

Re: Siri: Open my garage door..

Mon Dec 10, 2012 2:20 am

I got a big laugh out this idea! What a great idea. I am kind of disappointed I did not think doing it... yet. I have been focusing on doing stuff with XBMC on Pi, other than setting up one Pi device to act as my DNS/NTP/DHCP, etc. local network services, always on resource, since running a full Linux box for same is over kill, and I have never been happy with the limited services (even using DD-WRT, which is actually pretty good in its own right) on my internet rounter. I like this idea so much, I have it on the list to do it. I also want to setup a PBX, control my garden lighting, my pool system, garden sprinklers, and more over time. Some day I may even get around to doing the LED cube project (check out Youtube for the LED cube video), especially if I could weatherize it... what great idea for Christmas lighting, no?

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Mon Dec 10, 2012 6:33 am

This would be great for Christmas lights, I'll probably buy another RasPi in the new year and make a multiple relay switch box - the siriproxy pi will talk to this second pi. I forgot to add that I use SiriProxy within a "screen" session so I can SSH into the pi to start the server and it continues to run when I log out.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4257
Joined: Mon Jan 09, 2012 3:16 pm

Re: Siri: Open my garage door..

Mon Dec 10, 2012 7:32 am

Code: Select all

listen_for /open the garage door/i do
    say "I'm sorry Dave, I'm afraid I can't do that."
    request_completed
end

 listen_for /please open the garage door/i do
    say "Opening the garage door.."
    request_completed
    system("gpio mode 1 out")
    system("gpio write 1 1")
    system("sleep 0.5")
    system("gpio write 1 0")
  end

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Mon Dec 10, 2012 8:13 am

rurwin wrote:

Code: Select all

listen_for /open the garage door/i do
    say "I'm sorry Dave, I'm afraid I can't do that."
    request_completed
end

 listen_for /please open the garage door/i do
    say "Opening the garage door.."
    request_completed
    system("gpio mode 1 out")
    system("gpio write 1 1")
    system("sleep 0.5")
    system("gpio write 1 0")
  end
LOL

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Siri: Open my garage door..

Mon Dec 10, 2012 8:51 pm

Siriproxy is up and running!

Now to make it do something useful !!

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Mon Dec 10, 2012 9:07 pm

texy wrote:Siriproxy is up and running!

Now to make it do something useful !!

Texy
That's the fun part ;0)

User avatar
Montekuri
Posts: 451
Joined: Thu Sep 22, 2011 6:26 pm

Re: Siri: Open my garage door..

Tue Dec 11, 2012 4:50 pm

Paul Webster wrote:Next challenge - "Siri, make space in the garage for my car"
Siri: I'm sorry, Dave. I'm afraid I can't do that.

aframe
Posts: 43
Joined: Tue Oct 30, 2012 10:03 am

Re: Siri: Open my garage door..

Tue Dec 11, 2012 6:24 pm

That's amazing!

Gonna have to get this integrated into my stuff for sure!

How does the author manage to get it to return numbers/strings like the thermostat temperature dynamically though? Any idea?

I have some output coming from a python script that I'd like to feed back to the user.

End of hijack - great post!!!

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Tue Dec 11, 2012 6:31 pm

I'm not to sure to be honest, I guess it's possible in ruby/python.. I just knocked this together for the fun of it, didnt think it would be that popular!

aframe
Posts: 43
Joined: Tue Oct 30, 2012 10:03 am

Re: Siri: Open my garage door..

Tue Dec 11, 2012 6:36 pm

DarkTherapy wrote:didnt think it would be that popular!
FAIL!! :)

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Siri: Open my garage door..

Tue Dec 11, 2012 8:27 pm

Turing a green LED on and off : no problem.
But siri doesn't understand me when I say 'red on' - keeps thinking I,m saying 'read', not red :roll:

Texy
Last edited by texy on Tue Dec 11, 2012 8:47 pm, edited 1 time in total.
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Tue Dec 11, 2012 8:45 pm

Try "turn the other LED on.." lol

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Siri: Open my garage door..

Tue Dec 11, 2012 9:04 pm

One assumes that when you are on your drive, your iphone is within wifi range. Pushing the boat out here, but how can this be used over t'net,
ie if the iphone is not on the same local network?

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Tue Dec 11, 2012 9:20 pm

It's possible to setup a VPN that connects your phone to your home network, I'm not sure if the pi can handle that at the same time as running the Siri proxy.

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Siri: Open my garage door..

Tue Dec 11, 2012 9:27 pm

...make that your next project ;)
Thanks again for showing us all this fun pi project.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

DarkTherapy
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am

Re: Siri: Open my garage door..

Tue Dec 11, 2012 10:38 pm

All credit should go to Pete - https://github.com/plamoni/SiriProxy

He created SiriProxy, I simply modified some of the code for my own use :0)

joshftx
Posts: 10
Joined: Sun Dec 02, 2012 3:29 pm

Re: Siri: Open my garage door..

Tue Dec 11, 2012 11:21 pm

Great work. There's an alternative to Siri proxy called Siri server core that i played with some time ago. Its written in Python and works like a charm with lots of great plugins. I thought about doing a project similar to this myself but never got around to it. https://github.com/Eichhoernchen/SiriServerCore

bJacoG
Posts: 2
Joined: Sat Nov 17, 2012 10:26 am

Re: Siri: Open my garage door..

Wed Dec 12, 2012 6:29 am

This might be a dumb question, but a bit of googling got me nowhere.

Is there an android alternative to siriProxy? That works with the android voice actions perhaps?

Levaillant
Posts: 18
Joined: Wed Sep 26, 2012 7:10 am
Location: France, Paris

Re: Siri: Open my garage door..

Wed Dec 12, 2012 9:45 am

Just AWESOME! Nice job

Return to “General discussion”