Thermostat mode

Description and API usage

What is Thermostat mode?

Every MClimate device of type relay (Bobbie, Smart plug, Shelly 1, Shelly 1pm, Shelly em, etc) can act as a thermostat. If it is configured as such, it can use sensor data from another device that have temperature sensors (Bobbie, Melissa, Vicki, Mom, HT sensor, Shelly 1/1 pm, AQI Sensor and notifier, etc.) and use the sensor as reference to control the heating load e.g. space heater, water heater, etc.

How does it work?

Every 10 minutes an algorithm checks all created thermostat records and their settings. If the temperature that is measured by the associated sensor is under the target (-delta),, the relay is switched on. If the sensor temperature has reached the target, the relay is switched off.

How to use it via MClimate’s API?

Performing queries to MClimate API is done by making HTTP requests with Headers: Content-Type: application/json, Authorization: Bearer {access_token}

Endpoints

Create Thermostat Mode

Request URL:
1
POST /thermostat_mode
Copied!
Headers:
1
Content-Type: application/json
2
Authorization: Bearer {access_token}
Copied!
Body:
1
{
2
"serial_number" : "QI***********8",
3
"sensor_id" : 1****6, // - ID of the sensor device
4
- can be the same as relay device if device have sensors
5
"target_temperature" : 55, // hysteresis, temperature delta to switch the relay
6
on (e.g. target_temperature is 25, delta is 1; the relay will be switched
7
on once the sensor_temperature is 24 or lower.
8
"delta" : 3, // 0-the mode is off / 1-the mode is on (optional)
9
"active" : 1,
10
"state": 1, // Relay last state
11
"default_state": "do_nothing", // what do you want to happen with the relay
12
in case the sensor is offline - on / off / do_nothing (optional)
13
"push":1 // push notification when state is changed, 1-on/0-off
14
}
Copied!
Response:
1
{
2
"thermostat_mode": {
3
"sensor_id": 1****0,
4
"target_temperature": 50,
5
"delta": 3,
6
"active": 1,
7
"default_state": "do_nothing",
8
"push": 1,
9
"controller_id": 1****,
10
"user_id": 1***3,
11
"id": 2**
12
},
13
"_links": {
14
"self": {
15
"href": "/v1/thermostat_mode"
16
}
17
}
18
}
Copied!

Fetch Thermostat Mode

Request URL:
1
GET /thermostat_mode/{Controller Serial Number}
Copied!
Headers:
1
Content-Type: application/json
2
Authorization: Bearer {access_token}
Copied!
Response:
1
{
2
"thermostat_mode": {
3
"id": 2**,
4
"controller_id": 1***0,
5
"user_id": 1****3,
6
"sensor_id": 1****0,
7
"target_temperature": 50,
8
"delta": 3, //hysteresis-possible temperature before the relay is switched on
9
"state": null,
10
"default_state": "do_nothing",
11
"push": 1,
12
"active": 1 // 0-the mode is off / 1-the mode is on
13
},
14
"_links": {
15
"self": {
16
"href": "/v1/thermostat_mode/W**********W"
17
}
18
}
19
}
Copied!

Update Thermostat Mode

Request URL:
1
PATCH /thermostat_mode/{Controller Serial Number}
Copied!
Headers:
1
Content-Type: application/json
2
Authorization: Bearer {access_token}
Copied!
Body:
1
{
2
"target_temperature" : 24,
3
}
Copied!
Response:
1
{
2
"thermostat_mode": {
3
"id": 2**,
4
"controller_id": 1***0,
5
"user_id": 1****3,
6
"sensor_id": 1***0,
7
"target_temperature": 24,
8
"delta": 3,
9
"state": null,
10
"default_state": "do_nothing",
11
"push": 1,
12
"active": 1
13
},
14
"_links": {
15
"self": {
16
"href": "/v1/thermostat_mode/W**********AW"
17
}
18
}
19
}
Copied!

Postman collection:

You can get the full postman collection from here.
Last modified 5mo ago