# HT Sensor LoRaWAN

### Get device data

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

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

*Body*:

```
{
  "serial_number" : "{HT-Sensor Serial Number}"
}
```

*Response:*

```
{
    "provider": {
        "network_provider": "the_things_network",
        "rssi": -59,
        "spf": "SF7BW125",
        "sensorTemperature": 23.7,
        "relativeHumidity": 28.90625,
        "batteryVoltage": 3,
        "createdAt": "2021-02-10T15:21:23.718Z",
        "lastActive": "2021-02-24T21:10:58.777Z",
        "keepAliveTime": 3,
        "joinRetryPeriod": 2,
        "deviceVersions": {
            "hardware": 16,
            "software": 16
        },
        "uplinkType": "01",
        "online": true,
        "mac": "70B************4"
    },
    "_links": {
        "self": {
            "href": "/v1/provider/fetch"
        }
    }
}
```

### Set KeepAlive Time

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{HT-Sensor Serial Number}”,
  "command" : "set_keepalive_time",
  "time" : 3 // in minutes
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60366d3cbc2b0345b984da00",
        "commandName": "SetKeepAlive",
        "commandParams": {
            "time": 3
        },
        "deviceId": "70B************4",
        "createdAt": "2021-02-24T15:14:04.444Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get KeepAlive Time

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{HT-Sensor Serial Number}”,
  "command" : "get_keepalive_time"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "6036b85b25304f575e082397",
        "commandName": "GetKeepAliveTime",
        "commandParams": [],
        "deviceId": "70B************4",
        "createdAt": "2021-02-24T20:34:35.934Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get Device Version

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

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

*Body*:

```
{
  "serial_number" : "{HT-Sensor Serial Number}",
  "command" : "get_device_version"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "603672f5bc2b0345b984da43",
        "commandName": "GetDeviceVersion",
        "commandParams": [],
        "deviceId": "70B************4",
        "createdAt": "2021-02-24T15:38:29.537Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Set Join Retry Period

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{HT-Sensor Serial Number}”,
  "command" : "set_join_retry_period",
  "period" : 2, //minutes, cannot be 0
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "603675a7bc2b0345b984da63",
        "commandName": "SetJoinRetryPeriod",
        "commandParams": {
            "period": 2
        },
        "deviceId": "70B************4",
        "createdAt": "2021-02-24T15:49:59.095Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get Join Retry Period

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{HT-Sensor Serial Number}”,
  "command" : "get_join_retry_period"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "6036caaf994ab35c7c701bbe",
        "commandName": "GetJoinRetryPeriod",
        "commandParams": [],
        "deviceId": "70B************4",
        "createdAt": "2021-02-24T21:52:47.045Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Set Uplink Type

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{HT-Sensor Serial Number}”,
  "command" : "set_uplink_type",
  "type" : "01"  // string, "00" - unconfirmed, "01" - confirmed
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "6036bf46ed10eb592440aea5",
        "commandName": "SetUplinkType",
        "commandParams": {
            "type": "01"
        },
        "deviceId": "70B************4",
        "createdAt": "2021-02-24T21:04:06.611Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get Uplink Type

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{HT-Sensor Serial Number}”,
  "command" : "get_uplink_type"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "6036be66ed10eb592440ae9b",
        "commandName": "GetUplinkType",
        "commandParams": [],
        "deviceId": "70B************4",
        "createdAt": "2021-02-24T21:00:22.088Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Set Watch Dog Params

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{Serial Number}”,
  "command" : "set_watch_dog_params",
  "confirmed_uplinks": 17, // in minutes, if it is disabled "0"
  "unconfirmed_uplinks":24, // in hours, if it is disabled "0"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "6035505708f81715fffd19c0",
        "commandName": "SetWatchDogParams",
        "commandParams": {
            "periodConfirmenUplinks": 17,
            "periodUnconfirmenUplinks": 24,
            "deviceKeepAlive": 3
        },
        "deviceId": "36*************8",
        "createdAt": "2021-02-23T18:58:31.945Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get Watch Dog Params

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{HT Serial Number}”,
  "command" : "get_watch_dog_params"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "6036ce5bf6c1b85f22d280cc",
        "commandName": "GetWatchDogParams",
        "commandParams": [],
        "deviceId": "36*************8",
        "createdAt": "2021-02-24T22:08:27.116Z",
        "__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": “{HT 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"
        }
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mclimate.eu/mclimate-api-documentation/control-devices/ht-sensor-lorawan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
