rand256 / valetudo

Valetudo RE - experimental vacuum software, cloud free
Apache License 2.0
671 stars 74 forks source link

Cannot read property '0' of undefined #102

Closed m4rk89 closed 4 years ago

m4rk89 commented 4 years ago

Hello,

I have the following issue when I am opening the Valetudo web inteface:

TypeError: Cannot read property '0' of undefined
    at /snapshot/Valetudo/lib/miio/Vacuum.js:674:31
    at Object.resultHandler [as callback] (/snapshot/Valetudo/lib/miio/Vacuum.js:125:17)
    at Socket.<anonymous> (/snapshot/Valetudo/lib/miio/Vacuum.js:49:62)
    at Socket.emit (events.js:182:13)
    at UDP.onMessage [as onmessage] (dgram.js:673:8)
Loading configuration file: /mnt/data/valetudo/config.json
Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053
Webserver running on port 80
Connected successfully to mqtt server

The web inteface shows "Connection error" popup.

Roborock S50, Valetudo Beta 0.4.0, 1886 version with root. The basic information such as firmware version etc. is available on the web interface but thats all.

Could you help me please?

rand256 commented 4 years ago

Roborock S50, Valetudo Beta 0.4.0 Could you help me please?

Are you serious? Current version of valetudo RE is 0.8.2.

m4rk89 commented 4 years ago

Roborock S50, Valetudo Beta 0.4.0 Could you help me please?

Are you serious? Current version of valetudo RE is 0.8.2.

Sorry, I have tried with the Valetudo RE 0.8.2 version. Could you help me please?

rand256 commented 4 years ago

Line 674 in Vacuum.js belongs to Vacuum.prototype.savePersistentData function, which doesn't run on opening the Valetudo web inteface. Thus I assume you're not using 0.8.2 version.

pidator commented 4 years ago

This sounds equal to this issue https://github.com/Hypfer/Valetudo/issues/423#issue-559125940 ... oh, wait a second ... ;-)

m4rk89 commented 4 years ago

This sounds equal to this issue Hypfer/Valetudo#423 (comment) ... oh, wait a second ... ;-)

Because I have the same issue with valetudo and valetudo RE.

m4rk89 commented 4 years ago

Line 674 in Vacuum.js belongs to Vacuum.prototype.savePersistentData function, which doesn't run on opening the Valetudo web inteface. Thus I assume you're not using 0.8.2 version.

I used the valetudo-re_0.8.2_armhf.deb version on a rooted 1886 and 1810 firmware but I am having the same issue.

Could you help me what am I doing wrong? I am always starting with the factory reset.

rand256 commented 4 years ago

Could you help me what am I doing wrong?

You are copying the wrong error message as what you've copied can't be applied to 0.8.2 or previous RE versions because of wrong line numbers. If you're sure you copied correct error message then your binary file is broken, try downloading it again or use different PC/device for downloading.

m4rk89 commented 4 years ago

Could you help me what am I doing wrong?

You are copying the wrong error message as what you've copied can't be applied to 0.8.2 or previous RE versions because of wrong line numbers. If you're sure you copied correct error message then your binary file is broken, try downloading it again or use different PC/device for downloading.

Thank you, will try tonight.

Could you tell me the PATHs for the log files which are relevant for the debugging process?

rand256 commented 4 years ago

The only path where node output launched as daemon is written is /var/log/upstart/valetudo.log.

sergshev commented 4 years ago

Hi, I have the same problem. why is this happening?

rand256 commented 4 years ago

I think it's a punishment for not reading what's written above and not providing necessary information.

sergshev commented 4 years ago

from log /var/log/upstart/valetudo.log

/snapshot/Valetudo/lib/miio/Vacuum.js:674 callback(null, res[0]) ^

TypeError: Cannot read property '0' of undefined at /snapshot/Valetudo/lib/miio/Vacuum.js:674:31 at Object.resultHandler [as callback] (/snapshot/Valetudo/lib/miio/Vacuum.js:125:17) at Socket. (/snapshot/Valetudo/lib/miio/Vacuum.js:49:62) at Socket.emit (events.js:182:13) at UDP.onMessage [as onmessage] (dgram.js:673:8) Loading configuration file: /mnt/data/valetudo/config.json Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053 Webserver running on port 80 Robot connected /snapshot/Valetudo/lib/miio/Dummycloud.js:184 Object.assign(this.connectedRobot.status, decodedResponse.msg.result[0]); ^

TypeError: Cannot read property '0' of undefined at Socket.Dummycloud.socket.on (/snapshot/Valetudo/lib/miio/Dummycloud.js:184:93) at Socket.emit (events.js:182:13) at UDP.onMessage [as onmessage] (dgram.js:673:8) Loading configuration file: /mnt/data/valetudo/config.json Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053 Webserver running on port 80 /snapshot/Valetudo/lib/miio/Vacuum.js:674 callback(null, res[0]) ^

TypeError: Cannot read property '0' of undefined at /snapshot/Valetudo/lib/miio/Vacuum.js:674:31 at Object.resultHandler [as callback] (/snapshot/Valetudo/lib/miio/Vacuum.js:125:17) at Socket. (/snapshot/Valetudo/lib/miio/Vacuum.js:49:62) at Socket.emit (events.js:182:13) at UDP.onMessage [as onmessage] (dgram.js:673:8) Loading configuration file: /mnt/data/valetudo/config.json Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053 Webserver running on port 80 Robot connected /snapshot/Valetudo/lib/miio/Dummycloud.js:184 Object.assign(this.connectedRobot.status, decodedResponse.msg.result[0]);

sergshev commented 4 years ago

firmware vacuum_valetudo_1910.pkg | 2019-12-16 10:30 | 121.8M

rand256 commented 4 years ago

You definitely didn't read posts above. From provided logs it could be concluded that you're running origin valetudo, and this is issues section for valetudo RE. So you may try installing current RE version and check whether it'll work to you. And if it won't, upload its logs.

sergshev commented 4 years ago

I read, just the same situation turns out. Ok, I will put RE, and provide Log later. Do I understand correctly log is located on this path /var/log/upstart/valetudo.log?

rand256 commented 4 years ago

Do I understand correctly log is located on this path /var/log/upstart/valetudo.log?

If you really did read, then you may have noticed that I already answered this question in exactly this topic.

But, ok, I have all the time in the world to repeat the same things over and over again: yes, /var/log/upstart/valetudo.log is the only place where valetudo writes logs if launched through init scripts. And the last proviso is required cause if you launch valetudo manually, all the output will be printed only to the console, nothing will go into files.

sergshev commented 4 years ago

I clarified, I’ll suddenly do it wrong, sorry (

As a result, installed Valetudo RE 0.8.2 (v11_001898.pkg), using XVacuum.

Here is the part of valetudo.log

Waiting for 30 sec after boot... done. 2020-02-11T13:48:18.624Z Loading configuration file: /mnt/data/valetudo/config.json 2020-02-11T13:48:18.760Z Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053 2020-02-11T13:48:18.763Z Webserver running on port 80 2020-02-11T13:48:23.708Z Got token from handshake: 3173454632384e4843526f35336e6872 2020-02-11T13:48:23.730Z Probed last id = 1001 using get_status (2 retries) /snapshot/valetudo/lib/miio/Vacuum.js:726 callback(null, res[0]) ^

TypeError: Cannot read property '0' of undefined at /snapshot/valetudo/lib/miio/Vacuum.js:726:31 at Object.resultHandler [as callback] (/snapshot/valetudo/lib/miio/Vacuum.js:150:9) at Socket. (/snapshot/valetudo/lib/miio/Vacuum.js:61:62)  at Socket.emit (events.js:210:5)  at UDP.onMessage [as onmessage] (dgram.js:861:8) Waiting for 30 sec after boot... done. 2020-02-11T13:48:57.775Z Loading configuration file: /mnt/data/valetudo/config.json 2020-02-11T13:48:57.956Z Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053 2020-02-11T13:48:57.959Z Webserver running on port 80 2020-02-11T13:49:03.050Z Probed last id = 2002 using get_timezone (3 retries) /snapshot/valetudo/lib/miio/Vacuum.js:726 callback(null, res[0]) ^

TypeError: Cannot read property '0' of undefined at /snapshot/valetudo/lib/miio/Vacuum.js:726:31 at Object.resultHandler [as callback] (/snapshot/valetudo/lib/miio/Vacuum.js:150:9) at Socket. (/snapshot/valetudo/lib/miio/Vacuum.js:61:62)  at Socket.emit (events.js:210:5)  at UDP.onMessage [as onmessage] (dgram.js:861:8) Waiting for 30 sec after boot... done. 2020-02-11T13:49:37.021Z Loading configuration file: /mnt/data/valetudo/config.json 2020-02-11T13:49:37.162Z Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053 2020-02-11T13:49:37.165Z Webserver running on port 80 2020-02-11T13:49:40.829Z Robot connected 2020-02-11T13:49:42.410Z Probed last id = 3002 using get_status (5 retries) /snapshot/valetudo/lib/miio/Vacuum.js:726 callback(null, res[0]) ^

TypeError: Cannot read property '0' of undefined at /snapshot/valetudo/lib/miio/Vacuum.js:726:31 at Object.resultHandler [as callback] (/snapshot/valetudo/lib/miio/Vacuum.js:150:9) at Socket. (/snapshot/valetudo/lib/miio/Vacuum.js:61:62)  at Socket.emit (events.js:210:5)  at UDP.onMessage [as onmessage] (dgram.js:861:8) Waiting for 30 sec after boot... done. 2020-02-11T13:50:16.365Z Loading configuration file: /mnt/data/valetudo/config.json 2020-02-11T13:50:16.498Z Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053 2020-02-11T13:50:16.501Z Webserver running on port 80 2020-02-11T13:50:17.635Z Robot connected /snapshot/valetudo/lib/miio/Dummycloud.js:225 Object.assign(this.connectedRobot.status, decodedResponse.msg.result[0]);

What am I doing wrong?

rand256 commented 4 years ago

Interesting. Looks like the device is sending you some message without the 'result' part, probably some error of unexpected type, and valetudo code is shocked because of that. I'll add some debug code later so it would be possible to read it properly.

Meanwhile I've googled around and it seems there's a chance that you have a chinese version of the device and are trying to use it outside of China. Device has detected it and a bit locked itself, throwing errors instead of normal replies to common requests. Is it right?

If so you need to factory reset the device and try flashing some firmware from vacuumz.info. Those modded images include some workarounds for exactly those issues (or even can switch your vacuum into non-chinese versions), while the image v11_001898.pkg you've downloaded here doesn't have such hacks and thus is compatible only with worldwide versions of the vacuums.

pidator commented 4 years ago

Meanwhile I've googled around and it seems there's a chance that you have a chinese version of the device and are trying to use it outside of China.

the ouput of cat /mnt/default/roborock.conf probably could help!

sergshev commented 4 years ago

rand256 Thanks for the help. Indeed, the problem was in the region.

pidator the ouput of cat /mnt/default/roborock.conf probably could help!

Thanks

pidator commented 4 years ago

... Indeed, the problem was in the region.

You solved the issue? How did you do it? Changed the roborock.conf or installed a new firmware?

sergshev commented 4 years ago

You solved the issue? How did you do it? Changed the roborock.conf or installed a new firmware?

changed roborock.conf