Siri: Open my garage door..


218 posts   Page 1 of 9   1, 2, 3, 4, 5 ... 9
by DarkTherapy » 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/how-to-install-siri-proxy-tutorial-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 root@192.168.1.74 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
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by liz » 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.
--
Head of Comms, Raspberry Pi Foundation
User avatar
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 4141
Joined: Thu Jul 28, 2011 7:22 pm
by DarkTherapy » 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.
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by Paul Webster » Sun Dec 09, 2012 5:51 pm
Next challenge - "Siri, make space in the garage for my car"
User avatar
Posts: 436
Joined: Sat Jul 30, 2011 4:49 am
Location: London, UK
by DarkTherapy » 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)
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by texy » 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
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2449
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by Schorschi » 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?
Posts: 121
Joined: Thu Nov 22, 2012 9:38 pm
by DarkTherapy » 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.
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by rurwin » 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
User avatar
Forum Moderator
Forum Moderator
Posts: 2933
Joined: Mon Jan 09, 2012 3:16 pm
by DarkTherapy » 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
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by texy » Mon Dec 10, 2012 8:51 pm
Siriproxy is up and running!

Now to make it do something useful !!

Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2449
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by DarkTherapy » 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)
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by Montekuri » 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.
User avatar
Posts: 425
Joined: Thu Sep 22, 2011 6:26 pm
by aframe » 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!!!
Posts: 43
Joined: Tue Oct 30, 2012 10:03 am
by DarkTherapy » 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!
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by aframe » Tue Dec 11, 2012 6:36 pm
DarkTherapy wrote:didnt think it would be that popular!


FAIL!! :)
Posts: 43
Joined: Tue Oct 30, 2012 10:03 am
by texy » 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.
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2449
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by DarkTherapy » Tue Dec 11, 2012 8:45 pm
Try "turn the other LED on.." lol
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by texy » 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
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2449
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by DarkTherapy » 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.
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by texy » Tue Dec 11, 2012 9:27 pm
...make that your next project ;)
Thanks again for showing us all this fun pi project.
Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2449
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by DarkTherapy » 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)
Posts: 69
Joined: Mon Aug 20, 2012 8:14 am
by joshftx » 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
Posts: 10
Joined: Sun Dec 02, 2012 3:29 pm
by bJacoG » 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?
Posts: 2
Joined: Sat Nov 17, 2012 10:26 am
by Levaillant » Wed Dec 12, 2012 9:45 am
Just AWESOME! Nice job
Posts: 18
Joined: Wed Sep 26, 2012 7:10 am
Location: France, Paris