mrbungle64/ecovacs-deebot.js

DeleteVirtualBoundary does not work for a boundary with the ID 0

tndev opened this issue · 2 comments

tndev commented

Is there an existing issue for this?

  • I have searched the existing issues and no issue is describing my issue

The problem

The attempt to delete a boundary having the ID 0 does not work.
(The boundary that has the ID 0 was created within the iOS Ecovacshome App)

Code that is executed:

vacbot.run("DeleteVirtualBoundary", mapID, '0', 'vw');

The reason for this seems to be an incorrect check of the ID in the
DeleteVirtualBoundary case of the run function:

            case "DeleteVirtualBoundary".toLowerCase(): {
                const mapID = args[0]; // mapID is a string
                const spotAreaID = args[1]; // spotAreaID is a string
                const type = args[2];
                if ((Number(mapID) > 0) && (Number(spotAreaID) > 0) && (tools.isValidVirtualWallType(type))) {
                    this.sendCommand(new vacBotCommand.DeleteMapVirtualBoundary(mapID, spotAreaID, type));
                }
                break;
            }

Changing Number(spotAreaID) > 0 to Number(spotAreaID) >= 0 solves the problem and the area can be deleted.

With which model does the problem occur?

Deebot T8 series

From which source you have installed the adapter?

npm

Version of the ecovacs-deebot.js library

0.7.2

Version of Node.js

16.13.0

Operating system

Linux

Anything in the logs that might be useful?

No response

Additional information

No response

@tndev

Thanks for reporting this bug 👍🏻

Fixed with version 0.8.0