NeatoRobotics / neato-sdk-js

Neato Javascript SDK.
MIT License
42 stars 23 forks source link

Error "Could not find robot_serial for specified vendor_name" #8

Closed wshagcl closed 5 years ago

wshagcl commented 5 years ago

-> run the demo -> login with neato -> js error : [POST https://nucleo.neatocloud.com:4443/vendors/neato/robots/{:robot_serial}/messages 404 (Not Found)] form data: [{"reqId":"1","cmd":"getRobotState"}] response: {"message":"Could not find robot_serial for specified vendor_name"}

please help ,thanks!

marcouberti commented 5 years ago

Hi, is your robot effectively offline? Can you see it online from the official Neato app?

Best, Marco

wshagcl commented 5 years ago

is not offline,the robot is online from the official Neato app

marcouberti commented 5 years ago

Is the {:robot_serial} placeholder filled?

wshagcl commented 5 years ago

yes

marcouberti commented 5 years ago

You're running our demo on our server (this one: https://developers.neatorobotics.com/demo/sdk-js) or you are trying to run it on your PC?

Btw If the robot is connected and you can see it in the official Neato application, then you have an error in your signature.

Working code can be found at: https://github.com/NeatoRobotics/neato-sdk-js/blob/0.9.0/src/robot.js#L50

wshagcl commented 5 years ago

Thank you. I'll go back and look at it.

i‘am trying by my code code: https://github.com/wshagcl/wshagcl.github.io server: https://wshagcl.github.io

wshagcl commented 5 years ago

The problem has been solved. URL is wrong.

https://nucleo.neatocloud.com:4443/vendors/neato/robots/{:robot_serial}/messages --> https://ap-nucleo.neatocloud.com:4443/vendors/neato/robots/{:robot_serial}/messages

marcouberti commented 5 years ago

This is because you are a chinese user... sorry I didn't realize that. The first one is the url for the rest of the world users the second one for chinese users. We'll update the doc soon. Thank you for reporting.

wshagcl commented 5 years ago

Thanks for your help!

avanshee commented 5 years ago

Hi @marcouberti I am facing the same issue. I am using the official app, the robot is online, and have done the best possible background check regarding it. Although i could control the robot programmatically with the unofficial API https://github.com/kangguru/botvac but i would like to do it from the postman itself since integration of my robot with other application will be easier. Please suggest some solution

marcouberti commented 5 years ago

Hi @avanshee, if you are using Postman, are you filling also the request HTTP headers? Because you need to do that in order to have a valid request. I know you can manually add headers in Postman, but I don't know if you can do that dynamically. The headers signature use the date, so it is not a fixed string...

jearbot commented 4 years ago

Hi @marcouberti, I am facing a similar issue here as well. Here is my code snippet.

robot_serial = RunNeatoJob::SERIAL
date = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S GMT")
body = '{"reqId":"77", "cmd":"getRobotState"}'
robot_secret_key = RunNeatoJob::SECRET
string_to_sign = "#{robot_serial.downcase}\n#{date}\n#{body}"
token = OpenSSL::HMAC.hexdigest('sha256', robot_secret_key, string_to_sign)

response = HTTParty.post("https://nucleo.neatocloud.com:4443/vendors/neato/robots/#{RunNeatoJob::SERIAL}/messages",
  :body => { 
    :data =>  '{"reqId":"77", "cmd":"startCleaning", "params":{"category":2,"mode":1,"modifier":1}}'
  }.to_json,

  :headers => {
    "Accept":"application/vnd.neato.nucleo.v1",
    "X-Date": Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S GMT"),
    "Authorization": "NEATOAPP " + token,
  }
)

returns => {"message"=>"Could not find robot_serial for specified vendor_name"}

Any help would be amazing! Thanks!

larscom commented 3 years ago

any updates on this? it looks broken