T-Valve LoRaWAN

Get device data

Request URL:

POST /provider/fetch

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number" : "{T-Valve Serial Number}"
}

Response:

{
    "provider": {
        "network_provider": "the_things_network",
        "rssi": -31,
        "spf": "SF7BW125",
        "valveState": false,
        "boxTamper": true,
        "floodDetectionWireState": false,
        "flood": false,
        "magnet": false,
        "alarmValidated": false,
        "manualOpenIndicator": true,
        "manualCloseIndicator": true,
        "closeTime": 0,
        "openTime": 0,
        "waterTemp": 24.5,
        "ambientTemp": 24.5,
        "battery": 2.872,
        "createdAt": "2021-02-16T11:53:16.526Z",
        "lastActive": "2021-02-23T14:50:24.192Z",
        "online": true
    },
    "_links": {
        "self": {
            "href": "/v1/provider/fetch"
        }
    }
}

Request full data

Request URL:

POST /provider/fetch

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number" : "{T-Valve Serial Number}",
  "command" : "request_full_data"
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "603516aa08f81715fffd1827",
        "commandName": "RequestFullData",
        "commandParams": "",
        "deviceId": "36************1",
        "createdAt": "2021-02-23T14:52:26.634Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set KeepAlive Time

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_keepalive_time",
  "time" : 3 // in minutes
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "602fa06f0a9764116d41b4ab",
        "commandParams": {
            "time": 3
        },
        "commandName": "SetPacketPeriod",
        "deviceId": "3************1",
        "createdAt": "2021-02-19T11:26:39.004Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set Open Close Time

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_open_close_time",
  "opening_time" : 1, //in minutes, range 0-255, cannot be both 0
  "closing_time" : 0 //in minutes, range 0-255, cannot be both 0
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "602fb8470a9764116d41b562",
        "commandName": "SetOpenCloseTime",
        "commandParams": {
            "openingTime": 1,
            "closingTime": 0
        },
        "deviceId": "36************11",
        "createdAt": "2021-02-19T13:08:23.394Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set Manual Control

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_manual_control",
  "enable_open" : false,
  "enable_close" : false
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "602fba020a9764116d41b563",
        "commandName": "SetManualControl",
        "commandParams": {
            "enableOpen": false,
            "enableClose": false
        },
        "deviceId": "363************1",
        "createdAt": "2021-02-19T13:15:46.578Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set Emergency Openings

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_emergency_openings",
  "max_openings" : 5 // max 15
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "602fba020a9764116d41b563",
        "commandName": "SetEmergencyOpenings",
        "commandParams": {
            "maxOpenings": 5
        },
        "deviceId": "363************1",
        "createdAt": "2021-02-19T13:15:46.578Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set LED

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_led",
  "led_id" : 0,
  "behavior" : 1,
  "senonds" : 2 //IF seconds=0, execute the command until OK button is pressed or 
    //next command is received
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "602fba020a9764116d41b563",
        "commandName": "SetLED",
        "commandParams": {
            "ledId": 0,
            "behavior": 1,
            "seconds": 2
        },
        "deviceId": "363************1",
        "createdAt": "2021-02-19T13:15:46.578Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set Buzzer

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_buzzer",
  "volume" : 0, // Volume 15 - off, 0 - min... 14 - max
  "frequency" : 1, // range 0 - 10
  "active_time" : 2, // seconds; 0 - untill volume 15 is received
  "on_time" : 10, // ms; min 10ms
  "off_time" : 2 // ms; min 10 ms
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "602fba020a9764116d41b563",
        "commandName": "SetBuzzer",
        "commandParams": {
            "volume": 0,
            "frequency": 1,
            "activeTime": 2,
            "onTime": 1,
            "offTime": 2
        },
        "deviceId": "363************1",
        "createdAt": "2021-02-19T13:15:46.578Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set Working Voltage

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_working_voltage",
  "voltage" : 1850 // in mV, value less than 1850mV has undefined behavior
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "604b5a5fdf17f60011b5d58c",
        "commandName": "SetWorkingVoltage",
        "commandParams": {
            "voltage": 1850
        },
        "deviceId": "363************1",
        "createdAt": "2021-03-12T12:11:11.300Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Set Device Flood Sensor

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-Valve Serial Number}”,
  "command" : "set_device_flood_sensor",
  "enabled" : true 
}

Response:

{
    "provider": {
        "status": "pending",
        "_id": "604b5cf0df17f60011b5d5bf",
        "commandName": "SetDeviceFloodSensor",
        "commandParams": {
            "enabled": true
        },
        "deviceId": "363************1",
        "createdAt": "2021-03-12T12:22:08.954Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Get Pending Commands

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{T-valve Serial Number}”,
  "command" : "get_pending_commands"
}

Response:

{
    "provider": [
        {
            "_id": "652d43a7c4ff3228464dfb08",
            "deviceId": "70B**********8B",
            "commandName": "GetKeepAliveTime",
            "commandParams": [],
            "status": "queued",
            "createdAt": "2023-10-16T14:07:35.872Z",
            "__v": 0
        }
    ],
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

Last updated