We have moved at community.getvera.com

Author Topic: Native Vera3 (maybe Vera2?) SiriProxy - What I've done  (Read 5709 times)

Offline whyter

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« on: January 13, 2012, 11:16:30 pm »
Greetings fellow Vera folk..

So I've been pretty busy the last week working on getting SiriProxy ported to Lua and running on my Vera3. I'm looking to see if there are any Lua/web developers that would be willing to help, and see if there is enough interest for me to spawn this off to a github project - what I've done, and where I could use help.

** I've got the binary plist (CFPropertyList) ported and reading binary plists, I can read the response from guzzoni.apple.com and parse it in my Lua code. I haven't completed creating the binary response, but that should be fairly quick work now.
** Vera already has dnsmasq, so that's already done
** It appears that the appropriate gzip libraries are on the Vera, altho this is untested by me
** SSL libraries seem to be there, but I created my self signed cert external to Vera, this may take a little work
** I plan on creating a new virtual host to listen on 443, calling this Lua code

What I haven't even considered yet it a way to create phrases for this Siri proxy to listen for - I'd like to make it database/table driven, most likely some in memory Lua table... This I'd like some help with. I would like to extend the Vera web interface to allow easy creation of "listen for" phrases: Press a button "learn" - speak the text, capture the response, assign it to an action/scene

So I guess this is just an open question to anyone that is interested..
Is there anyone besides me that is interested in this
Is there anyone that has some spare cycles to help

My day job has me writing software in C, C#/.Net, and Java.. So my Lua code is crude and, well, written like I would write C# or Java - What I'm trying to say is it's UGLY currently, so don't judge :)

I'm out of town for the weekend, but feel free to email me - rob.whyte at RSA.com

Thanks,
Rob








Offline autotoronto

  • Full Member
  • ***
  • Posts: 190
  • Karma: +0/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #1 on: January 13, 2012, 11:45:29 pm »
Quote
Is there anyone besides me that is interested in this
Yes
Quote
Is there anyone that has some spare cycles to help
Yes.

Offline WB-AVL

  • Sr. Newbie
  • *
  • Posts: 37
  • Karma: +0/-0
Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #2 on: January 14, 2012, 02:06:56 pm »
Sounds like a great project.

If you think it will run on a vera 2 I would be interested in helping test.

Offline autotoronto

  • Full Member
  • ***
  • Posts: 190
  • Karma: +0/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #3 on: January 15, 2012, 09:35:55 am »
Quote
What I haven't even considered yet it a way to create phrases for this Siri proxy to listen for
Aside from extra phrases, it would make sense to be able to address the scenes and devices by their names and numbers
eg, since I already have devices called "bathroom light" and "front door lock", and a scene called "home"

"Bathroom light on"
"Front door unlock"
"Device 17 50 percent"
"Scene 19 activate"
"Home activate"

That would remove most of the need to program phrases - just choose sensible names for things.
« Last Edit: January 15, 2012, 01:22:24 pm by oTi@ »

Offline rlmalisz

  • Sr. Member
  • ****
  • Posts: 400
  • Karma: +1/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #4 on: January 15, 2012, 01:09:41 pm »
Quote
What I haven't even considered yet it a way to create phrases for this Siri proxy to listen for
Aside from extra phrases, it would make sense to be able to address the scenes and devices by their names and numbers
eg, since I already have devices called "bathroom light" and "front door lock", and a scene called "home"

"Bathroom light on"
"Front door unlock"
"Device 17 50 percent"
"Scene 19 activate"
"Home activate"

That would remove most of the need to program phrases - just choose sensible names for things.

So I don't have this running on Vera (and am unconvinced that my V2 has the HP to do the work required), but do have it working pretty well in a Ubuntu VM.  We have quite a few devices in the house, and either my speech is much more garbled than I thought, or the local processing of speech tokens is not as strong as it is at Apple's parsing servers.  So I went a slightly different way...I built a Ruby hash of the devices I want to control through Siri, with "rooms" associated with them.  So when I want to do something, I say "current room <room name>" or "inside <room name>", which sets the context for future "local" commands.  If I need to add a light, a lock, etc for an action already supported, I just add it to the hash.  This also allows me to have a simple global report-out command ("what's up" or "house summary") that queries Vera for system state and parses it and gives me back "interesting" status--locks that are unlocked, lights that are on, sensors that are tripped.  There's some other silliness in here, but it's pretty straightforward.

"config.txt" is "config.yml".  "siriproxy-vera.txt" is "siriproxy-vera.rb", renamed to protect the universe from evil file types.

--Richard
« Last Edit: January 15, 2012, 01:22:52 pm by oTi@ »

Offline whyter

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #5 on: January 18, 2012, 06:36:36 pm »
So I ran into a few snags that I wasn't even thinking about. Siri makes a unique call to the destination server in that it doesn't make a standard 'GET'/'POST' call. It makes a call named 'ACE' .. No problem I thought, I'll just patch lighty to handle an ACE call - but ran into another snag. Siri sends: 'CONTENT-LENGTH = 2000000000' (even though the data isn't that long) on every call, but the code in lighty loops while content-length-received < CONTENT-LENGTH .. In other words there's no data inspection to determine the end of the packet, so lighty never forwards the data out of the receive loop.. bummer

So that leaves me sort of back at square 1, except now I have a build environment I can build binaries and run them on my Vera3. I compiled and am now running Ruby on my Vera3. SiriProxy requires the use of the eventmachine libraries, which includes some native and ruby code to run. I'll report back if I get the regular SiriProxy running on my Vera.

Thanks,
Rob

Offline autotoronto

  • Full Member
  • ***
  • Posts: 190
  • Karma: +0/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #6 on: January 18, 2012, 06:52:17 pm »
Can you not patch that part of lighty?

Offline whyter

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #7 on: January 18, 2012, 07:03:09 pm »
I can, and I still might.. just not sure it's worth my time now that I have Ruby running on the box - There will be a lot more involved the lighty route.. then again Ruby (eventmachine) takes quite a bit of space. I'll keep updating this as I make more progress and let people know what I've done.

Thanks,
Rob

Offline parkerc

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2479
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #8 on: August 27, 2012, 03:43:33 pm »
@Whyter - just curious how you progressed with this.

As with many things on this forum, things can get a little spread out over various post, hence I was curious where people got to with the SiriProxy

Other siriproxy posts!

http://forum.micasaverde.com/index.php/topic,9144.msg81019.html#msg81019
http://forum.micasaverde.com/index.php/topic,8199.15.html

It suggests people have Siri working with Vera, and I'd love to know exactly how.

Offline cubs2b23

  • Full Member
  • ***
  • Posts: 102
  • Karma: +2/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #9 on: February 28, 2013, 12:01:34 pm »
Quote
What I haven't even considered yet it a way to create phrases for this Siri proxy to listen for
Aside from extra phrases, it would make sense to be able to address the scenes and devices by their names and numbers
eg, since I already have devices called "bathroom light" and "front door lock", and a scene called "home"

"Bathroom light on"
"Front door unlock"
"Device 17 50 percent"
"Scene 19 activate"
"Home activate"

That would remove most of the need to program phrases - just choose sensible names for things.

So I don't have this running on Vera (and am unconvinced that my V2 has the HP to do the work required), but do have it working pretty well in a Ubuntu VM.  We have quite a few devices in the house, and either my speech is much more garbled than I thought, or the local processing of speech tokens is not as strong as it is at Apple's parsing servers.  So I went a slightly different way...I built a Ruby hash of the devices I want to control through Siri, with "rooms" associated with them.  So when I want to do something, I say "current room <room name>" or "inside <room name>", which sets the context for future "local" commands.  If I need to add a light, a lock, etc for an action already supported, I just add it to the hash.  This also allows me to have a simple global report-out command ("what's up" or "house summary") that queries Vera for system state and parses it and gives me back "interesting" status--locks that are unlocked, lights that are on, sensors that are tripped.  There's some other silliness in here, but it's pretty straightforward.

"config.txt" is "config.yml".  "siriproxy-vera.txt" is "siriproxy-vera.rb", renamed to protect the universe from evil file types.

--Richard

Richard,

Should I just be able to modify my device IDs and room names in the siriproxy-vera.rb file and run?

Offline MDoc

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-3
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #10 on: February 28, 2013, 12:44:51 pm »
It suggests people have Siri working with Vera, and I'd love to know exactly how.

Parkerc... Not sure of your question was if we having it running ON Vera or simply using Siri WITH Vera.    Here is my post to set the server up and get it running

http://forum.micasaverde.com/index.php/topic,13324.msg99059.html#msg99059

I also went the route of running a proxy server on an old laptop running Linux and it's working great.  I'm controlling scenes and devices. I too struggle some with recognition... so I like Richards Idea of a primary prompt then a secondary command.  I'm already doing things like "Is the front door locked"...Siri "No.  Would you like me to lick it for you?"...."Yes Please"... Vera locks the door.

I'm not really motivated to move it to my Vera box.   If I hadn't already put it on the laptop... I might be tempted to pay the $35.00 and put in on a Rasberry Pi though... just cause I want a reason to get one:)

cubs2b23 - Yes... with rlmalisz's help,  I basiclly started with the siriproxy_example.rb file and put in command to control my devices.  Should work by changing the device spicific info. 

Offline cubs2b23

  • Full Member
  • ***
  • Posts: 102
  • Karma: +2/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #11 on: February 28, 2013, 01:40:08 pm »
I'm not really motivated to move it to my Vera box.   If I hadn't already put it on the laptop... I might be tempted to pay the $35.00 and put in on a Rasberry Pi though... just cause I want a reason to get one:)

cubs2b23 - Yes... with rlmalisz's help,  I basiclly started with the siriproxy_example.rb file and put in command to control my devices.  Should work by changing the device spicific info.

Cool. I'll give it a shot. His file looks pretty complicated so hopefully I can pare it down to what applies to me.  So far I've only run a few simple on/off/dim commands and I've gotten the IPCams plugin to work with my two Foscams.

I've been running this of the Raspberry Pi with no issues so far.

Offline cubs2b23

  • Full Member
  • ***
  • Posts: 102
  • Karma: +2/-0
Re: Native Vera3 (maybe Vera2?) SiriProxy - What I've done
« Reply #12 on: March 03, 2013, 06:35:02 pm »
MDoc or rlmalisz,

Is there a simple get_status I can do based on a single device id?  I know there's one for getting the status of the whole house but for some scenes I'd just like to get the state of a single sensor or light.

Thanks again. This has been hugely helpful!!