SmartApp Latency

It is a relatively simple webpage. It makes a javascript request to an api endpoint when the user clicks a toggle. My app transactions are very fast. Usually 0.1 or 0.2 ms. Then it hits the smartthings server and takes 5+ seconds.

Started PATCH "/things/11" for 192.168.1.211 at 2014-10-25 12:50:05 -0500
Processing by ThingsController#update as JS
  Parameters: {"utf8"=>"✓", "thing"=>{"switch_value"=>"on", "dimmer_value"=>"100"}, "id"=>"11"}
  User Load (0.2ms)  SELECT  `users`.* FROM `users`  WHERE `users`.`id` = 1  ORDER BY `users`.`id` ASC LIMIT 1
  User Load (0.1ms)  SELECT  `users`.* FROM `users`  WHERE `users`.`id` = 1 LIMIT 1
  Thing Load (0.1ms)  SELECT  `things`.* FROM `things`  WHERE `things`.`user_id` = 1 AND `things`.`id` = 11 LIMIT 1
  Service Load (0.1ms)  SELECT  `services`.* FROM `services`  WHERE `services`.`user_id` = 1 AND `services`.`provider` = 'smartthings' LIMIT 1
http://graph.api.smartthings.com/api/smartapps/installations/001834a7-316d-4e64-ad38-b577ee4f7f3f/switches/XXXXXXXXXXXX/level/100?access_token=XXXXXXXXXXXXXXX
  Rendered things/update.js.erb (0.0ms)
Completed 200 OK in 5831ms (Views: 6.9ms | ActiveRecord: 0.5ms)