"SiriProxy is up and running!" - ON my Vera3

Whew - what an exercise in patience… I got Ruby, SiriProxy, and all the associated libraries installed and running on the Vera - and as a bonus it actually works! It is a serious hack-job at the moment, with gems mixed with other libraries, no proper library paths set up for Ruby, things pretty much all over the place, but it works.

I had to hack quite a few things to get it to compile under the openwrt buildroot, and I know the shared libraries are currently bloated, but here’s the low down on space used:

root@MiOS_30001573:~# du -sh SiriProxy/
71.0K SiriProxy/

AND the big one

root@MiOS_30001573:/usr/lib# du -sh ruby/
9.6M ruby/

I will say this… With debug level turned up and spitting out data to the screen, it is noticeably slower than running on my virtual machine, as expected. But it is fast enough to process my requests and turn stuff on and off.

I will work on cleaning this up, and make it available for anyone that wants it… Although I imagine that this pretty much voids any sort of warranty on the device??

Questions? Comments?

Thanks,
Rob

Nice work. :slight_smile:

That’s awesome!

I’m just curious - why is Ruby a sensible choice? I know the original code was written in Ruby and there’s no reason why anyone should rewrite it but is its structure particularly appropriate for this task such that it was chosen in the first place?

I’m not sure why the original author chose Ruby - but I can make some assumptions after spending so much time getting it working on this platform. It uses a few libraries that are very well suited for how SiriProxy works.

iPhone sends a header as follows:
[Header - iPhone] ACE /ace HTTP/1.0
[Header - iPhone] Host: guzzoni.apple.com
[Header - iPhone] User-Agent: Assistant(iPhone/iPhone4,1; iPhone OS/5.0.1/9A405) Ace/1.0
[Header - iPhone] Content-Length: 2000000000

Couple things to note there that make this awkward for a standard HTTP server.

  1. The HTTP method (or verb) is ‘ACE’ - This is not the standard ‘GET’, 'POST, ‘HEAD’ …
  2. The Content-Length is always set to 2000000000

These 2 pieces could be hacked into lighttpd, and I did in fact add an ‘ACE’ method to lighttpd and get it up and running. What I didn’t do was add a new method handler and chose to try to use the ‘POST’ handler, which proved to be impossible because ‘POST’ handler relies on the content-length to know how much data to read. (In typing this response just now I realize that I should have tried to use the ‘GET’ handler, because ‘GET’ will look for a blank line \r\n, and ignore content-length - although the W3C standards say something about … ‘GET’ “SHOULD NOT have the significance of taking an action other than retrieval”… But since it was a hack only, that probably would have worked.

So next SiriProxy establishes a SSL connection to guzzoni.apple.com and forwards on the packet it received from the iPhone
Retrieves a response - and this is where the “magic” happens

Unzip the data
Process the header to find out where the binary packed plist is
Unpack the binary data into a CFPropertyList class that can easily be managed and find data in
Locate the “Text =” strings to determine what the user spoke into the iPhone
Look up the text locally to see if it matches something we want to act on - if not return the packet from apple to iPhone
Create the response text, send it back to the iPhone
And finally execute any external commands

The parts in RED are what are easily done with existing Ruby libraries. I ported CFPropertyList to Lua, but only got thru unpacking the data, didn’t finish re-packing to send responses. I stopped because I felt like if I was going to be doing that much hacking anyway, I might as well just get Ruby running on the device and be done with it.

Hope that long winded answer made some sense.

Rob

It does, very much - thanks.

Which is the slow part?

The slow part turns out to only be with debug level turned up > 5 … I guess it’s all the print statements and outputting the debug info. With debug level == 1, it appears to me to run as fast on the Vera as on my virtual Ubuntu install.

Rob

What are you thoughts on integrating it with the Vera UI, scenes, etc?
I wonder if you could parse the Vera userdata file in Ruby - that would give you instant access to scenes and device names.

No need to parse [tt]userdata[/tt]:

[tt]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#variable:_devices[/tt]
[tt]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#variable:_scenes[/tt]

Remote invocation:
[s][tt]http://forum.micasaverde.com/index.php/topic,9011.msg60168.html#msg60168[/tt][/s]
[tt]http://forum.micasaverde.com/index.php/topic,8260.msg52671.html#msg52671[/tt]

… or use [tt]RunLua[/tt] to register a handler that returns the list of scenes and devices via [tt]http[/tt]:
[tt]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_register_handler[/tt] :slight_smile:

True, reading the file is a lousy idea.

There are so many interfaces into Vera that there’s no need to couple to luup at all; use one of the remote connection mechanisms like iVera uses (http://wiki.micasaverde.com/index.php/UI_Notes) to make a Siriproxy “remote interface” to Vera in Ruby. That means that you have the choice of running it either remotely or on the Vera hardware. For instance a raspberryPi unit would make a great SiriProxy server.

BTW your Remote Invocation link isn’t available to mortals.

Link added for mortals. Thanks for spotting this.

So, I’ve been playing around with this quite a bit (how cool is it when regex matching meets voice control), and I’m wondering a few things:

  1. Is anyone working on a siriproxy plugin for this?

  2. I noticed a few parallel threads on the forum about this (although I haven’t seen any new activity in the last month - maybe I missed something) - do we want to consolidate efforts into one thread

  3. Has anyone upgraded to IOS5.1? Part of me thinks that projects like siri proxy are helping apple sell iphones, but the rest of me realizes apple doesn’t like other kids breaking into their playground… I’m wondering if IOS5.1 has done anything to our ability to use siri proxy before I upgrade.

I just nudged my 4S into updating. SiriProxy works for me just as it did before.

–Richard

I got SiriProxy up on 5.1 as well. (running on a server, not Vera). Plan to add some http get requests to talk to Vera. That part is pretty easy and I’m doing that with my alarm system now. It will be killer to just say “turn on the family room ceiling fan” or “Set the thermostat to 74 degrees” or “Heat up the spa.”

Very exciting stuff, but I’m guessing SiriProxy’s days will be numbered, especially as iOS gets updated. All Apple needs to do is lock Siri to Apple’s certificate (currently it accepts the generated cert). By that time hopefully Apple will offer some sort of official extendability to Siri for iOS applications.

Until then, I can not update my phone and hopefully enjoy it for a long time though. :slight_smile:

Hi, I was just wondering how people were progressing with Siri and Vera?
Is it a match made in silicon heaven?

Hi, now that iOS 6 is oficially released, do you know if Siriproxy stills works? I’ve seen here there is some progress about it. any1 tried iOS6? · Issue #302 · jimmykane/The-Three-Little-Pigs-Siri-Proxy · GitHub

One other question, Could you post your plugin in the plugins page of the siri proxy github? Plugins · jimmykane/The-Three-Little-Pigs-Siri-Proxy Wiki · GitHub

Many thanks.

Juan

Any progress on this one? I got siriproxy working on an Ubuntu server in my home, and interfacing with Vera. Works like a charm and it is funny too! But it would be very cool to run it on Vera itself… haven’t tried yet.

I can report Siriproxy also works with iOS 6.x

Hi Guys,

I need a little help if someone is willing. I have Siri Proxy up and running on my PI and have worked out how to edit the files to include the commands I need. What I don’t know how to do it to get the PI to join my WIFI network.

I have it on the test bench at the moment hard wired and need to install it in an area without a spare hardwired connection. I was hoping to join it to my WIFI but obvioulsy need to edit a file presumably to enter my WEP and SSID details.

Anyone any ideas?

/etc/network/interfaces

#iface wlan0 static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

Wpa-ssid your_ssis_here
Wpa-psk your-password-here

Reboot pi

issue the command ifconfig and you should see wlan0 with couns in RX Bytes and TX bytes

Hope this helps