1

I have Siriproxy running on a Raspbery pi using Elvis impersonator's image. I modified the example plugin to send request to a webservice for home automation, however some of my requests are being sent to both my webservice and Guzzoni, so for example I activate Siri and say "good night":

Expected result:

Siri responds : "Good night Wayne, sweet dreams"
Lights go out, thermostat downstairs is set to econ and thermostat upstairs set to comfort.
Siri tells me the thermostat statuses.

Actual result:

Siri responds : "Good night, Wayne"
Lights go out, thermostat downstairs is set to econ and thermostat upstairs set to comfort.

regular rexpression that matches the 'good night' command

listen_for /(good night|I'm going to bed|I am going to bed)/i do 
   say "Good night Wayne, sweet dreams"
   send_to_rosie('good night')
   request_completed #always complete your request! Otherwise the phone will "spin" at the user!
end

This method send the requests to the web service that wraps the zwave controller.

def send_to_rosie(r)
  say "Working"
  result = RestClient.get 'http://url:6005/RosieRestServices/SiriClient', {:params => {:From => 'garfield', 'Body' => r}} rescue nil
  data = JSON.parse(result) rescue nil
  if (data["Say"] != '')
    response = ask data["Say"]
    result = RestClient.get 'http://url:6005/RosieRestServices/SiriClient', {:params => {:From => 'garfield', 'Body' => response}} rescue nil
    data = JSON.parse(result) rescue nil
    say data["Sms"]
  else
    say data["Sms"]
  end
end

Web service logs (partial)

5/28/2013 11:29:19 PM : 11:29:19 PM Received request: good night from garfield :Verbose
5/28/2013 11:29:19 PM : It has been 2 hours 26 minutes and 34 seconds since last request :Verbose
5/28/2013 11:29:19 PM : Requerying :Verbose
5/28/2013 11:30:06 PM : 11:30:06 PM Returning  response Unable to retrieve Downstairs Thermostat information The Upstairs Thermostat is set to comfort(81), is idle and the temp. is 87 :Verbose
5/28/2013 11:32:45 PM : Starting the stopwatch :Verbose

Siriproxy console messages

[Info - Plugin Manager] Say:  Good night Wayne, sweet dreams
[Info - Forwarding object to iPhone] Addviews
[Info - Plugin Manager] Say: Unable to retrieve Downstairs Thermostat information The Upstairs Thermostat is set to comfort(81), is idle and the temp. is 87
[Info - Forwarding object to iPhone] Addviews
[Info - Plugin Manager] Sending Request Completed
[Info - Forwarding object to iPhone] RequestCompleted
[Info - Dropping Object from Guzzoni] GetNavigationStatus
[Info - Dropping Object from Guzzoni] GetNavigationStatus
[Info - Dropping Object from Guzzoni] Addviews
[Info - Plugin Manager] Plugins loaded: Example, Rosie, XBMC
[Info - Plugin Manager] Plugins loaded: Example, Rosie, XBMC
[Info - Plugin Manager] Plugins loaded: Example, Rosie, XBMC
[Info - iPhone] SSL completed for iPhone
lib(finalizer)]: the stream was freed prematurely
lib(finalizer)]: the stream was freed prematurely
[Info - iPhone] SSL completed for iPhone
[Info - iPhone] SSL completed for iPhone
[Info - iPhone] SSL completed for iPhone
[Info - Guzzoni] SSL completed for Guzzoni
[Info - Guzzoni] SSL completed for Guzzoni
[Info - Guzzoni] SSL completed for Guzzoni
[Info - Guzzoni] SSL completed for Guzzoni
4

0 回答 0