Overview of Smart Firefighting Device Open Capabilities

Last Updated on : 2024-06-13 10:35:23download

This topic describes how to integrate with open capabilities of smart firefighting devices.

Control and manage smart firefighting devices

API name API endpoint
Mute Device POST:/v1.0/fire-control/{device_id}/actions/silence-enable

Smart firefighting device event format

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

Data format

Multiple data point identifiers (DP codes) are combined into event data to be reported.

Example:

{
    "dataId": "AAXRV4BrtW9BRB9A2JYW****",
    "devId": "6ca",
    "productKey": "obxxba9vowgc****",
    "status": [
        {
            "1": "eed6810d-82e1-41cd-ba4a-7664f31942cb",
            "code": "alarm_trace_id",
            "t": 1637548630455,
            "value": "eed6810d-82e1-41cd-ba4a-7664f31942cb"
        },
				{
            "5": "Not processed",
            "code": "alarm_result_content",
            "t": 1637548630455,
            "value": "Not processed"
        },
      	{
            "6": 4065,
            "code": "alarm_value",
            "t": 1637548630455,
            "value": 4065
        },
      	{
            "4": 1650433413000,
            "code": "alarm_trace_time",
            "t": 1637548630455,
            "value": 1650433413000
        },
      	{
            "2": "Alarm triggered when the upper limit is exceeded",
            "code": "alarm_event_content",
            "t": 1637548630455,
            "value": "Alarm triggered when the upper limit is exceeded"
        },
      	{
            "7": "MPa",
            "code": "alarm_unit",
            "t": 1637548630455,
            "value": "MPa"
        },
     	 	{
            "3": "device_alarm",
            "code": "fire_alarm_type",
            "t": 1637548630455,
            "value": "device_alarm"
        }
		]
}

Report alarm data

List of data types

DP code for alarms Data description Data type
alarm_trace_id Alarm event ID String type.
alarm_event_content Alarm content String type.
fire_alarm_type Fire alarm type Enum type. Valid values:
  • fire_alarm: fire alarm
  • device_alarm: device alarm
  • device_fault: device fault
  • signal_fault: communication fault
  • upper_alarm: an alarm triggered when the upper limit is reached
  • lower_alarm: an alarm triggered when the lower limit is reached
  • low_battery: low battery alarm
  • state_fault: state alarm
  • others: other types
alarm_trace_time Event occurrence time String type.
alarm_result_content Event processing result String type.
alarm_value Event value Long type. The reported value has been magnified by 10,000 times to deal with the decimal places. The value must be divided by 10,000 to get the real value.
alarm_unit Alarm unit String type.
alarm_process_time Alarm processing time String type.
alarm_level Alarm severity level Enum type. Valid values:
  • event: event
  • secondary: secondary
  • important: important
  • urgent: urgent

Report monitoring data

List of data types

DP code for monitoring Data description Data type
monitor_name Monitoring metric name String type.
monitor_data Monitoring metric data String type.
monitor_value Monitoring metric value Long type. The reported value has been magnified by 10,000 times to deal with the decimal places. The value must be divided by 10,000 to get the real value.
monitor_unit Monitoring metric unit String type.
monitor_time Monitoring time String type.

Smart firefighting event format v1.0

Device event messages are compatible with v1.0 format. If you want to subscribe to the v1.0 format, please contact Tuya’s staff. For more information about the integration process, see Device event format v1.0.

Send alarms

API description

You will be notified by messages when a firefighting device sends an alarm or goes wrong.

Parameters

Parameter name Data type Description Required
bizCode String The business code of a specified event. Default value: edge_device. Yes
eventType String The type of a specified event. Default value: edge_report_data. Yes
mode String The mode of a specified event. Default value: fire_alarm. Yes
deviceId String The ID of a specified Tuya device. Yes
alarm_trace_id String The ID of a specified alarm event. It is used to update the event processing result alarm_result_content after an alarm is triggered. Yes
alarm_event_content String Describe the content of an alarm. Yes
fire_alarm_type Enum Fire alarm type. {“range”:[“fire_alarm”,“device_fault”,“device_alarm”,“others”]}. Alarm types include fire alarm, device fault (low battery), and device alarm. Yes
alarm_trace_time String The 13-digit timestamp when an event occurs. Unit: milliseconds. Yes
alarm_result_content float Describe the event processing result. The specific content is defined by the third-party platform. This document only provides an example. Yes
alarm_value float The event value. Yes
alarm_unit String The unit of an alarm. It is related to the event value, such as the degree Celsius. Yes
alarm_process_time String The timestamp when an alarm is processed. Unit: in milliseconds. No

Example

{
    "data": "{\"data\":{\"deviceId\":\"6c0********z\",\"dpData\":{\"alarm_trace_id\":\"87-ebe9-47e1-8bab-66f9***4\",\"alarm_event_content\":\"Lower limit alarm\",\"fire_alarm_type\":\"device_alarm\",\"alarm_trace_time\":\"15****87\",\"alarm_result_content\":\"Unprocessed\",\"alarm_value\":\“0.003\”,\"alarm_unit\":\"cm\",\"alarm_process_time\":\"1595495410187\"}},\"mode\":\"fire_alarm\"}",
    "bizCode": "edge_device",
    "eventType": "edge_report_data"
}

Report device data

API description

You will be notified by messages when a firefighting device detects any data changes.

Parameters

Parameter name Data type Description Required
bizCode String The business code of a specified event. Default value: edge_device. Yes
eventType String The type of a specified event. Default value: edge_report_data. Yes
mode String The mode of a specified event. Default value: fire_monitor. Yes
deviceId String The ID of a specified Tuya device. Yes
monitor_data String The code of a specified test item. Yes
monitor_name String The name of a specified test item in Chinese. Yes
monitor_value Value The value of the test item data. Yes
monitor_unit String The unit of the test item data. Yes
monitor_time_data String The 13-digit timestamp when the test item data is generated. Unit: milliseconds. Yes

Example

{
    "data": "{\"data\":{\"deviceId\":\"6c0********z\",\"dpData\":{\"monitor_data\":\"tem\",\"monitor_name\":\"Temperature\",\"monitor_value\":0x0502,\"monitor_unit\":\"Degree Celsius\",\"monitor_time_data\":\"1595****0187\"}},\"mode\":\"fire_monitor\"}",
    "bizCode": "edge_device",
    "eventType": "edge_report_data"
}