Battery Display

Last Updated on : 2021-08-27 11:07:18download

TYIpcBattery is used to display the value of real-time battery capacity and status. Built-in IP camera (IPC) standard data points (DPs) are available to calculate the battery capacity. You can also customize the values.

The following IPC standard DPs are included:

  • 145: wireless_electricity (battery capacity reporting)
  • 146: wireless_powermode (power supply mode)
  • 148: battery_report_cap (accurate reporting capability)

Note: You can log in to the Tuya IoT Platform and check the details of these DPs during the smart product development.

Preview

Battery Display

Properties

Field name Type Description Default value
standardDpMode boolean Specifies whether to use the standard DPs. true
value number The non-standard DP to show the battery capacity. 0
batteryContainer ViewStyle The style of the battery container. {}
size number The size of the component. 20
rotateZ number The angle of rotation. 0
batteryBorderColor string The border color of the battery icon. ‘rgba(0,0,0,.5)’
highColor string The color value to indicate the battery capacity of 20% or higher. #61d914
middleColor string The color value to indicate the battery capacity of between 10% and 20% or equal to 10%. #e38315
lowColor string The color value to indicate the battery capacity of lower than 10%. #d11d14
chargingColor string The color of the charging icon. ‘rgba(0,0,0,.5)’
isCharging boolean The non-standard DP to show whether the device is in the charging mode. false
wireless_electricity number The standard DP to report the battery capacity. undefined
wireless_powermode string The standard DP to specify the power supply mode. undefined
battery_report_cap string The standard DP to enable accurate reporting. undefined
onChangeEleValue string The standard DP to listen for the battery capacity changes. undefined

Example

import { TYIpcBattery } from '@tuya/tuya-panel-ipc-sdk';
...
  // Customize the values.
  <TYIpcBattery value={value} standardDpMode={false} />
  // Standard DPs.
  <TYIpcBattery
    wireless_electricity={value}
    wireless_powermode="1"
    battery_report_cap={undefined}
    onChangeEleValue={onChangeEleValue}
  />