Last Updated on : 2022-02-17 06:56:38download
This topic describes how to use the guest access control module of the Smart Community App SDK. Multiple features are supported. For example, create guest passes, get a list of passes, cancel an invitation, and configure pass information.
You must first query the current community ID in the house management module.
Required class
Class name | Description |
---|---|
getVisitorInstance() | Manages guest access control. |
Visit reason data model TuyaCommunityVisitorReasonBean
Property | Type | Description |
---|---|---|
visitorReasonId | String | The ID of a visit reason. |
visitorReason | String | The visit reason. |
remark | String | The remarks. |
timeLimitType | int | The type of time limit. Valid values:
|
timeLimitValue | int | The value of a time limit. |
Visit pass information TuyaCommunityVisitorInfoBean
Property | Type | Description |
---|---|---|
visitorId | String | The ID of the guest. |
visitorName | String | The name of the guest. |
visitorPhone | String | The mobile phone number of the guest. |
sex | String | The gender of the guest. Valid values:
|
visitorReason | String | The visit reason. |
visitorAddressId | String | The ID of the destination address. The value is the same as roomId for a house ID. |
visitorAddress | String | The destination address. |
visitorTime | long | The visit time. |
visitorStatus | int | The visit state. Valid values:0 : not visit1 : visited2 : delayed and not visit |
visitorFrom | int | The source of the guest. Valid values:1 : registered by the property management staff2 : invited by an owner |
hasCar | int | Specifies whether the guest drives a car. Valid values:
|
carNum | String | The license plate number. |
visitorFace | String | The biometric identity. |
startTime | long | The start time of a visit. |
endTime | long | The end time of a visit. |
intervieweeName | String | The name of the host. |
intervieweePhone | String | The mobile phone number of the host. |
visitorCapabilityList | List |
The type of access control method: Valid values: 1 : QR code 2 : biometric identity |
Pass list data model TuyaCommunityVisitorInfoBean
Property | Type | Description |
---|---|---|
visitorId | String | The ID of the guest. |
visitorName | String | The name of the guest. |
phone | String | The mobile phone number of the guest. |
sex | String | The gender of the guest. Valid values:
|
visitorReason | String | The visit reason. |
visitorAddress | String | The destination address. |
intervieweeName | String | The name of the host. |
intervieweePhone | String | The mobile phone number of the host. |
visitorTime | long | The visit time. |
visitorStatus | int | The visit state. Valid values:0 : not visit1 : visited2 : delayed and not visit |
visitorStatusStr | String | The string of the visit state. |
visitorFrom | int | The source of the guest. Valid values:1 : registered by the property management staff2 : invited by an owner |
applyTime | long | The time when the guest information is submitted. |
startTime | logn | The start time of a visit. |
endTime | long | The end time of a visit. |
carNum | String | The license plate number. |
Returns a list of visit reasons that are provided by guests in real time when they submit guest information to generate guest passes.
API description
void getVisitorReasonList(String communityId, ITuyaCommunityResultCallback<ArrayList<TuyaCommunityVisitorReasonBean>> callback);
Request parameter
Parameter | Type | Description |
---|---|---|
communityId | String | The community ID. |
Return parameter
Parameter | Description |
---|---|
onSuccess(ArrayList |
The list of visit reasons. |
onFailure(String s, String s1) | The failure callback.
|
Example
TuyaCommunitySDK.getVisitorInstance().getVisitorReasonList(communityId, new ITuyaCommunityResultCallback<ArrayList<TuyaCommunityVisitorReasonBean>>() {
@Override
public void onSuccess(ArrayList<TuyaCommunityVisitorReasonBean> bean) {
}
@Override
public void onFailure(String s, String s1) {
}
});
Indicates whether a guest drives a car. This information is provided by guests when they submit guest information to generate guest passes. This API method can be called to check whether a community allows guest vehicle access.
In the response, a Boolean value is returned. true
indicates that guest vehicle access is allowed. false
indicates that guest vehicle access is not allowed.
API description
void getCarConfig(String communityId, ITuyaCommunityResultCallback<Boolean> callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
Return parameter
Parameter | Description |
---|---|
onSuccess(Boolean aBoolean) | Indicates whether guest vehicle access is allowed in the community. Valid values:
|
onFailure(String s, String s1) | The failure callback.
|
Example
TuyaCommunitySDK.getVisitorInstance().getCarConfig(communityId, new ITuyaCommunityResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean aBoolean) {
}
@Override
public void onFailure(String s, String s1) {
}
});
Generates a guest pass after guests submit the name, gender, mobile phone number, visit reason, and other required information.
This API method can be used to query a list of visit reasons and whether guests drive to the community.
API description
void createPass(String communityId, String visitorName, String visitorPhone, int sex, String visitorReason, long startTime, long endTime, String visitorAddressId, int driveCar, @Nullable String carNum, TuyaCommunityVisitorFromEnum visitorFrom, ITuyaCommunityResultCallback<String> callback);
Request parameter
Parameter | Required | Type | Description |
---|---|---|---|
communityId | Yes | String | The community ID. |
visitorName | Yes | String | The name of the guest. |
visitorPhone | Yes | String | The mobile phone number of the guest. |
sex | Yes | int | The gender of the guest. Valid values:
|
visitorReasonId | Yes | String | The ID of the visit reason. |
startTime | Yes | long | The time when the guest arrives at the community. |
endTime | Yes | long | The time when the guest leaves the community. |
roomId | Yes | String | The room ID. |
driveCar | No | int | Specifies whether the guest drives to the community. Valid values:
true . Then, this parameter can be set. Otherwise, the setting of this parameter is invalid. |
carNum | No (required for a driving visit) | String | The license plate number. |
visitorFrom | Yes | enum(TuyaCommunityVisitorFromEnum) | The source of the guest. Valid values:1 : registered by the property management staff2 : invited by an owner |
Example
TuyaCommunitySDK.getVisitorInstance().createPass(communityId,visitorName,visitorPhone, TuyaCommunityGenderType.Female,visitorReason,startTime,endTime,rommId,driveCar,carNum, TuyaCommunityVisitorFromEnum.Owner,new ITuyaCommunityResultCallback<String>() {
@Override
public void onSuccess(String s) {
callback.onSuccess(s);
}
@Override
public void onFailure(String s, String s1) {
callback.onFailure(s, s1);
}
});
Cancels a visit prior to the start time of the guest’s visit. Then, the guest is not allowed to visit the community. The guest can be invited to visit again.
API description
void cancelPass(String communityId, String visitorId, ITuyaCommunityResultCallback<Boolean> callback);
Request parameter
Parameter | Type | Description |
---|---|---|
communityId | String | The community ID. |
visitorId | String | The guest ID. The value is included in the list of passes. |
Return parameter
Parameter | Description |
---|---|
onSuccess(Boolean aBoolean) | The success callback. Valid values:
|
onFailure(String s, String s1) | The failure callback.
|
Example
TuyaCommunitySDK.getVisitorInstance().cancelPass(communityId, visitorId, new ITuyaCommunityResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
}
@Override
public void onFailure(String s, String s1) {
}
});
Returns details of a guest pass, including the name, gender, visit start time, visit end time, destination, and whether the guest arrives.
API description
void getVisitorPassInfo(String communityId, String visitorId, ITuyaCommunityResultCallback<TuyaCommunityVisitorInfoBean> callback);
Request parameter
Parameter | Type | Description |
---|---|---|
communityId | String | The community ID. |
visitorId | String | The guest ID. The value is included in the list of passes. |
Return parameter
Parameter | Description |
---|---|
onSuccess(TuyaCommunityVisitorInfoBean tuyaCommunityVisitorInfoBean) | The details of the pass. |
onFailure(String s, String s1) | The failure callback.
|
Example
TuyaCommunitySDK.ggetVisitorInstance().getVisitorPassInfo(communityId, visitorId, new ITuyaCommunityResultCallback<TuyaCommunityVisitorInfoBean>() {
@Override
public void onSuccess(TuyaCommunityVisitorInfoBean tuyaCommunityVisitorInfoBean) {
}
@Override
public void onFailure(String s, String s1) {
}
});
Returns a list of passes for a user. Passes in the following states are included: not visit, delayed and not visit, canceled, and visited. Entries can be returned on pages.
API description
void getVisitorRecordList(String communityId, String roomId, int pageNo, int pageSize, ITuyaCommunityResultCallback<TuyaCommunityVisitorRecordListBean> callback);
Request parameter
Parameter | Type | Description |
---|---|---|
communityId | String | The community ID. |
roomId | String | The room ID. |
pageNo | int | The number of the current page. |
pageSize | int | The number of entries per page. |
Return parameter
Parameter | Description |
---|---|
onSuccess(TuyaCommunityVisitorRecordListBean bean | The list of returned passes. |
onFailure(String s, String s1) | The failure callback.
|
Example
TuyaCommunitySDK.getVisitorInstance().getVisitorRecordList(communityId, roomId, pageNo, pageSize,
new ITuyaCommunityResultCallback<TuyaCommunityVisitorRecordListBean>() {
@Override
public void onSuccess(TuyaCommunityVisitorRecordListBean bean) {
}
@Override
public void onFailure(String s, String s1) {
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback