# CO2 Sensor LoRaWAN

### Get device data

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

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

*Body*:

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

*Response:*

```
{
    "provider": {
        "network_provider": "the_things_industries",
        "extSensorOn": [],
        "extSensorIs": "",
        "rssi": -66,
        "spf": "7",
        "CO2": 621,
        "temperature": 23.9,
        "humidity": 60.55,
        "voltage": 3.51,
        "uplinkType": "00",
        "keepAliveTime": 3,
        "joinRetryPeriod": 5,
        "deviceVersions": {
            "hardware": 0,
            "software": 0
        },
        "watchDogParams": {
            "wdpC": 0,
            "wdpUc": 0
        },
        "createdAt": "2021-07-19T13:09:02.556Z",
        "lastActive": "2021-07-20T15:36:03.672Z",
        "boundaryLevels": {
            "good_medium": 901,
            "medium_bad": 1501
        },
        "autoZeroValue": 366,
        "notifyPeriod": {
            "good_zone": 0,
            "medium_zone": 10,
            "bad_zone": 10
        },
        "measurementPeriod": {
            "good_zone": 10,
            "medium_zone": 10,
            "bad_zone": 10
        },
        "buzzerNotification": {
            "duration_good_beeping": 0,
            "duration_good_loud": 500,
            "duration_good_silent": 500,
            "duration_medium_beeping": 0,
            "duration_medium_loud": 500,
            "duration_medium_silent": 500,
            "duration_bad_beeping": 2,
            "duration_bad_loud": 500,
            "duration_bad_silent": 500
        },
        "ledNotification": {
            "red_good": 0,
            "green_good": 2,
            "blue_good": 0,
            "duration_good": 210,
            "red_medium": 3,
            "green_medium": 2,
            "blue_medium": 0,
            "duration_medium": 4020,
            "red_bad": 3,
            "green_bad": 0,
            "blue_bad": 0,
            "duration_bad": 4020
        },
        "autoZeroPeriod": 192,
        "online": true,
        "mac": "70B3D52DD500000D"
    },
    "_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": “{CO2-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": “{CO2-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" : "{Co2-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": “{Co2-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": “{Co2-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": “{CO2-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": “{CO2-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": “{CO2 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"
        }
    }
}
```

### Set Co2 Boundary Levels

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "set_co2_boundary_levels",
  "good_medium": 900, // in PPM
  "medium_bad": 1500 // in PPM
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6c24a58f6f700118ef837",
        "commandName": "SetCo2BoundaryLevels",
        "commandParams": {
            "good_medium": 901,
            "medium_bad": 1501
        },
        "deviceId": "70************D",
        "createdAt": "2021-07-20T12:32:10.317Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get Co2 Boundary Levels

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "get_co2_boundary_levels"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6c0b258f6f700118ef808",
        "commandName": "GetCo2BoundaryLevels",
        "commandParams": [],
        "deviceId": "70************D",
        "createdAt": "2021-07-20T12:25:22.607Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "\/v1\/provider\/send"
        }
    }
}
```

### Set CO2 Auto Zero Value

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "set_co2_auto_zero_value",
  "ppm" : 366 //This value is used by the device for CO2
  // measurements compensation in order to get 400ppm in fresh air. 
  // This value is represented in ppm.
 
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6d08758f6f700118ef9e7",
        "commandName": "SetCo2AutoZeroValue",
        "commandParams": {
            "ppm": 366
        },
        "deviceId": "7**************D",
        "createdAt": "2021-07-20T13:32:55.510Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get CO2 Auto Zero Value

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "get_co2_auto_zero_value"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6c0b258f6f700118ef808",
        "commandName": "GetCo2AutoZeroValue",
        "commandParams": [],
        "deviceId": "70************D",
        "createdAt": "2021-07-20T12:25:22.607Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "\/v1\/provider\/send"
        }
    }
}
```

### Set CO2 Auto Zero Period

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

{% hint style="info" %}
Auto-zero period in hours. Default auto-zero period, after the factory auto-zeroing, is 192 hours (8 days). During this period the lowest measured CO2 value is accepted as 400ppm and the auto-zero value is obtained automatically. If The period is 0, automatic auto-zero function is disabled, but the obtained or set with command auto-zero value is still used internally
{% endhint %}

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "set_co2_auto_zero_period",
  "hours" : 192 // in hours
 
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6ea2158f6f700118efd12",
        "commandName": "SetCo2AutoZeroPeriod",
        "commandParams": {
            "hours": 192
        },
        "deviceId": "7*************D",
        "createdAt": "2021-07-20T15:22:09.105Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get CO2 Auto Zero Value

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "get_co2_auto_zeroperiod"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6c0b258f6f700118ef808",
        "commandName": "GetCo2AutoZeroPeriod",
        "commandParams": [],
        "deviceId": "70************D",
        "createdAt": "2021-07-20T12:25:22.607Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "\/v1\/provider\/send"
        }
    }
}
```

### Set N**otify Period**&#x20;

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "set_notify_period",
  "good_zone" : 0, // Notification period, in minutes,
  // when measured CO2 is inside the good zone. 0 means notifyonce.
  "medium_zone": 10, // -- // -- 
  "bad_zone": 10 //    -- // --
 
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6d4a858f6f700118efa7f",
        "commandName": "SetNotifyPeriod",
        "commandParams": {
            "good_zone": 0,
            "medium_zone": 10,
            "bad_zone": 10
        },
        "deviceId": "70***************D",
        "createdAt": "2021-07-20T13:50:32.221Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get N**otify Period**&#x20;

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "get_notify_period"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6c0b258f6f700118ef808",
        "commandName": "GetNotifyPeriod",
        "commandParams": [],
        "deviceId": "70************D",
        "createdAt": "2021-07-20T12:25:22.607Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "\/v1\/provider\/send"
        }
    }
}
```

### Set Measurement Period

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "set_measurement_period",
  "good_zone" : 10, // in minutes, used until the measured CO2 levels are 
  // inside the good zone
  "medium_zone": 10, // -- // -- 
  "bad_zone": 10 //    -- // --
 
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6d8c458f6f700118efb0b",
        "commandName": "SetCo2MeasurementPeriod",
        "commandParams": {
            "good_zone": 10,
            "medium_zone": 10,
            "bad_zone": 10
        },
        "deviceId": "70B3D52DD500000D",
        "createdAt": "2021-07-20T14:08:04.903Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get Measurement Period

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "get_measurement_period"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6c0b258f6f700118ef808",
        "commandName": "GetCo2MeasurementPeriod",
        "commandParams": [],
        "deviceId": "70************D",
        "createdAt": "2021-07-20T12:25:22.607Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "\/v1\/provider\/send"
        }
    }
}
```

### Set Buzzer Notification

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "set_buzzer_notification",
  "duration_good_beeping": 0, // Duration of the buzzer beeping, in seconds,
  // when must notify for good CO2 levels. A value of 0 means don’t notify
  "duration_good_loud": 500, [ms], Duration of the buzzer loud periods, when must notify
  // for good CO2 levels
  "duration_good_silent": 500, [ms],
  "duration_medium_beeping": 0, [s]
  "duration_medium_loud": 500, [ms]
  "duration_medium_silent": 500, [ms]
  "duration_bad_beeping": 2,
  "duration_bad_loud": 500,
  "duration_bad_silent": 500

}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6e18158f6f700118efc13",
        "commandName": "SetBuzzerNotification",
        "commandParams": {
            "duration_good_beeping": 0,
            "duration_good_loud": 500,
            "duration_good_silent": 500,
            "duration_medium_beeping": 0,
            "duration_medium_loud": 500,
            "duration_medium_silent": 500,
            "duration_bad_beeping": 2,
            "duration_bad_loud": 500,
            "duration_bad_silent": 500
        },
        "deviceId": "70*************D",
        "createdAt": "2021-07-20T14:45:21.858Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get Buzzer Notification

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "get_buzzer_notification"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6c0b258f6f700118ef808",
        "commandName": "GetBuzzerNotification",
        "commandParams": [],
        "deviceId": "70************D",
        "createdAt": "2021-07-20T12:25:22.607Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "\/v1\/provider\/send"
        }
    }
}
```

### Set LED Notification

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*\*Led state:*&#x20;

* 0x00: None;&#x20;
* 0x01: LED is constantly on for the given time duration;
* 0x02: Blink fast for the given time duration;&#x20;
* 0x03: Blink slow for the given time duration

*Body*:

```
{
   "serial_number": “{CO2 Serial Number}”,
   "command" : "set_co2_led_notification",
   "red_good": 0, // Led State*
   "green_good": 2, // Led State*
   "blue_good": 0, // Led State*
   "duration_good": 210, // [ms]
   "red_medium": 3,
   "green_medium": 3,
   "blue_medium": 0,
   "duration_medium": 4020, // [ms]
   "red_bad": 3,
   "green_bad": 0,
   "blue_bad": 0,
   "duration_bad": 4020
  
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6e6c258f6f700118efcb2",
        "commandName": "SetCo2Led",
        "commandParams": {
            "red_good": 0,
            "green_good": 2,
            "blue_good": 0,
            "duration_good": 210,
            "red_medium": 3,
            "green_medium": 2,
            "blue_medium": 0,
            "duration_medium": 4020,
            "red_bad": 3,
            "green_bad": 0,
            "blue_bad": 0,
            "duration_bad": 4020
        },
        "deviceId": "7*************D",
        "createdAt": "2021-07-20T15:07:46.975Z",
        "__v": 0
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Get LED Notification

*Request URL:*

```
POST /provider/send
```

*Headers:*

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

*Body*:

```
{
  "serial_number": “{CO2 Serial Number}”,
  "command" : "get_co2_led_notification"
}
```

*Response:*

```
{
    "provider": {
        "status": "pending",
        "_id": "60f6e3e858f6f700118efc5b",
        "commandName": "GetCo2Led",
        "commandParams": [],
        "deviceId": "7**************D",
        "createdAt": "2021-07-20T14:55:36.249Z",
        "__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": “{CO2 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/co2-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.
