NeatoRobotics / neato-sdk-js

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

Error 'ui_alert_invalid' #4

Closed jury89 closed 7 years ago

jury89 commented 7 years ago

Hi,

i'm having an issue both using the REST API and the JS SDK. Every time i try to call one of the API from Nucleo, in the response i get the error ui_alert_invalid.

So for example if I call https://nucleo.neatocloud.com:4443/vendors/neato/robots/{serial}/messages i get back this response

{
  "version": 1,
  "reqId": "77",
  "result": "ok",
  "error": "ui_alert_invalid",
  "data": {},
  "state": 1,
  "action": 0,
  // ...
  "meta": {
    "modelName": "BotVacConnected",
    "firmware": "2.2.0"
  }
}

and some API are returning even less informations, such as https://nucleo.neatocloud.com:4443/vendors/neato/robots/{serial}/messages which return just this response:

{
  "version": 1,
  "reqId": "77",
  "result": "ko",
  "error": "ui_alert_invalid"
}

Does anyone know why ui_alert_invalid is triggered? I couldn't find any documentation about it online.

Thanks Jury

marcouberti commented 7 years ago

Hi Jury, unfortunately the "ui_alert_invalid" is triggered by the robot even if all it's OK. I'm sorry about that.

We need to differentiate between two scenario here:

Execute an action

So my suggestion is to check only the "result" property. If the result == "ok" the robot accepted the command with success, otherwise the robot refuse to execute the command (result = "ko" or more specific result code like "not_on_charge_base").

Get robot state

If you are trying to get the robot state, the robot can reply with result = "ok" because is able to return to you it's state, but the current robot state is an error state, for example "I'm stuck, please clean my path", so you need to check the "state" property and if it is an error state (4) you can now check the "error" property for details about the error. You can find the list of all the error codes here.

Hope this helps you. Best, Marco