# Multipurpose Button LoRaWAN

### Get device data

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

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

*Body*:

```json
{
  "serial_number" : "{Sensor Device Serial Number}"
}
```

*Response:*

```json
{
    "provider": {
        "network_provider": "the_things_industries",
        "application": "mclimate-dev",
        "keepAliveTime": 2,
        "extSensorOn": [],
        "extSensorIs": "",
        "webhook_url": "",
        "rssi": -51,
        "spf": "7",
        "joinRequestCount": 19,
        "frameCount": 4483,
        "deviceVersions": {
            "hardware": 13,
            "software": 10
        },
        "lastActive": "2023-11-14 12:40:14",
        "activeFrom": "2022-11-22 09:03:42",
        "uplinkType": "00",
        "thermistorProperlyConnected": true,
        "batteryVoltage": 3.28,
        "counter": 6,
        "status": 0,
        "notificationBlindTime": 2,
        "sensorTemperature": 19.8,
        "watchDogParams": {
            "wdpC": 17,
            "wdpUc": 24
        },
        "joinRetryPeriod": 10,
        "vickies": [],
        "mac": "70B3D52DD700000F",
        "online": true,
        "scheduleInfo": {
            "inSchedule": false,
            "mainTarget": null,
            "inPriority": false
        }
    },
    "_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": “{Serial Number}”,
  "command" : "send_command_to_button",
  "command_name" : "SetKeepAlive",
  "command_params" : {
      "time": 2 // in minutes
}
```

### Get Device Version

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

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

*Body*:

```
{
  "serial_number" : "{Serial Number}",
  "command" : "send_command_to_button",
  "command_name" : "GetDeviceVersion",
  "command_params" : {}
}
```

### Set Join Retry Period

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{Serial Number}”,
  "command" : "send_command_to_button",
  "command_name" : "SetJoinRetryPeriod",
  "command_params" : {
    "period" : 2, //minutes, cannot be 0
  }
}
```

### Set Uplink Type

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{Serial Number}”,
  "command" : "send_command_to_button",
  "command_name" : "SetUplinkType",
  "command_params" : {
    "type" : "01"  // string, "00" - unconfirmed, "01" - confirmed
  }
}
```

### Set Watch Dog Params

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{Serial Number}”,
  "command" : "send_command_to_button,
  "command_name" : "SetWatchDogParams",
  "command_params" : {
    "confirmedUplinks": 17, // in minutes, if it is disabled "0"
    "unconfirmedUplinks": 24,// in hours, if it is disabled "0"
  }
}
```

### Set Send event button later

\*More info: <https://docs.mclimate.eu/mclimate-lorawan-devices/devices/mclimate-multipurpose-button-lorawan/mclimate-button-lorawan-device-communication-protocol/network-related-settings#set-send-event-button-later-when-it-is-allowed>

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number" : "P61F121340A7SK",
  "command" : "send_command_to_button",
  "command_name" : "SetSendEventLater",
  "command_params" : {
      "value": 1 
  }
}
```


---

# 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/multipurpose-button-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.
