> For the complete documentation index, see [llms.txt](https://docs.mclimate.eu/mclimate-api-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mclimate.eu/mclimate-api-documentation/control-devices/flood-sensor-lorawan.md).

# Flood Sensor LoRaWAN

### Get device data

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

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

*Body*:

```
{
  "serial_number" : "{Flood Serial Number}"
}
```

*Response:*

```
{
    "provider": {
        "network_provider": "the_things_network",
        "rssi": 0,
        "boxTamper": false,
        "flood": false,
        "temperature": 24,
        "battery": 3.088,
        "createdAt": "2021-02-08T15:15:22.516Z",
        "lastActive": "2021-02-19T15:36:44.731Z",
        "online": false
    },
    "_links": {
        "self": {
            "href": "/v1/provider/fetch"
        }
    }
}
```

### Get Temperature

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

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

*Body*:

```
{
  "serial_number" : "{Flood Serial Number}",
  "command" : "get_temperature"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "603114ad0355950a25d5175e",
        "commandName": "GetTemperature",
        "commandParams": "",
        "deviceId": "313638353E387F18",
        "createdAt": "2021-02-20T13:54:53.497Z",
        "__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": “{Flood Serial Number}”,
  "command" : "set_keepalive_time",
  "time" : 3 // in minutes
}
```

*Response:*

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

### Set Flood Alarm Time

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{Flood Serial Number}”,
  "command" : "set_flood_alarm_time",
  "time" : 10, //seconds, cannot be 0
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "603117d8fd3e800bf072899f",
        "commandName": "SetFloodAlarmTime",
        "commandParams": {
            "time": 10
        },
        "deviceId": "31**************18",
        "createdAt": "2021-02-20T14:08:24.155Z",
        "__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": “{Flood 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": “{Flood 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" : 20 // ms; min 10ms
}
```

*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"
        }
    }
}
            "href": "/v1/provider/send"
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
