> 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/functions/heating-profiles.md).

# Heating profiles

{% file src="/files/ArtzEtoKdGx04lXLUP8o" %}

### Create heating profile

*Scope: Basic*

*Request URL:*

```
POST /schedule-profile
```

*Headers:*

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

*Body*:

```
{
    "name":"Eco +",
    "building_id":20, //optional /OR - "floor_id" OR - "space_id" OR "room_id"
    "is_default": 1, // optional 
    "editable": 1, // optional
    "boost_time": 120, // in minutes, optional
     "schedules":[ // optional
        {
            "days" : "1111111",
            "active": 1,
            "from_time": 895,
            "to_time": 920,
            "device_hours": 14,
            "action": "command",
            "target": 24
        },{
            "days" : "1111111",
            "active": 1,
            "from_time": 920,
            "to_time": 1000,
            "device_hours": 14,
            "action": "command",
            "target": 24
        }

    ]
}
```

*Response:*

```
{
    "schedule_profiles": {
        "name": "Eco +",
        "building_id": 20,
        "user_id": 1,
        "id": 10
    },
    "_links": {
        "self": {
            "href": "/v1/schedule-profile"
        }
    }
}
```

### Assign devices

*Scope: Trusted*

*Request URL:*

```
PATCH /schedule-profile/{Profile_id}
```

*Headers:*

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

*Body*:

```
{
  "controller_id": 165 // or [164,165] // [] empty for deleting all devices
}
```

*Response:*

```
{
    "schedule_profiles": {
        "id": 10,
        "name": "Eco +",
        "user_id": 2,
        "building_id": 2,
        "floor_id": null,
        "space_id": null,
        "room_id": null
    },
    "_links": {
        "self": {
            "href": "/v1/schedule-profile/10"
        }
    }
}
```

### Create Schedule

*Scope: Basic*

*Request URL:*

```
POST /schedules
```

*Headers:*

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

*Body*:

```
{
    "profile_id": 10,// Profile id 
    "days" : "0000010",// days of week you want the schedule to be active
    "active": 1,
    "from_time": 650, //time formula:(H)*60+(min)/10:50 =>10*60= 600 + 60 = 650
    "to_time": 700, //time formula:(H)*60+(min)/11:40 =>11*60= 660 + 40 = 700
    "device_hours": 14, // device hours at the moment of creatio
    "action": "command", //thermostat mode or command
    "target": 24, // target temperature or state// integer//
                     for smartpug or bobbie 0- off, 1 - on
    "push":1 // 1/0 for push notification
    "default_state": "do_nothing"// not working for vicki /"on","off","do_nothing" 
      // when schedule ends, what state you want to set the device, its for melissa bobbie smartplug
}
```

*Response:*

```
{
    "schedules": {
        "profile_id": 10,
        "days": "0000010",
        "active": 1,
        "from_time": "2021-05-29 10:50:00",
        "to_time": "2021-05-29 11:40:00",
        "action": "command",
        "target": 24,
        "push": 1,
        "user_time_offset": null,
        "id": 21
    },
    "_links": {
        "self": {
            "href": "/v1/schedules"
        }
    }
}
```

### Fetch All Schedule profiles

*Scope: Trusted*

*Request URL:*

```
GET /schedule-profile
```

*Headers:*

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

*Response:*

```
{
    "_embedded": {
        "schedule_profiles": [
            {
                "id": 1,
                "name": "eco +",
                "user_id": 12073,
                "building_id": null,
                "floor_id": null,
                "space_id": null,
                "room_id": null,
                "is_default": null,
                "_links": {
                    "self": {
                        "href": "/v1/schedule-profile/1"
                    }
                }
            }
        ]
    },
    "total": 1,
    "_links": {
        "self": {
            "href": "/v1/schedule-profile"
        }
    }
}
```

### Fetch Schedule

*Scope: Trusted*

*Request URL:*

```
GET /schedule-profile/{profile id} 
```

*Headers:*

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

*Response:*

```
{
    "_embedded": {
        "schedule_profiles": [
            {
                "id": 1,
                "name": "eco +",
                "user_id": 12073,
                "building_id": null,
                "floor_id": null,
                "space_id": null,
                "room_id": null,
                "is_default": null,
                "schedules": [
                    {
                        "id": 1247,
                        "controller_id": null,
                        "profile_id": 1,
                        "from_time": "2022-09-02 10:50:00",
                        "to_time": "2022-09-02 21:40:00",
                        "days": "1111111",
                        "target": 24,
                        "main_target": null,
                        "default_state": "do_nothing",
                        "action": "command",
                        "priority": 0,
                        "active": 1,
                        "push": 1,
                        "user_time_offset": null
                    }
                ],
                "devices": [
                    {
                        "id": 32725,
                        "user_id": 17947,
                        "serial_number": "XJPC327253WXM",
                        "mac": "70B3D52DD3000AF8",
                        "firmware_version": "3.6",
                        "hardware_version": "0.0",
                        "name": "Vicki_lorawan - XJPC327253WXM",
                        "type": "vicki_lorawan",
                        "device_group": "lorawan",
                        "status_push": 1,
                        "room_id": 63,
                        "owner_id": null,
                        "created": "2020-12-24 12:41:59",
                        "assigned_at": "2022-08-11 10:10:41",
                        "deleted_at": null
                    }
                ],
                "_links": {
                    "self": {
                        "href": "/v1/schedule-profile/1"
                    }
                }
            }
        ]
    },
    "total": 1,
    "_links": {
        "self": {
            "href": "/v1/schedule-profile/1"
        }
    }
}
```

### Update Schedule profile

*Scope: Trusted*

*Request URL:*

```
PATCH /schedule-profile/{Profile_id}
```

*Headers:*

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

*Body*:

```
{
  "name": "Eco",
  "building_id": 12 // optional !! Plase do not assign the profile to more than one asset
    "schedules":[ // optional // this creates additional schedules to profile 
         {
            "days": "0100000",
            "active": 1,
            "from_time": 120,
            "to_time": 420,
            "device_hours": 11,
            "action": "command",
            "target": 22,
            "push": 1
        }
    ]
  
}
```

*Response:*

```
{
    "schedule_profiles": {
        "id": 1,
        "name": "Eco",
        "user_id": 12073,
        "building_id": 12,
        "floor_id": null,
        "space_id": null,
        "room_id": null,
        "is_default": null
    },
    "_links": {
        "self": {
            "href": "/v1/schedule-profile/1"
        }
    }
}

```

### Delete Schedule profile

*Scope: Trusted*

*Request URL:*

```
Delete /schedule-profile/{Profile_id}
```

*Headers:*

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

*Response:*

```
{
    "schedule_profiles": {
        "id": 1
    },
    "_links": {
        "self": {
            "href": "/v1/schedule-profile/1"
        }
    }
}
```

### Delete device from Schedule profile

*Scope: Trusted*

*Request URL:*

```
Delete /schedule-profile-device/{Profile_id}
```

*Headers:*

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

*Body*:

```
{
 "controller_id": 164
}
```

*Response:*

```
{
    "schedule_profiles": {
        "id": 1
    },
    "_links": {
        "self": {
            "href": "/v1/schedule-profile/1"
        }
    }
}
```


---

# 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/functions/heating-profiles.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.
