Overview of Locator Open Capabilities

Last Updated on : 2024-06-13 10:32:31download

This topic describes how to integrate with open capabilities of indoor and outdoor fusion locators.

API description

Device management APIs:

API name API endpoint
Set Reporting Frequency POST:/v1.0/fusion-locator/{device_id}/actions/set/frequency

Event format

After you subscribe to the message service for a cloud development project, you can receive event messages from the linked devices. For more information about the integration with a message queue, see Message Queue.

Sign-in

Functional description

An indoor and outdoor fusion locator reports a sign-in event to the user. The event code is check_in.

Description of value

Parameter Type Description Required
t Long The 13-digit timestamp of the time when a person signs in. Yes

Example

{
    "dataId": "AAXRV4BrtW9BRB9A2JYW****",
    "devId": "6ca****",
    "productKey": "e6rz6vba81wm****",
    "status": [
        {
            "5": "{\"t\":1637548630452}",
            "code": "check_in",
            "t": 1637548630455,
            "value": "{\"t\":1637548630452}"
        }
    ]
}

Sign-out

Functional description

An indoor and outdoor fusion locator reports a sign-out event to the user. The event code is sign_out.

Description of value

Parameter Type Description Required
t Long The 13-digit timestamp of the time when a person signs out. Yes

Example

{
    "dataId": "AAXRV4BrtW9BRB9A2JYW****",
    "devId": "6ca****",
    "productKey": "e6rz6vba81wm****",
    "status": [
        {
            "6": "{\"t\":1637548630452}",
            "code": "sign_out",
            "t": 1637548630455,
            "value": "{\"t\":1637548630452}"
        }
    ]
}

Alert

Functional description

An indoor and outdoor fusion locator reports an alert event to the user. The event code is alarm_info_report.

Description of value

Parameter Type Description Required
t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
type Integer The alert type.
  • 1 indicates an SOS alert.
  • 2 indicates low battery.
  • 3 indicates shutdown.
  • 4 indicates the specified SOS alert is canceled.
Yes
info String The content of an alert. Yes

Example

{
    "dataId": "AAXRV4BrtW9BRB9A2JYW****",
    "devId": "6ca****",
    "productKey": "e6rz6vba81wm****",
    "status": [
        {
            "2": "{\"t\":1637548630452,\"type\":1,\"info\":\"SOS\"}",
            "code": "alarm_info_report",
            "t": 1637548630455,
            "value": "{\"t\":1637548630452,\"info\":\"SOS\"}"
        }
    ]
}

Battery level

Functional description

An indoor and outdoor fusion locator reports a battery level event to the user. The event code is battery_info.

Description of value

Parameter Type Description Required
t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
battery Double The battery percentage, with a precision of two decimal places. Yes
version String The version number of the firmware. No

Example

{
    "dataId": "AAXRV4BrtW9BRB9A2JYW****",
    "devId": "6ca****",
    "productKey": "e6rz6vba81wm****",
    "status": [
        {
            "3": "{\"t\":1637548630452,\"battery\":20.00}",
            "code": "battery_info",
            "t": 1637548630455,
            "value": "{\"t\":1637548630452,\"battery\":20.00,\"version\":\"G805.9.1023\"}"
        }
    ]
}

Step counting data

Functional description

An indoor and outdoor fusion locator reports the step counting data to the user. The event code is count_steps.

Description of value

Parameter Type Description Required
t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
steps Integer The number of steps. Yes

Example

{
    "dataId": "AAXRV4BrtW9BRB9A2JYW****",
    "devId": "6ca****",
    "productKey": "e6rz6vba81wm****",
    "status": [
        {
            "3": "{\"t\":1637548630452,\"steps\":100}",
            "code": "count_steps",
            "t": 1637548630455,
            "value": "{\"t\":1637548630452,\"steps\":100}"
        }
    ]
}

Positioning data

An indoor and outdoor fusion locator reports a positioning event to the user. The event code is position_event.

Currently, the following positioning types are supported:

  • 1: GPS positioning
  • 2: Wi-Fi positioning
  • 3: Location-based service (LBS) positioning
  • 4: Bluetooth beacon positioning

You can distinguish the positioning data type based on the type field.

  • GPS positioning

    Description of value:

    Parameter Type Description Required
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 1, GPS positioning is used. Yes
    lat Double The longitude, with a precision of six decimal places. No
    lng Double The latitude, with a precision of six decimal places. No

    Example:

    {
        "dataId": "AAXRV4BrtW9BRB9A2JYW****",
        "devId": "6ca****",
        "productKey": "e6rz6vba81wm****",
        "status": [
            {
                "1": "{\"t\":1637548630452,\"lat\":31.210463,\"lng\":121.606855}",
                "code": "position_event",
                "t": 1637548630455,
                "value": "{\"t\":1637548630452,\"lat\":31.210463,\"lng\":121.606855}"
            }
        ]
    }
    
  • Wi-Fi positioning

    Description of value:

    Parameter Type Description Required
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 2, Wi-Fi positioning is used. Yes
    lat Double The longitude, with a precision of six decimal places. No
    lng Double The latitude, with a precision of six decimal places. No

    Example:

    {
        "dataId": "AAXRV4BrtW9BRB9A2JYW****",
        "devId": "6ca****",
        "productKey": "e6rz6vba81wm****",
        "status": [
            {
                "1": "{\"t\":1637548630452,\"lat\":31.210463,\"lng\":121.606855}",
                "code": "position_event",
                "t": 1637548630455,
                "value": "{\"t\":1637548630452,\"lat\":31.210463,\"lng\":121.606855}"
            }
        ]
    }
    
  • LBS positioning

    Description of value:

    Parameter Type Description Required
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 3, LBS positioning is used. Yes
    bsId String The cell ID (CID) of the specified base station. No
    db Integer The signal strength. Both positive values and negative values are supported. No
    lac String The location area code (LAC) of the specified base station. No

    Example:

    {
        "dataId": "AAXRV4BrtW9BRB9A2JYW****",
        "devId": "6ca****",
        "productKey": "e6rz6vba81wm****",
        "status": [
            {
                "1": "{\"t\":1637548630452,\"bsId\":\"1\",\"lac\":\"2\",\"db\":12}",
                "code": "position_event",
                "t": 1637548630455,
                "value": "{\"t\":1637548630452,\"bsId\":\"1\",\"lac\":\"2\",\"db\":12}"
            }
        ]
    }
    
  • Bluetooth beacon positioning

    Description of value:

    Parameter Type Description Required
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 4, Bluetooth beacon positioning is used. Yes
    bleId String The CID of the specified Bluetooth device. No
    bleDeviceId String The ID of the specified Bluetooth device. No
    db Integer The signal strength. Both positive values and negative values are supported. No

    Example:

    {
        "dataId": "AAXRV4BrtW9BRB9A2JYW****",
        "devId": "6ca****",
        "productKey": "e6rz6vba81wm****",
        "status": [
            {
                "1": "{\"t\":1637548630452,\"bleId\":\"1\",\"bleDeviceId\":\"2\",\"db\":12}",
                "code": "position_event",
                "t": 1637548630455,
                "value": "{\"t\":1637548630452,\"bleId\":\"1\",\"bleDeviceId\":\"2\",\"db\":12}"
            }
        ]
    }
    

Event format v1.0

Device event messages of an indoor and outdoor fusion locator are compatible with v1.0 format. If you want to subscribe to the v1.0 format, please submit a service ticket to contact Tuya’s staff. For more information about the integration process, see Integration with event format v1.0 of devices in public area.

Sign-in

Functional description

After sign-in is triggered, the indoor and outdoor fusion locator reports a sign-in event to the user.

Parameters

Parameter Type Description Required
bizCode String The business code of the specified event. Default value: edge_device. Yes
eventType String The type of the specified event. Default value: edge_report_data. Yes
mode String The mode of the specified event. Default value: sign_in. Yes
deviceId String The ID of a Tuya-enabled device. Yes
t Long The 13-digit timestamp of the time when a person signs in. Yes

Example

{
    "data": "{\"mode\":\"sign_in\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591}}",
    "bizCode": "edge_device",
    "eventType": "edge_report_data"
}

Sign-out

Functional description

After sign-out is triggered, the indoor and outdoor fusion locator reports a sign-out event to the user.

Parameters

Parameter Type Description Required
bizCode String The business code of the specified event. Default value: edge_device. Yes
eventType String The type of the specified event. Default value: edge_report_data. Yes
mode String The mode of the specified event. Default value: sign_out. Yes
deviceId String The ID of a Tuya-enabled device. Yes
t Long The 13-digit timestamp of the time when a person signs out. Yes

Example

{
    "data": "{\"mode\":\"sign_out\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591}}",
    "bizCode": "edge_device",
    "eventType": "edge_report_data"
}

Alert

Functional description

An indoor and outdoor fusion locator reports an alert event to the user.

Parameters

Parameter Type Description Required
bizCode String The business code of the specified event. Default value: edge_device. Yes
eventType String The type of the specified event. Default value: edge_report_data. Yes
mode String The mode of the specified event. Default value: alarm_info_report. Yes
deviceId String The ID of a Tuya-enabled device. Yes
t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
type Integer The alert type. 1 indicates an SOS alert. Yes
info String The content of an alert. Yes

Example

{
    "data": "{\"mode\":\"alarm_info_report\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591,\\\"type\\\":1,\\\"info\\\":\\\"SOS\\\" }}",
    "bizCode": "edge_device",
    "eventType": "edge_report_data"
}

Battery level

Functional description

An indoor and outdoor fusion locator reports a battery level event to the user.

Parameters

Parameter Type Description Required
bizCode String The business code of the specified event. Default value: edge_device. Yes
eventType String The type of the specified event. Default value: edge_report_data. Yes
mode String The mode of the specified event. Default value: battery_info. Yes
deviceId String The ID of a Tuya-enabled device. Yes
t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
battery Double The battery percentage, with a precision of two decimal places. Yes

Example

{
    "data": "{\"mode\":\"battery_info\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591,\\\"battery\\\":20.00}}",
    "bizCode": "edge_device",
    "eventType": "edge_report_data"
}

Step counting data

Functional description

An indoor and outdoor fusion locator reports the step counting data to the user.

Parameters

Parameter Type Description Required
bizCode String The business code of the specified event. Default value: edge_device. Yes
eventType String The type of the specified event. Default value: edge_report_data. Yes
mode String The mode of the specified event. Default value: step. Yes
deviceId String The ID of a Tuya-enabled device. Yes
t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
steps Integer The number of steps. Yes

Example

{
    "data": "{\"mode\":\"step\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591,\\\"steps\\\":100}}",
    "bizCode": "edge_device",
    "eventType": "edge_report_data"
}

Positioning data

An indoor and outdoor fusion locator reports a positioning data event to the user. Currently, the following positioning types are supported:

  • 1: GPS positioning
  • 2: Wi-Fi positioning
  • 3: Location-based service (LBS) positioning
  • 4: Bluetooth beacon positioning

You can distinguish the positioning data type based on the type field.

  • GPS positioning

    Parameter description:

    Parameter Type Description Required
    bizCode String The business code of the specified event. Default value: edge_device. Yes
    eventType String The type of the specified event. Default value: edge_report_data. Yes
    mode String The mode of the specified event. Default value: position_event. Yes
    deviceId String The ID of a Tuya-enabled device. Yes
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 1, GPS positioning is used. Yes
    lat Double The longitude, with a precision of six decimal places. No
    lng Double The latitude, with a precision of six decimal places. No

    Example:

    {
        "data": "{\"mode\":\"position_event\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591,\\\"type\\\":1,\\\"lat\\\":31.210463,\\\"lng\\\":121.606855}}",
        "bizCode": "edge_device",
        "eventType": "edge_report_data"
    }
    
  • Wi-Fi positioning

    Parameter description:

    Parameter Type Description Required
    bizCode String The business code of the specified event. Default value: edge_device. Yes
    eventType String The type of the specified event. Default value: edge_report_data. Yes
    mode String The mode of the specified event. Default value: position_event. Yes
    deviceId String The ID of a Tuya-enabled device. Yes
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 2, Wi-Fi positioning is used. Yes
    lat Double The longitude, with a precision of six decimal places. No
    lng Double The latitude, with a precision of six decimal places. No

    Example:

    {
        "data": "{\"mode\":\"position_event\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591,\\\"type\\\":2,\\\"lat\\\":31.210463,\\\"lng\\\":121.606855}}",
        "bizCode": "edge_device",
        "eventType": "edge_report_data"
    }
    
  • LBS positioning

    Parameter description:

    Parameter Type Description Required
    bizCode String The business code of the specified event. Default value: edge_device. Yes
    eventType String The type of the specified event. Default value: edge_report_data. Yes
    mode String The mode of the specified event. Default value: position_event. Yes
    deviceId String The ID of a Tuya-enabled device. Yes
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 3, LBS positioning is used. Yes
    bsId String The cell ID (CID) of the specified base station. No
    db Integer The signal strength. Both positive values and negative values are supported. No
    lac String The location area code (LAC) of the specified base station. No

    Example:

    {
        "data": "{\"mode\":\"position_event\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591,\\\"type\\\":3,\\\"bsId\\\":\\\"1\\\",\\\"lac\\\":\\\"2\\\",\\\"db\\\":12}}",
        "bizCode": "edge_device",
        "eventType": "edge_report_data"
    }
    
  • Bluetooth beacon positioning

    Parameter description:

    Parameter Type Description Required
    bizCode String The business code of the specified event. Default value: edge_device. Yes
    eventType String The type of the specified event. Default value: edge_report_data. Yes
    mode String The mode of the specified event. Default value: position_event. Yes
    deviceId String The ID of a Tuya-enabled device. Yes
    t Long The 13-digit timestamp of the time when the specified event is triggered. Yes
    type Integer When the value of type is 4, Bluetooth beacon positioning is used. Yes
    bleId String The CID of the specified Bluetooth device. No
    bleDeviceId String The ID of a Tuya’s Bluetooth device. No
    db Integer The signal strength. Both positive values and negative values are supported. No

    Example:

    {
        "data": "{\"mode\":\"position_event\",\"data\":\"{\\\"deviceId\\\":\\\"6ca****\\\",\\\"t\\\":1612514362591,\\\"type\\\":4,\\\"bleId\\\":\\\"1\\\",\\\"bleDeviceId\\\":\\\"6ca****\\\",\\\"db\\\":12}}",
        "bizCode": "edge_device",
        "eventType": "edge_report_data"
    }