General

This article introduces the business APIs provided by @ray-js/ray-ipc-utils, ready to use out of the box. Required version: ^1.1.5.

1. Native Page Navigation

Description

Some pages are implemented as native (App) pages and currently do not support customization. For more details or feedback, please contact us.

Request Parameters

ParameterTypeDescriptionRequired
idstringRoute IDYes
deviceIdstringDevice IDYes
themethemeTypeThemeNo
paramsobjectRoute parameters (default {})No
isGeneralbooleanGeneral page flag (default false)No

themeType Details

ValueDescription
undefinedDefault, follows app theme
darkDark mode
lightLight mode

Album

Route ID: ipc_album_panel

Example


import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';

const id = 'ipc_album_panel';
const deviceId = '1234567890xxxxxx';

const result = await goToIpcPageNativeRoute(id, deviceId);

💡 Note: @ray-js/ray-ipc-utils version >= 1.1.11 is required.

Example

import { goToIpcPlayBackHubNativePage } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const sdCardState = true; // Whether the SD card is working properly, usually true when DP sd_status === 1

const result = await goToIpcPlayBackHubNativePage(deviceId, sdCardState);

Playback

💡 Note: Starting from App version 650, cloud and SD card playback are merged into one unified page.

Cloud playback id: camera_cloud_panel SD card playback id: camera_playback_panel

Note: The playback page has internal logic. For example, if the device does not support cloud storage, the cloud tab will not display even if navigating to the cloud playback route.

Example


import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';

const id = 'camera_cloud_panel';
const deviceId = '1234567890xxxxxx';

const result = await goToIpcPageNativeRoute(id, deviceId);

Messages

The message page displays various types of notifications, mainly including: general event alerts, doorbell messages, and AI messages. Internally, it handles tasks such as image decryption and rendering, as well as video decryption and playback.

Route ID: camera_message_panel

Example


import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';

const id = 'camera_message_panel';
const deviceId = '1234567890xxxxxx';

const result = await goToIpcPageNativeRoute(id, deviceId);

Voice Manager

Route ID: ipc_doorbell_voice_manager

Example


import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';

const id = 'ipc_doorbell_voice_manager';
const deviceId = '1234567890xxxxxx';

const result = await goToIpcPageNativeRoute(id, deviceId);

2. Get Camera Configuration

Description

Retrieves config data such as speaker, intercom, resolution, zoom, etc.

Request Parameter

ParameterTypeDescriptionRequired
deviceIdstringDevice IDYes

Return Parameter data

ParameterData TypeDescription
microphoneSettingsobjectMicrophone-related settings
intercomInfoobjectIntercom-related settings
videoResolutionobjectResolution-related settings
maxZoomSettingsnumberMaximum zoom level supported by the player

Field Details:microphoneSettings

ParameterData TypeDescription
isMicrophoneSupportedbooleanWhether the speaker function is supported
defaultMuteModebooleanDefault mute state (true means muted)
cachedMuteModebooleanMost recent mute configuration (cached value)

Field Details:intercomInfo

ParameterData TypeDescription
isIntercomSupportedbooleanWhether intercom is supported
defaultIntercomModeOneWay or TwoWayDefault intercom mode
cachedIntercomModeOneWay or TwoWayMost recent intercom mode (cached value)
supportedIntercomModesarray ['OneWay', 'TwoWay']List of supported intercom modes

Intercom Mode Explanation

ParameterDescriptionRemarks
OneWayOne-way intercomWhen intercom is on, speaker is off; when intercom ends, speaker turns on. Similar to a walkie-talkie.
TwoWayTwo-way intercomWhen intercom is on, speaker is on; when intercom ends, speaker remains on. Similar to a phone call.

Field Details: videoResolution

ParameterData TypeDescription
defaultResolutionClarityTypeDefault video clarity
cachedResolutionClarityTypeLast used clarity setting (cached value)
availableResolutionsarray, ClarityType[]List of supported clarity levels

ClarityType Details: ClarityType

ParameterDescriptionNote
SSData-saving mode-
SDStandard DefinitionCommonly used
HDHigh DefinitionCommonly used
UDUltra Definition-
SSPSuper Super Definition
AUTOAutoSupported from P2P version 4.0 and above

The clarity list values are mainly configured based on the product PID dimension, with the default being ['HD', 'SD']. For special configurations, please confirm and provide feedback to the project manager.

Example


import { getCameraConfigInfo } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const result = await getCameraConfigInfo(deviceId);

Response Example

{
  "code": 0,
  "data": {
    "microphoneSettings": {
      "isMicrophoneSupported": true,
      "defaultMuteMode": false,
      "cachedMuteMode": true
    },
    "intercomInfo": {
      "isIntercomSupported": true,
      "defaultIntercomMode": "OneWay",
      "cachedIntercomMode": "OneWay",
      "supportedIntercomModes": ["OneWay", "TwoWay"]
    }
  }
}

3. Cloud Storage Support

Description

Used to check whether the specified camera device supports cloud storage.

Request Parameters

ParameterTypeDescriptionRequired
deviceIdstringDevice IDYes

Response Parameters data

  • true: Supported
  • false: Not supported

Example


import { getIsSupportedCloudStorageSync } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const result = await getIsSupportedCloudStorageSync(deviceId);

Response Example

{
  "code": 0,
  "data": true
}

4. Get Signal Strength

Description

Used to obtain the signal strength of the specified camera device when streaming.

Request Parameters

ParameterTypeDescriptionRequired
deviceIdstringDevice IDYes

Response Parameters data

Signal strength value, ranging from 0 to 100.

  • 0 indicates the weakest signal.
  • 100 indicates the strongest signal.
    Unit: %

Example


import { requestWifiSignal } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const result = await requestWifiSignal(deviceId);

Response Example

{
  "code": 0,
  "data": 100
}

5. Get Video Bitrate

Description

Used to get the video bitrate of the specified camera device during streaming, indicating the amount of data transmitted per unit time.

Request Parameters

ParameterTypeDescriptionRequired
deviceIdstringDevice IDYes

Response Parameters data

Video Bitrate: A numeric value greater than or equal to 0, representing the data transmission rate during video streaming.
Unit: KB/S (Kilobytes per second)

Example


import { getVideoBitrateKbps } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const result = await getVideoBitrateKbps(deviceId);

Response Example

{
  "code": 0,
  "data": 100
}

6. Picture-in-Picture (PiP)

Support Check

Description

First, determine whether the device supports this feature.

Request Parameters

ParameterData TypeDescriptionRequired
deviceIdstringDevice IDYes

Response Parameters data

isSupport: true (supported) or false (not supported)

Example


import { isSupportFloatWindow } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const result = await isSupportFloatWindow(deviceId);

Response Example

{
  "code": 0,
  "data": { "isSupport": true}
}

Enable Picture-in-Picture

Description

This feature can only be successfully called to enable picture-in-picture if the device supports it.

Request Parameters

ParameterData TypeDescriptionRequired
deviceIdstringDevice IDYes

Response Parameters code

code: 0 (Success) Picture-in-picture enabled directly Others (Failure)

Example


import { openFloatWindow } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const result = await openFloatWindow(deviceId);

Response Example

{
  "code": 0
}

7. Low Power Wake-up

Description

For low-power devices using dpId (149) and dpCode (wireless_awake), it is necessary to call the wake-up function at least three times with 200ms intervals before establishing the connection.

Request Parameters

ParameterData TypeDescriptionRequired
deviceIdstringDevice IDYes

Response Parameter: code

code: 0 (Success) Method call succeeded; others indicate (Failure)

Example


import { wakeUpDevice } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';

const result = await wakeUpDevice(deviceId);

Response Example

{
  "code": 0
}

8. Get Current Mobile Screen Orientation

Description

Get the current screen orientation of the mobile device once.

Response Parameters data

portrait (portrait mode) landscape (landscape mode)

Example


import { getMobileOrientation } from '@ray-js/ray-ipc-utils';

const result = await getMobileOrientation();

Response Example

{
  "code": 0,
  "data": "portrait"
}

9. Set Screen Orientation

Description

Manually set the screen orientation to portrait or landscape.
If the player contains landscape videos, the current page configuration (index.config.ts) must have pageOrientation set to auto for proper rotation.

Request Parameters

ParameterData TypeDescriptionRequired
pageOrientationportrait or landscapeScreen orientationYes

Response Parameters data

portrait (portrait mode) landscape (landscape mode)

Example


import { setScreenOrientation } from '@ray-js/ray-ipc-utils';

const pageOrientation = 'portrait';

const result = await setScreenOrientation(pageOrientation);

Response Example

{
  "code": 0,
}

10. Get Value-Added Service URL

Description

Retrieve URLs for various common value-added services, or directly navigate to the corresponding service pages.

Request Parameters

ParameterData TypeDescriptionRequired
deviceIdstringDevice IDYes
serviceTypeServiceTypeService typeYes
paramsParamsParameters for serviceYes
actionboolWhether to navigate directlyNo

Service Types: ServiceType

TypeDescription
security_cloud_serviceCloud Storage
ai_serviceAI Cloud Service
aiInspectionReportInspection Report
traffic_service4G Data Traffic

Note Value-added services are continuously expanding. If some services are not covered or different services require different parameters, please contact the Tuya Mini Program team for feedback. We will respond promptly.

Response Parameters data

Example


import { getServiceUrl } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';
const serviceType = 'security_cloud_service';
const params = {}

// If serviceType is aiInspectionReport, you need to pass activeTime, reportId, and devId

// const params = {
//   activeTime: 'xxx',
//   reportId: 'xxx',
//   devId: 'xxx'
// };

const action = true;

const result = await getServiceUrl(deviceId, serviceType, params, true);

Response Example

{
  "code": 0,
}

11. Navigate to IPC Settings Mini Program

Description

Navigate to the IPC device settings mini program page, where users can configure device-related settings.

Request Parameters

ParameterData TypeDescriptionRequired
deviceIdstringDevice IDYes
optionsobjectOptional configurationNo
options.position'right' or 'bottom'Pop-up position (default: 'right')No

Example


import { goToIpcSettingMini } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';
const options = {
  position: 'right'
};

const result = await goToIpcSettingMini(deviceId, options);

Response Example

{
  "code": 0,
}

12. Navigate to IPC Service Hall Mini Program

Description

Navigate to the IPC Service Hall mini program.

Request Parameters

ParameterData TypeDescriptionRequired
optionsobjectOptional configurationNo
options.position'right' or 'bottom'Pop-up position (default: 'right')No

Example


import { goToIpcServiceHallMini } from '@ray-js/ray-ipc-utils';

const options = {
  position: 'right'
};

const result = await goToIpcServiceHallMini(options);

Response Example

{
  "code": 0,
}

13. Get Service Subscription Status

Description

Used to check whether a specified value-added service is subscribed for a device.

Request Parameters

ParameterData TypeDescriptionRequired
deviceIdstringDevice IDYes
categoryCodestringService typeYes

Service Types (categoryCode)

categoryCodeDescription
security_cloud_serviceCloud Storage
ai_inspection_serviceVideo Inspection Service

Note Value-added services are continuously expanding. If some services are not covered or different services require different parameters, please contact the Tuya Smart Mini Program team for feedback. We will respond promptly.

Response Parameters data

  • true: Subscribed
  • false: Not subscribed

Example


import { getServiceIsOpen } from '@ray-js/ray-ipc-utils';

const deviceId = '1234567890xxxxxx';
const categoryCode = 'security_cloud_service'; // Cloud Storage

const result = await getServiceIsOpen(deviceId, categoryCode);

Response Example

{
  "code": 0,
  "data": true
}