Siriproxy即使在插件识别并对请求执行操作后也会向Apple发送请求

时间:2013-05-30 12:31:17

标签: ruby rvm siri

我使用Elvis模仿者的形象在Raspbery pi上运行Siriproxy。我修改了示例插件以将请求发送到家庭自动化的web服务,但是我的一些请求被发送到两者我的webservice和Guzzoni,所以例如我激活Siri并说“晚安”:

预期结果:

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.

实际结果:

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

与'晚安'命令

匹配的常规rexpression
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

此方法将请求发送到包装zwave控制器的Web服务。

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服务日志(部分)

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控制台消息

[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

0 个答案:

没有答案