Low Power Doorbell

Last Updated on : 2024-11-18 11:33:14download

Check for low power doorbell

If an IPC is a low power device, it is a low power doorbell.

API description

boolean isLowPowerDevice(String devId);

Example

ITuyaIPCCore cameraInstance = TuyaIPCSdk.getCameraInstance();
if (cameraInstance != null) {
    cameraInstance.isLowPowerDevice(devId));
}

Wake up a low power device from sleep mode

A low power doorbell is powered by batteries. This device runs in sleep mode to minimize power consumption if peer-to-peer (P2P) connections are not used within a certain period. P2P connections are unavailable in sleep mode. They can be used only after the device is woken up.

API description

void wirelessWake(String devId);

Example

ITuyaIPCDoorbell doorbell = TuyaIPCSdk.getDoorbell();
if (doorbell != null) {
    doorbell.wirelessWake(devId);
}

You can query DP 149 status to check whether the low power doorbell device is awake. For more information about how to query DP status, see Device Control.

Manage doorbell call notifications

A doorbell can be bound with a home and stay online on your app. In this case, if the doorbell is pressed, IPC SDK receives a doorbell call event.

Integrate with push notifications

You can integrate doorbell call events and notifications into the app, so users can receive app push notifications immediately after the doorbell is pressed. For more information, see Integrate with Push Notifications.

Register the push notification protocol

Before you register the push notification protocol registerCameraPushListener, the app processes must be active and the user has logged in to the app.

API description

 void registerCameraPushListener(ITuyaGetBeanCallback<CameraPushDataBean> callback);

Parameters

Parameter Description
ITuyaGetBeanCallback The callback that is executed after a push notification is received.
CameraPushDataBean The data model of the message body.

CameraPushDataBean

Parameter Description
timestamp The message timestamp.
devid The device ID.
msgid The message ID
etype The type of message. doorbell indicates the push notification of a doorbell call.

Unregister the push notification protocol

We recommend that you unregister the push notification protocol after the user logs out of the app.

API description

void unRegisterCameraPushListener(ITuyaGetBeanCallback<CameraPushDataBean> callback);

If the app process is released, the listener is invalid. Therefore, we recommend that you:

  • Register a listener after login.
  • Unregister the listener after logout.

Battery management

A lower power doorbell can be connected to mains power or powered by batteries. You can call the IPC SDK to query the power mode and the current battery level of the device. A threshold can be set to generate low battery alerts conditionally.

Lock or unlock a battery

Locks a battery or releases the battery lock based on the DP ID 153.

Value Description
true Lock
false Unlock

Query battery level and device status

Returns the battery level and device status based on the DP ID 145. The battery level is reported with an integer ranging from 0 to 100.

To send the DP data, pass in null without a parameter.

Set a threshold for low battery alerts

Sets a threshold to generate low battery alerts conditionally based on the DP ID 147. If the battery is lower than the threshold, an alert will be generated.

Query power supply mode

Returns the current power supply mode based on the DP ID 146. When the power supply mode is changed, the device reports the DP status.

Value Description
0 Powered by batteries
1 Connected to mains power

To send the DP data, pass in null without a parameter.