rand256/valetudo

self is not defined in Vacuum.prototype.setLabStatus

garrichello opened this issue · 0 comments

Describe the bug
Valetudo RE v,0.10.2.
ReferenceError: self is not defined
at Vacuum.setLabStatus (/snapshot/valetudo/lib/miio/Vacuum.js:767:2)
Error is due to the fact that the 'self' variable is not defined in the function setLabStatus.

How to Reproduce
Steps to reproduce the behavior:

  1. Go to 'System settings'
  2. Enable 'Persistent data ("lab mode")'
  3. Click 'Save'
  4. See error

Expected behavior
No error, Persistent data mode is enabled.

Full error stack
ReferenceError: self is not defined
at invokeCallback (/snapshot/valetudo/node_modules/raw-body/index.js:224:16)
at /snapshot/valetudo/node_modules/body-parser/lib/read.js:130:5
at next (/snapshot/valetudo/node_modules/express/lib/router/index.js:275:10)
at Function.process_params (/snapshot/valetudo/node_modules/express/lib/router/index.js:335:12)
at /snapshot/valetudo/node_modules/express/lib/router/index.js:284:7
at trim_prefix (/snapshot/valetudo/node_modules/express/lib/router/index.js:317:13)
at Layer.handle [as handle_request] (/snapshot/valetudo/node_modules/express/lib/router/layer.js:95:5)
at /snapshot/valetudo/node_modules/express-dynamic-middleware/lib/index.js:42:19
at Object.eachLimit (/snapshot/valetudo/node_modules/async/dist/async.js:3172:5)
at eachOf (/snapshot/valetudo/node_modules/async/dist/async.js:1117:5)
at eachOfArrayLike (/snapshot/valetudo/node_modules/async/dist/async.js:1057:9)
at /snapshot/valetudo/node_modules/async/dist/async.js:473:16
at /snapshot/valetudo/node_modules/express-dynamic-middleware/lib/index.js:49:17
at next (/snapshot/valetudo/node_modules/express/lib/router/index.js:275:10)
at Function.process_params (/snapshot/valetudo/node_modules/express/lib/router/index.js:335:12)
at /snapshot/valetudo/node_modules/express/lib/router/index.js:281:22
at Layer.handle [as handle_request] (/snapshot/valetudo/node_modules/express/lib/router/layer.js:95:5)
at Route.dispatch (/snapshot/valetudo/node_modules/express/lib/router/route.js:112:3)
at next (/snapshot/valetudo/node_modules/express/lib/router/route.js:137:13)
at Layer.handle [as handle_request] (/snapshot/valetudo/node_modules/express/lib/router/layer.js:95:5)
at /snapshot/valetudo/lib/webserver/WebServer.js:771:16
at Vacuum.setLabStatus (/snapshot/valetudo/lib/miio/Vacuum.js:767:2)

How to fix
Add:
const self = this;
in the beggining of the setLabStatus function.

Vacuum Model: Roborock S5

Valetudo Version:0.10.2

User-Agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75

Additional context

It seems the error appeared after the last update. :)