NVR Solution Configuration

Last Updated on : 2022-11-24 09:20:16

This topic describes how to configure the NVR solution to implement batch management of IP cameras (IPCs) by using the Smart Life app. For example, with an NVR, you can activate and manage IPCs in bulk and view multiple channels at the same time.

Create a product

Log in to the Tuya IoT Development Platform and click Create. Under the Standard Category tab, choose IP Camera > NVR. Choose TuyaOS for smart mode. Under the Custom Solution tab, choose Smart Camera.

For more information about the detailed processes of product creation, see Create Products.

If your product has the gateway feature built in, choose Gateway Device for Device Type. If not, choose Common Device.

NVR Solution Configuration

Standard functions

You can select the standard function as needed. The icon of the selected function will be displayed on the control panel and device setting page in the mobile app.

NVR Solution Configuration

Custom functions

There are a bunch of custom functions to implement more features for your NVR product, such as multi-view, disk storage, siren, and remote restart.

NVR Solution Configuration

Multi-view

Demonstration:

NVR Solution Configuration

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Input channels ipc_multi_view Report only (read-only) String - Example: {“4,9,16”}, indicating simultaneous 4/9/16 channels are supported. The app dynamically adapts to the received data.

Storage settings

Demonstration:

NVR Solution Configuration

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Supported storage device types supported_storage Send and report (read-write) Value {“min”:0,“max”:65535,“scale”:0,“step”:1,“type”:“value”} Represented by bit. 1: Detected. 0: Not detected.
  • bit0: Represents SD card.
  • bit1: Represents HDD1.
  • bit2: Represents HDD2.
  • bit3: Represents HDD3.
  • bit15: Represents HDD15.
The current storage device current_storage Send and report (read-write) Value {“min”:0,“max”:65535,“scale”:0,“step”:1,“type”:“value”} Represented by bit. 1: Enable. 0: Disable.
  • bit0: Represents SD card.
  • bit1: Represents HDD1.
  • bit2: Represents HDD2.
  • bit3: Represents HDD3.
  • bit15: Represents HDD15.
Get the storage space storage_capacity Report only (read-only) String {“type”:“string”,“maxlen”:255} Change the unit to KB. NVR Solution Configuration These three strings indicate the total storage space, the used storage space, and the available storage space respectively.
Storage status storage_status Send and report (read-write) Value {“min”:1,“max”:5,“scale”:0,“step”:1,“type”:“value”} status: The status of the storage module.
  • 1: Normal
  • 2: Anomaly
  • 3: Insufficient space
  • 4: Formatting in progress
  • 5: No SD card detected
Storage formatting storage_format Send and report (read-write) Boolean {“type”:“bool”} The device starts formatting when it receives true.
The state of storage formatting storage_format_status Send and report (read-write) Value {“min”:-2000,“max”:2000,“scale”:0,“step”:1,“type”:“value”} Possible error code.
  • -2000: The storage is being formatted.
  • -2001: An exception occurs during storage formatting.
  • -2002: No storage device is found.
  • -2003: The storage device has an error.
  • A positive number represents the progress of storage formatting.
Uninstall storage device storage_umount Send and report (read-write) Boolean {“type”:“bool”} true: Uninstall the storage device.

The module should report the storage-related DP status to the cloud when the storage status changes or storage-related queries or commands are received.

Example 1:

When the device detects a storage device, it reports the supported storage device type, current storage device, storage status, and storage space to the cloud.

Example 2:

When users tap Storage Settings on the app, the device reports the current storage status and storage space on receiving the storage status query command of NULL.

Siren

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Siren siren_switch Send and report (read-write) Boolean - -

Demonstration:

NVR Solution Configuration

Remote restart

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Restart device device_restart Send and report (read-write) Boolean - -

Demonstration:

NVR Solution Configuration

IPC sub-device configuration

IPCs are connected to an NVR as sub-devices. For more information about creating an IPC product, see IPC Configuration. This section describes the NVR-specific DPs that can be added to the IPC product.

Stretching video/picture

Demonstration:

NVR Solution Configuration

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Stretching videos ipc_res_change Report only (read-only) String - Example: {“video”:[{“restype”:“4”,“oldres”:“9441080",“newres”:“19201080"},{“restype”:“2”,“oldres”:“9441080"“newres”:"19201080”}],“message”:“1920*1080”}
Format description:
  • restype: Indicates the video resolution. 4: HD. 2: SD. Only the HD streaming is compressed.
  • oldres: The original resolution.
  • newres: The expected stretched resolution.
  • message: The expected stretched resolution for multimedia files included in the detection events.

Recording schedules

Demonstration:

NVR Solution Configuration

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Recording on/off record_switch Send and report (read-write) Boolean - -
Recording mode record_mode Send and report (read-write) Enum Enum values: 1, 2, 3
  • 1: Event recording
  • 2: Continuous recording
  • 3: Scheduled recording
Schedule recording record_timing_set Send and report (read-write) String - An array of JSON strings containing eight unsigned integers (decimal) represent Sunday to Saturday from left to right. Each string has 24 numbers, representing 00:00 to 01:00, 01:00 to 02:00 … 23:00 to 24:00.
0: No recording.
1: Ordinary recording.
2: Event recording.
3 to 9: Reserved. {001122222222222111111111,001122222222222111111111,
001122222222222111111111,001122222222222111111111,
001122222222222111111111,001122222222222111111111,
001122222222222111111111}

Local recording retrieve

Demonstration:

NVR Solution Configuration

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Event type retrieve recoding_event_list Report only (read-only) String - Format: {1,2,5,7,12} Each number represents an event type. The IPC should implement the event playback API.

Event description:

Number Event type Number Event type
0 Motion detection 9 Human shape detection
1 Doorbell 10 Pet detection
2 Device linkage 11 Vehicle detection
3 People pass by 12 Baby crying
4 People loiter 13 Unusual sound
5 Doorbell message 14 Face detected
6 Doorbell call answered 15 Tamper alarm
7 Doorbell call unanswered 16 Camera connection alert
8 Doorbell call rejected 17 Low battery warning

Dynamic adaptation to IPC capabilities

Scenarios:

The IPCs that can connect to an NVR vary in features. For example, the panel of cube cameras does not display the PT feature while PT cameras need it. The dynamic adaptation enables the app panel to dynamically adapt to the sub-device features according to the received capability values.

DP definition:

DP name Identifier Data transfer type Data type Property Notes
Report sub-device capability sub_dp_report Report only (read-only) String - Example: [4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295 ]
From right to left, the sequence number starts from 1. The sequence number of each bit represents DP ID. 1 indicates a capability is supported. 0 indicates a capability is not supported. Eight unsigned integers can identify DP ID 1 through 256 so that the app panel can adapt to each sub-device.

Hardware development

To implement the NVR solution, you need to integrate the XVR SDK into your project. The hardware design is implemented on your terms.

  1. Download XVR SDK. If you do not find the required SDK, contact the project manager and request the SDK.
  2. Develop with the SDK as instructed by the XVR SDK Development Guide. Request this guide from the project manager.

Push notification

You can set rules to trigger an automated push notification. For example, set a threshold for a function. If the preset value is reached, the user will receive an alert from the mobile phone.

Operation on the Tuya IoT Development Platform:

NVR Solution Configuration
  • Push notification is available to accounts of the premium version or ultimate version.
  • Push notifications for NVR and IPC are set separately.

OTA update

To deploy a firmware update via OTA, upload the update file to the Tuya IoT Development Platform. Implement the OTA update feature in the SDK and write it to the local flash memory. For more information, see Update custom firmware uploaded.

Operation on the Tuya IoT Development Platform:

NVR Solution Configuration

Update channels for NVR and IPC are set separately.

Quick product creation

Check out the NVR solution. Click Start OEM to get started.

Debug with virtual device

Download XVR SDK and run the demo.

Example:

#define IPC_App_PID " 6q4d0m7odkazdqrt"
#define IPC_App_UUID "zy00fac576ee7586ac6b"
#define IPC_App_AUTHKEY "wm1TZ4M9xKM2kO4xYhLc22cX3yBI7eAF"
#define IPC_App_SUB_DEV_PID " qxqduhvs1x7brlc9"
  • Replace the values of IPC_App_PID and IPC_App_SUB_DEV_PID NVR with the PIDs of your NVR and IPC.
  • The NVR in this demo can connect to 16 IPCs.