onfoot / homebridge-valetudo-xiaomi-vacuum

A Homebridge plugin for Xiaomi/Roborock vacuum cleaners running Valetudo
MIT License
31 stars 9 forks source link

Error parsing current status info: SyntaxError: Unexpected token < in JSON at position 0 #14

Closed holypetrus closed 3 years ago

holypetrus commented 3 years ago

Hello,

unfortunately the plugin returns the following error for my s50 robot with valetudo: Error parsing current status info: SyntaxError: Unexpected token < in JSON at position 0

I think it is because I use rand256 customized Valetudo-version. https://github.com/rand256/valetudo Can somebody help my to get rid of that error? I guess I have to change something in the plugin, because there seems to be a difference in the "current status"?

Thank you!

Hypfer commented 3 years ago

https://github.com/onfoot/homebridge-valetudo-xiaomi-vacuum/issues/13#issuecomment-707796377

holypetrus commented 3 years ago

Thank you! Even if I’m not sure what’s causing the problem :)

hankipanky commented 3 years ago

Valetudo RE seems to have different endpoints. /api/state does not exist:

$ curl -s -v -H "Accept: text/json" http://192.168.75.7/api/state
*   Trying 192.168.75.7...
* TCP_NODELAY set
* Connected to 192.168.75.7 (192.168.75.7) port 80 (#0)
> GET /api/state HTTP/1.1
> Host: 192.168.75.7
> User-Agent: curl/7.64.1
> Accept: text/json
> 
< HTTP/1.1 404 Not Found
< X-Powered-By: Express
< Content-Security-Policy: default-src 'none'
< X-Content-Type-Options: nosniff
< Content-Type: text/html; charset=utf-8
< Content-Length: 148
< Vary: Accept-Encoding
< Date: Sun, 07 Feb 2021 09:52:05 GMT
< Connection: keep-alive
< 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /api/state</pre>
</body>
</html>

There is /api/current_status though.

onfoot commented 3 years ago

Once you enable 'legacy-mode' in the new version 0.1.5 of this plugin, you can use Valetudo RE or an old version of The True Valetudo, @holypetrus .

Shout if there are any issues!