Last Updated on : 2021-08-27 11:07:18download
TYIpcPir
is used to manage the monitoring area of a passive infrared sensor (PIR sensor). You can specify the number of monitoring areas and set the attributes of each monitoring area.
Field name | Type | Description | Default value |
---|---|---|---|
pieNumber | number | The number of sectors. Maximum value: 3. | 1 |
containerStyle | ViewStyle | The style of the container. | {} |
title | string | The title text. | ‘PIR Title’ |
titleStyle | TextStyle | The style of the title text. | {} |
activeColor | string | The color of the active label. | ‘#fc2f07’ |
OnText | string | The text that indicates the enabled state. | ‘ON’ |
OffText | string | The text that indicates the disabled state. | ‘OFF’ |
pieBtnTextStyle | TextStyle | The text style of the switch button. | {} |
dpCodeA | string | The dpcode value or custom key value of the PIR monitoring area A. |
‘flight_pir_a’ |
dpCodeAValue | boolean | The data point (DP) value or custom value of the PIR monitoring area A. | false |
dpCodeB | string | The dpcode value or custom key value of the PIR monitoring area B. |
‘flight_pir_b’ |
dpCodeBValue | boolean | The DP value or custom value of the PIR monitoring area B. | false |
dpCodeC | string | The dpcode value or custom key value of the PIR monitoring area C. |
‘flight_pir_c’ |
dpCodeCValue | boolean | The DP value or custom value of the PIR monitoring area C. | false |
The value of pieNumber
is associated with the effective status of dpCode
and dpCodeValue
. The value of pieNumber
varies based on the following different conditions:
dpCodeA
and dpCodeAValue
take effect.dpCodeA
, dpCodeAValue
, dpCodeB
, and dpCodeBValue
take effect.dpCodeA
, dpCodeAValue
, dpCodeB
, dpCodeBValue
, dpCodeC
, and dpCodeCValue
take effect.import { TYIpcPir } from '@tuya/tuya-panel-ipc-sdk';
...
const [dpCodeAValue, setDpCodeAValue] = useState(false);
const onChangePir = (dpCode: string, value: boolean) => {
if (dpCode === 'flight_pir_a') {
setDpCodeAValue(!value);
}
};
<TYIpcPir
title="Set PIR alarm area"
onChangePir={onChangePir}
dpCodeAValue={dpCodeAValue}
pieNumber={1}
/>
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback