npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ray-js/robot-protocol

v1.0.1

Published

扫地机协议解析库

Readme

English | 简体中文

@ray-js/robot-protocol

The @ray-js/robot-protocol provides methods for encoding and decoding commonly used complex protocols in the robot vacuum. Most method names are based on the cmd command numbers in the protocol, allowing for quick indexing.

This document will not cover specific protocol formats. For more information, please contact your account manager or submit a support ticket.

latest download

扫地机协议解析库

Installation

$ npm install @ray-js/robot-protocol
# or
$ yarn add @ray-js/robot-protocol

Virtual Wall

encodeVirtualWall0x12

Encodes virtual wall data into a specific format string, applicable for 0x12/0x13, version V1.0.0.

Parameters

  • params (object): An object containing the following properties
    • walls (Point[][]): An array of endpoint coordinates for the virtual walls, with each virtual wall consisting of a set of points.
    • origin (Point): The origin coordinates of the map.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The protocol version number, default is '1'.

Returns

  • string: The encoded virtual wall data string.

Example

const walls = [
  [
    { x: 1, y: 2 },
    { x: 3, y: 4 },
  ],
  [
    { x: 5, y: 6 },
    { x: 7, y: 8 },
  ],
];
const origin = { x: 0, y: 0 };
const mapScale = 1;
const version = '1';

const encodedString = encodeVirtualWall0x12({ walls, origin, mapScale, version });
console.log(encodedString);

decodeVirtualWall0x13

Parses virtual wall data from commands (0x13) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing virtual wall data.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • Point[][] | null: The parsed virtual wall data, returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const mapScale = 1;
const version = '1';

const walls = decodeVirtualWall0x13({ command, mapScale, version });
console.log(walls);

Zone Cleaning

requestRoomClean0x15

Requests zone cleaning data from the device (0x15) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string requesting zone cleaning data.

Example

const command = requestRoomClean0x15({ version: '1' });
console.log(command);

encodeRoomClean0x14

Sets the command for zone cleaning (0x14) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • cleanTimes (number): Number of cleaning times.
    • roomHexIds (string[], optional): An array of hexadecimal room IDs.
    • roomIds (number[], optional): An array of room IDs.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting zone cleaning.

Example

const command = encodeRoomClean0x14({
  cleanTimes: 2,
  roomHexIds: ['1A', '2B'],
  mapVersion: 2,
  version: '1',
});
console.log(command);

decodeRoomClean0x15

Parses zone cleaning information from commands (0x15) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing zone cleaning information.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The protocol version number, default is '1'.

Returns

  • object | null: The parsed zone cleaning information object, returns null if the command is invalid.
    • Contains the following properties:
      • cleanTimes (number): Number of cleaning times.
      • roomIds (number[]): An array of room IDs.
      • roomHexIds (string[]): An array of hexadecimal room IDs. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodeRoomClean0x15({ command, mapVersion: 2, version: '1' });
console.log(result);

requestRoomClean0x57

Requests zone cleaning data from the device (0x57) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string requesting zone cleaning data.

Example

const command = requestRoomClean0x57({ version: '1' });
console.log(command);

encodeRoomClean0x56

Sets the command for zone cleaning (0x56) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • rooms (Room[]): An array of room information, each room contains the following properties:
      • roomHexId (string, optional): The room's hexadecimal ID.
      • roomId (number, optional): The room's ID.
      • cleanTimes (number): Number of cleaning times.
      • yMop (number): Number of mopping times.
      • suction (number): Suction level.
      • cistern (number): Water tank level.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting zone cleaning.

Example

const command = encodeRoomClean0x56({
  rooms: [
    { roomHexId: '1A', cleanTimes: 2, yMop: 1, suction: 3, cistern: 2 },
    { roomId: 2, cleanTimes: 1, yMop: 1, suction: 2, cistern: 1 },
  ],
  mapVersion: 2,
  version: '1',
});
console.log(command);

decodeRoomClean0x57

Parses zone cleaning information from commands (0x57) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing zone cleaning information.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • Room[] | null: The parsed zone cleaning information array, each room contains the following properties:
    • roomHexId (string): The room's hexadecimal ID.
    • roomId (number): The room's ID.
    • suction (number): Suction level.
    • cistern (number): Water tank level.
    • yMop (number): Number of mopping times.
    • cleanTimes (number): Number of cleaning times. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const rooms = decodeRoomClean0x57({ command, mapVersion: 2, version: '1' });
console.log(rooms);

Section Cleaning

requestZoneClean0x3b

Requests section cleaning data from the device (0x3b) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string requesting section cleaning data.

Example

const command = requestZoneClean0x3b({ version: '1' });
console.log(command);

encodeZoneClean0x3a

Sets the command for section cleaning (0x3a) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • protocolVersion (1 | 2 | 3): Protocol version.
    • zones (Zone[]): An array of section cleaning area information, each area contains the following properties:
      • points (Point[]): An array of vertex coordinates for the area.
      • name (string, optional): The name of the area.
      • advanced (object, optional): Advanced settings, containing the following properties:
        • id (number): Area ID.
        • localSave (number): Local save flag.
        • order (number): Cleaning order.
        • cleanMode (number): Cleaning mode.
        • cleanTimes (number): Number of cleaning times.
        • suction (number): Suction level.
        • cistern (number): Water tank level.
    • origin (Point): The origin coordinates of the map.
    • cleanMode (CleanMode, optional): Cleaning mode, default is 0.
    • suction (Suction, optional): Suction level, default is 0.
    • cistern (Cistern, optional): Water tank level, default is 0.
    • cleanTimes (number, optional): Number of cleaning times, default is 1.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for section cleaning.

Example

const command = encodeZoneClean0x3a({
  protocolVersion: 3,
  zones: [
    {
      points: [
        { x: 10, y: 20 },
        { x: 30, y: 40 },
        { x: 50, y: 60 },
        { x: 70, y: 80 },
      ],
      name: 'Area 1',
      advanced: {
        id: 1,
        localSave: 1,
        order: 1,
        cleanMode: 1,
        cleanTimes: 2,
        suction: 3,
        cistern: 2,
      },
    },
  ],
  origin: { x: 0, y: 0 },
  mapScale: 1,
  version: '1',
});
console.log(command);

decodeZoneClean0x3b

Parses section cleaning data from commands (0x3b) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing section cleaning data.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed section cleaning data object, containing the following properties:
    • protocolVersion (1 | 2 | 3): Protocol version.
    • zones (Zone[]): An array of section cleaning area information, each area contains the following properties:
      • points (Point[]): An array of vertex coordinates for the area.
      • name (string): The name of the area.
      • advanced (object, optional): Advanced settings, containing the following properties (only returned in protocol version 3):
        • id (number): Area ID.
        • localSave (number): Local save flag.
        • order (number): Cleaning order.
        • cleanMode (number): Cleaning mode.
        • cleanTimes (number): Number of cleaning times.
        • suction (number): Suction level.
        • cistern (number): Water tank level.
    • cleanMode (CleanMode, optional): Cleaning mode (only returned in protocol version 2).
    • suction (Suction, optional): Suction level (only returned in protocol version 2).
    • cistern (Cistern, optional): Water tank level (only returned in protocol version 2).
    • cleanTimes (number, optional): Number of cleaning times (only returned in protocol version 2). Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodeZoneClean0x3b({ command, mapScale: 1, version: '1' });
console.log(result);

Spot Cleaning

requestSpotClean0x17

Requests spot cleaning data from the device (0x17) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string requesting spot cleaning data.

Example

const command = requestSpotClean0x17({ version: '1' });
console.log(command);

encodeSpotClean0x16

Sets the command for spot cleaning (0x16) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • point (Point): The target point coordinates for spot cleaning.
    • origin (Point): The origin coordinates of the map.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting spot cleaning.

Example

const command = encodeSpotClean0x16({
  point: { x: 10, y: 20 },
  origin: { x: 0, y: 0 },
  mapScale: 1,
  version: '1',
});
console.log(command);

decodeSpotClean0x17

Parses spot cleaning data from commands (0x17) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing spot cleaning data.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed spot cleaning information object, containing the following properties:
    • point (Point): The target point coordinates for spot cleaning. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodeSpotClean0x17({ command, mapScale: 1, version: '1' });
console.log(result);

requestSpotClean0x3f

Requests spot cleaning data from the device (0x3f) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string requesting spot cleaning data.

Example

const command = requestSpotClean0x3f({ version: '1' });
console.log(command);

encodeSpotClean0x3e

Sets the command for spot cleaning (0x3e) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • protocolVersion (1 | 2): Protocol version.
    • points (Point[]): An array of target point coordinates for spot cleaning.
    • origin (Point): The origin coordinates of the map.
    • cleanMode (CleanMode, optional): Cleaning mode.
    • suction (Suction, optional): Suction level.
    • cistern (Cistern, optional): Water tank level.
    • cleanTimes (number, optional): Number of cleaning times.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting spot cleaning.

Example

const command = encodeSpotClean0x3e({
  protocolVersion: 2,
  points: [
    { x: 10, y: 20 },
    { x: 30, y: 40 },
  ],
  origin: { x: 0, y: 0 },
  mapScale: 1,
  version: '1',
});
console.log(command);

decodeSpotClean0x3f

Parses spot cleaning data from commands (0x3f) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing spot cleaning data.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed spot cleaning information object, containing the following properties:
    • protocolVersion (1 | 2): Protocol version.
    • points (Point[]): An array of target point coordinates for spot cleaning.
    • cleanMode (CleanMode, optional): Cleaning mode (only returned in protocol version 1).
    • suction (Suction, optional): Suction level (only returned in protocol version 1).
    • cistern (Cistern, optional): Water tank level (only returned in protocol version 1).
    • cleanTimes (number, optional): Number of cleaning times (only returned in protocol version 1). Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodeSpotClean0x3f({ command, mapScale: 1, version: '1' });
console.log(result);

Restricted Area Settings

requestVirtualArea0x39

Requests restricted area data from the device (0x39) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string requesting restricted area data.

Example

const command = requestVirtualArea0x39({ version: '1' });
console.log(command);

encodeVirtualArea0x38

Sets the command for restricted areas (0x38) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • protocolVersion (1 | 2): Protocol version.
    • virtualAreas (VirtualArea[]): An array of restricted area information, each area contains the following properties:
      • points (Point[]): An array of vertex coordinates for the restricted area.
      • mode (number): The mode of the restricted area.
      • name (string, optional): The name of the restricted area.
    • origin (Point): The origin coordinates of the map.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting restricted areas.

Example

const command = encodeVirtualArea0x38({
  protocolVersion: 2,
  virtualAreas: [
    {
      points: [
        { x: 10, y: 20 },
        { x: 30, y: 40 },
        { x: 50, y: 60 },
        { x: 70, y: 80 },
      ],
      mode: 1,
      name: 'Restricted Area 1',
    },
  ],
  origin: { x: 0, y: 0 },
  mapScale: 1,
  version: '1',
});
console.log(command);

decodeVirtualArea0x39

Parses restricted area data from commands (0x39) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing restricted area data.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed restricted area data object, containing the following properties:
    • protocolVersion (1 | 2): Protocol version.
    • virtualAreas (VirtualArea[]): An array of restricted area information, each area contains the following properties:
      • mode (number): The mode of the restricted area.
      • points (Point[]): An array of vertex coordinates for the restricted area.
      • name (string): The name of the restricted area. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodeVirtualArea0x39({ command, mapScale: 1, version: '1' });
console.log(result);

Partition Division

decodeVirtualArea0x39

Parses restricted area data from commands (0x39) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing restricted area data.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed restricted area data object, containing the following properties:
    • protocolVersion (1 | 2): Protocol version.
    • virtualAreas (VirtualArea[]): An array of restricted area information, each area contains the following properties:
      • mode (number): The mode of the restricted area.
      • points (Point[]): An array of vertex coordinates for the restricted area.
      • name (string): The name of the restricted area. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodeVirtualArea0x39({ command, mapScale: 1, version: '1' });
console.log(result);

decodePartitionDivision0x1d

Parses the device's response for partition division results (0x1d) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing partition division results.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed partition division result object, containing the following properties:
    • ret (number): Return code.
    • success (boolean): Whether it was successful.
    • roomId (number): The room ID.
    • points (Point[]): An array of vertex coordinates for the partition division. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodePartitionDivision0x1d({ command, mapScale: 1, version: '1' });
console.log(result);

Setting Cleaning Order

requestRoomOrder0x26

Requests room cleaning order data from the device (0x26) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string requesting room cleaning order data.

Example

const command = requestRoomOrder0x26({ version: '1' });
console.log(command);

encodeRoomOrder0x26

Encodes room order information (0x26 / 0x27) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • roomIdHexs (string[]): An array of room IDs, where each room ID is a string.
    • mapVersion (0 | 1 | 2): Map version.
    • version ('0' | '1', optional): The encoding version number, default is '1'.

Returns

  • string: The encoded room order information string.

Example

const command = encodeRoomOrder0x26({
  roomIdHexs: ['1A', '2B', '3C'],
  mapVersion: 1,
  version: '1',
});
console.log(command);

decodeRoomOrder0x27

Decodes room cleaning order information (0x27) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string to be decoded.
    • version ('0' | '1', optional): The version information of the command string, default is '1'.

Returns

  • number[] | null: The decoded room order information array, returns null if decoding fails.

Example

const command = 'your_command_string_here';
const result = decodeRoomOrder0x27({ command, version: '1' });
console.log(result);

Partition Division

encodePartitionDivision0x1c

The partition division command issued to the device (0x1c) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • roomId (number): The room ID.
    • points (Point[]): An array of vertex coordinates for the partition division.
    • origin (Point): The origin coordinates of the map.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting partition division.

Example

const command = encodePartitionDivision0x1c({
  roomId: 1,
  points: [
    { x: 10, y: 20 },
    { x: 30, y: 40 },
  ],
  origin: { x: 0, y: 0 },
  mapScale: 1,
  version: '1',
});
console.log(command);

decodePartitionDivision0x1d

Parses the device's response for partition division results (0x1d) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing partition division results.
    • mapScale (number, optional): The scale of the map, default is 1.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed partition division result object, containing the following properties:
    • ret (number): Return code.
    • success (boolean): Whether it was successful.
    • roomId (number): The room ID.
    • points (Point[]): An array of vertex coordinates for the partition division. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodePartitionDivision0x1d({ command, mapScale: 1, version: '1' });
console.log(result);

Partition Merge

encodePartitionMerge0x1e

The partition merge command issued to the device (0x1e) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • roomIds (number[]): An array of room IDs to be merged.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting partition merge.

Example

const command = encodePartitionMerge0x1e({
  roomIds: [1, 2, 3],
  version: '1',
});
console.log(command);

decodePartitionMerge1f

Parses the device's response for partition merge results (0x1f) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing partition merge results.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed partition merge result object, containing the following properties:
    • ret (number): Return code.
    • success (boolean): Whether it was successful. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodePartitionMerge1f({ command, version: '1' });
console.log(result);

Setting Room Name

encodeSetRoomName0x24

The command to set room names issued to the device (0x24) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • rooms (Room[]): An array of room information, each room contains the following properties:
      • roomHexId (string, optional): The room's hexadecimal ID.
      • roomId (number, optional): The room's ID.
      • name (string, optional): The room name.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting room names.

Example

const command = encodeSetRoomName0x24({
  rooms: [
    { roomHexId: '1A', name: 'Living Room' },
    { roomId: 2, name: 'Bedroom' },
  ],
  mapVersion: 2,
  version: '1',
});
console.log(command);

decodeSetRoomName0x25

Parses the device's response for setting room names results (0x25) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing the results of setting room names.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • Room[] | null: The parsed room information array, each room contains the following properties:
    • roomHexId (string): The room's hexadecimal ID.
    • roomId (number): The room's ID.
    • name (string): The room name. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const rooms = decodeSetRoomName0x25({ command, mapVersion: 2, version: '1' });
console.log(rooms);

Setting Room Properties

encodeSetRoomProperty0x22

The command to set room properties issued to the device (0x22) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • rooms (Room[]): An array of room information, each room contains the following properties:
      • roomHexId (string, optional): The room's hexadecimal ID.
      • roomId (number, optional): The room's ID.
      • cleanTimes (number): Number of cleaning times.
      • yMop (number): Number of mopping times.
      • suction (number): Suction level.
      • cistern (number): Water tank level.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting room properties.

Example

const command = encodeSetRoomProperty0x22({
  rooms: [
    { roomHexId: '1A', cleanTimes: 2, yMop: 1, suction: 3, cistern: 2 },
    { roomId: 2, cleanTimes: 1, yMop: 1, suction: 2, cistern: 1 },
  ],
  mapVersion: 2,
  version: '1',
});
console.log(command);

decodeSetRoomProperty0x23

Parses the device's response for setting room properties results (0x23) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing the results of setting room properties.
    • mapVersion (0 | 1 | 2, optional): Map version, default is 2.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • Room[] | null: The parsed room information array, each room contains the following properties:
    • roomHexId (string): The room's hexadecimal ID.
    • roomId (number): The room's ID.
    • suction (number): Suction level.
    • cistern (number): Water tank level.
    • yMop (number): Number of mopping times.
    • cleanTimes (number): Number of cleaning times. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const rooms = decodeSetRoomProperty0x23({ command, mapVersion: 2, version: '1' });
console.log(rooms);

Do Not Disturb Mode

encodeDoNotDisturb0x40

Sets the do not disturb time command (0x40) | App ➜ Robot

Parameters

  • params (object): An object containing the following properties
    • enable (boolean): Whether to enable do not disturb mode.
    • startHour (number): The hour when do not disturb mode starts.
    • startMinute (number): The minute when do not disturb mode starts.
    • endHour (number): The hour when do not disturb mode ends.
    • endMinute (number): The minute when do not disturb mode ends.
    • timeZone (number, optional): Time zone, default is the current time zone.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for setting do not disturb time.

Example

const command = encodeDoNotDisturb0x40({
  enable: true,
  startHour: 22,
  startMinute: 0,
  endHour: 6,
  endMinute: 0,
  timeZone: 8,
  version: '1',
});
console.log(command);

decodeDoNotDisturb0x41

Parses do not disturb time data from commands (0x41) | Robot ➜ App

Parameters

  • params (object): An object containing the following properties
    • command (string): The command string containing do not disturb time data.
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • object | null: The parsed do not disturb time data object, containing the following properties:
    • enable (boolean): Whether do not disturb mode is enabled.
    • timeZone (number): Time zone.
    • startHour (number): The hour when do not disturb mode starts.
    • startMinute (number): The minute when do not disturb mode starts.
    • endHour (number): The hour when do not disturb mode ends.
    • endMinute (number): The minute when do not disturb mode ends. Returns null if the command is invalid.

Example

const command = 'your_command_string_here';
const result = decodeDoNotDisturb0x41({ command, version: '1' });
console.log(result);

Reset Map

encodeResetMap0x42

The command for quick mapping issued to the device (0x42) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for quick mapping.

Example

const command = encodeResetMap0x42({ version: '1' });
console.log(command);

Quick Mapping

encodeQuickMap0x3c

The command for quick mapping issued to the device (0x3c) | App ➜ Robot

Parameters

  • params (object, optional): An object containing the following properties
    • version ('0' | '1', optional): The version number, default is '1'.

Returns

  • string: The command string for quick mapping.

Example

const command = encodeQuickMap0x3c({ version: '1' });
console.log(command);