Overview of Smart Water Meter Open Capabilities

Last Updated on : 2023-06-15 05:30:55

This topic describes how to integrate with open capabilities of smart water meters.

Manage smart water meters

API Name API endpoint
Set Valve Openness POST:/v1.0/water-meter/{device_id}/actions/valve-open-degree

Smart water meter event format

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

Report monitoring data

API description

The smart water meter reports device monitoring data.

Description of status

Response data is classified by data type for each data point identifier (DP code).

List of data types

DP code for metrics Data description Data type
water_flow Water flow Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
monthly_water_total Total monthly water consumption Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
daily_water_total Total daily water consumption Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
switch_state Switch status Boolean type.
d_begin_water_total First reading of a day Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
d_end_water_total Last reading of a day Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
d_begin_time First reading time of a day String type.
d_end_time Last reading time of a day String type.
valve_state Valve status Enum type. Valid values:
  • opened: opened
  • closed: closed
  • opening: opening
  • closing: closing
m_begin_water_total First reading of a month Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
m_end_water_total Last reading of a month Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
m_begin_time First reading time of a month String type.
m_end_time Last reading time of a month String type.
cold_stall_userdata Usage of shared cold water Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
cold_stall_type Sharing type of cold water Enum type. Valid values:
  • square_area: by area in square units
  • ignore: ignore
  • consumption: by electricity consumption
  • proportion: by proportion
  • lease: lease
  • power: by power
hot_stall_userdata Usage of shared hot water Long type, in m³. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.
hot_stall_type Sharing type of hot water Enum type. Valid values:
  • square_area: by area in square units
  • ignore: ignore
  • consumption: by electricity consumption
  • proportion: by proportion
  • lease: lease
  • power: by power
valve_open_degree Valve openness Long type, in %. The reported value has been magnified 1,000 times to deal with the decimal point. The value must be divided by 1,000 to get the real value.

Example

{
    "dataId": "AAXRV4BrtW9BRB9A2JYW****",
    "devId": "6ca****",
    "productKey": "ataawino67sm****",
    "status": [
        {
            "18": 121,
            "code": "valve_open_degree",
            "t": 1637548630455,
            "value": 121
        }
    ]
}

Smart water meter 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.

Report the collected data

API description

The data collected by the smart water meter is reported to Tuya IoT Cloud. You will also be notified.

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: water_meter_monitor. Yes
data String The data string in the JSON format. Yes

Description of data

Parameter name Data type Description Required
mode String The mode of a specified event. Default value: water_meter_monitor. Yes
data String The event string in the JSON format. Yes

Description of event string

Parameter name Data type Description Required
deviceId String The ID of a Tuya device. Yes
type String The sampling metric. Yes
value Double The value of a sampling metric. Yes
happenTime Long The timestamp. Yes

Fields of sampling value type

type Description
totalFlow Total flow rate
monthlyFlow Total monthly water consumption
dailyFlow Total daily water consumption
dailyBeginFlow First reading of a day
dailyEndFlow Last reading of a day
dailyBeginTime First reading time of a day
dailyEndTime Last reading time of a day
monthlyBeginFlow First reading of a month
monthlyEndFlow Last reading of a month
monthlyBeginTime First reading time of a month
monthlyEndTime Last reading time of a month
valueStatus Valve status
switchStatus Switch status

Example

{
	"data": "{\"mode\":\"water_meter_monitor\",\"data\":\"{\\\"deviceId\\\":\\\"002dj00118fe34d9****\\\",\\\"happenTime\\\":1612514362591,\\\"type\\\":\\\"dailyBeginFlow\\\" ,\\\"value\\\":1}}",
	"bizCode": "edge_device",
	"eventType": "edge_report_data"
}