Laser Robot Vacuum

Last Updated on : 2023-10-12 08:00:15download

This topic describes the specific functions of laser robot vacuum templates and how to use them. For more resources, visit the GitHub repository.

This project depends on TYSdk.mobile.mobileInfo.appRnVersion v5.28 and later. If your app version is too early, go to Tuya Panel-RN to download the latest version.

Overview

This laser robot vacuum template project is built on React Native 0.59 and supports the following functions:

  • Turn on and off the robot vacuum.
  • Control the robot vacuum charging.
  • Change the working status of the robot vacuum, such as spot cleaning, selective room cleaning, and area cleaning.
  • Set no-go areas and virtual walls.
  • Set cleaning areas.
  • Set and change room names.
  • Set and change room properties.
  • Split rooms.
  • Reset rooms.
  • View cleaning records.
  • Timer.

Sample interface

Homepage

Laser Robot Vacuum

Add a no-go area

Laser Robot Vacuum

Split rooms

Laser Robot Vacuum

Modify room names

Laser Robot Vacuum

Settings

Laser Robot Vacuum

Directory

This section only describes the directories related to the scaffold. For more information about the general directory structure, see RN 0.59 TS.

├── src
│ ├── api // Place a series of cloud APIs used in the project.
│ ├── components // Place reusable functional components used in the project.
│ ├── composeLayout.tsx // Encapsulate `device events` and `device information` required in the panel.
│ ├── config // Place some configuration files that are frequently used in the panel.
│ ├── pages // Place page-level components of the project.
│ ├── protocol // Place data parsing protocol including maps, paths, and virtual information.
│ ├── i18n // Place configuration files for multiple languages.
│ ├── main.tsx // Project entry files that are inherited from `NavigatorLayout`. Rewrite the `hookRoute` method to pass in some necessary configurations, such as background, topbar, and more. Rewrite the `renderScene` method to control routing jump.
│ ├── store // Place some codes related to `redux`.
│ ├── res // Place local resources, such as pictures and SVG path.
│ └── utils // Place some common tools and methods that are used in the panel.

Service process and UI interaction

  1. Enter the panel and send a request: get_both to get and parse map data, route data, and virtual information data, and then display them on the panel homepage.

  2. Tap SmartClean to operate the robot vacuum to start or pause cleaning.

  3. Tap Chargego to operate the robot vacuum to start or pause charging.

  4. Tap PoseClean, select a Position on the map, and tap Confirm to operate the robot vacuum to clean the area.

  5. Tap Select room and select an area on the map, and tap Confirm to clean the selected area.

  6. Tap ZoneClean to add a zone on the map, and tap Confirm to clean the zone.

  7. Tap Forbbiden Edit to add an Area and a Wall on the map.

  8. Tap Room edit to edit the map.

    On the Room edit page, you can perform the following operations:

    • Merge areas.
    • Split areas.
    • Restore areas.
    • Name areas.
    • Customize mode.
    • Set cleaning sequence.
  9. Tap More to enter the Settings page.

    On the Settings page, you can perform the following operations:

    • Manual
    • Room management
    • Reservation
    • Voice and volume
    • Switch disturb

Data point (DP) protocol

This section only describes the required DPs of the robot vacuum. For more information about the optional DPs, see the corresponding product details.

Cleaning switch (required)

Name Value
id 1
code switch_go
type bool
mode Send and report
value true or false
description
  • true: start cleaning
  • false: stop cleaning

Pause or continue (required)

Name Value
id 2
code pause
type bool
mode Send and report
value true or false
description
  • true: pause the current working status
  • false: continue the current working status

Recharge switch (required)

Name Value
id 3
code switch_charge
type bool
mode Send and report
value true or false
description
  • true: start recharging
  • false: stop recharging

Working mode (required)

Name Value
id 4
code mode
type Enum
mode Send and report
value Enum value: smart, chargego, zone, pose, part, and select_room
description The default value. It cannot be modified or deleted. Otherwise, the logic of the control panel will be affected:
  • smart: automatic cleaning mode or whole-house cleaning mode
  • chargego: automatic recharging mode. Compatibility with goto_charge is required.
  • zone: zone cleaning mode or rectangular cleaning mode
  • pose: pinpoint cleaning mode or spot cleaning mode
  • part: partial cleaning mode
  • select_room: selective room cleaning mode

Current status (required)

Name Value
id 5
code status
type Enum
mode Report only
value Enum value: standby, smart, zone_clean, part_clean, cleaning, paused, goto_pos, pos_arrived, pos_unarrive, goto_charge, charging, charge_done, sleep, and select_room
description The default value. It cannot be modified or deleted. Otherwise, the logic of the control panel will be affected:
  • standby: The robot vacuum is on standby.
  • smart: The robot vacuum is working in smart cleaning mode.
  • zone_clean: The robot vacuum is working in zone cleaning mode.
  • part_clean: The robot vacuum is working in partial cleaning mode.
  • cleaning: The robot vacuum is cleaning. (Alternative)
  • paused: The robot vacuum is paused.
  • goto_pos: The robot vacuum is moving to the target point.
  • pos_arrived: The robot vacuum arrives at the target point.
  • pos_unarrive: The robot vacuum cannot arrive at the target point.
  • goto_charge: The robot vacuum is looking for the charging dock.
  • charging: The robot vacuum is charging.
  • charge_done: Charging is completed.
  • sleep: The robot vacuum is sleeping.
  • select_room: The robot vacuum is cleaning the selected room.
Note: Other status values can be added, and the status value should be English words in lowercase. If a fault status is required, set a value as in_trouble.

Path transmission (required)

Name Value
id 14
code path_data
type Raw type
mode Send and report
description For more information about the related data protocol and logic, see the map protocol files of the robot vacuum in the SDK.

Command transmission (required)

Name Value
id 15
code command_trans
type Raw type
mode Send and report
description For more information about the related data protocol and logic, see the map protocol files of the robot vacuum in the SDK.

Request data (required)

Name Value
id 16
code request
type Enum
mode Send and report
value Enum value: get_map, get_path, and get_both
description For more information about the related data protocol and logic, see the map protocol files of the robot vacuum in the SDK.

Fault report (required)

Name Value
id 28
code fault
mode Send and report
value Fault value: edge_sweep, middle_sweep, left_wheel, right_wheel, garbage_box, land_check, collision
description The default value. It cannot be modified or deleted. Otherwise, the logic of the control panel will be affected:
  • edge_sweep_fault: edge sweep fault
  • middle_sweep_fault: middle sweep fault
  • left_wheel_fault: left wheel fault
  • right_wheel_fault: right wheel fault
  • garbage_box_fault: garbage box fault
  • land_check_fault: land check fault
  • collision_fault: collision fault
Note: Other status values can be added, and the status value should be English words in lowercase. If a fault status is required, set a value as in_trouble.