rand256 / valetudo

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

Crash on "segmented_cleanup" custom command via MQTT #329

Closed CoolONEOfficial closed 3 years ago

CoolONEOfficial commented 3 years ago

Describe the bug Valetudo crashes on "segmented_cleanup" custom command via MQTT

How to Reproduce Steps to reproduce the behavior:

  1. Send custom command via MQTT: {"command":"segmented_cleanup","segment_ids":["Test"],"repeats":1}
  2. Valetudo crashes and reboots
  3. See error in logs

Expected behavior Start segmented cleanup

Logs

2020-11-19T23:06:30.083Z Timesync packet received
2020-11-19T23:06:30.079Z Robot connected
2020-11-19T23:06:27.754Z scheduled zoned cleaning timezone offset set to 180
2020-11-19T23:06:27.668Z setting scheduled zoned cleaning timezone to Europe/Moscow
2020-11-19T23:06:24.681Z Probed last id = 2002 using get_status (5 retries)
2020-11-19T23:06:23.380Z Connected successfully to mqtt server
2020-11-19T23:06:22.908Z Webserver running on port 80
2020-11-19T23:06:22.894Z Dummycloud is spoofing 203.0.113.1:8053 on 127.0.0.1:8053
2020-11-19T23:06:22.154Z Loading configuration file: /mnt/data/valetudo/config.json
    at UDP.onMessage [as onmessage] (dgram.js:910:8)
    at Socket.emit (events.js:315:20)
    at Socket.<anonymous> (/snapshot/valetudo/lib/miio/Vacuum.js:66:51)
    at Object.resultHandler [as callback] (/snapshot/valetudo/lib/miio/Vacuum.js:281:3)
    at /snapshot/valetudo/lib/MqttClient.js:521:23
    at Array.forEach (<anonymous>)
    at /snapshot/valetudo/lib/MqttClient.js:523:28
TypeError: data.find is not a function

                                                   ^
                                let segment = data.find(e => segment_selector === e[1]);
/snapshot/valetudo/lib/MqttClient.js:523
2020-11-19T23:05:03.855Z tgBot: probeV6 finished with: v4

Vacuum Model: Xiaomi Vacuum v1

Valetudo Version: 004018 (last)

User-Agent Safari

rand256 commented 3 years ago

Nice finding, will be fixed. v1 device obviously doesn't support segmented cleaning at all and shouldn't even try it.