You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Control bed settings such as temperature and alarms.
@@ -64,3 +89,114 @@ UI:
64
89
2. Click on "Add Integration" and search for "Free Sleep".
65
90
3. Follow the prompt to enter the hostname or IP address of your Free Sleep
66
91
device.
92
+
93
+
## Services
94
+
95
+
The integration provides the following services that can be called from
96
+
automations or scripts:
97
+
98
+
### `free_sleep.execute`
99
+
100
+
Execute an arbitrary command on the Free Sleep device.
101
+
102
+
> [!CAUTION]
103
+
> This is a low-level service that allows you to send arbitrary commands to the
104
+
> Free Sleep device. Use with caution, as incorrect commands may lead to
105
+
> unexpected behaviour.
106
+
107
+
#### Parameters
108
+
109
+
##### `command`
110
+
111
+
The command to execute. This should be a valid command supported by the Free
112
+
Sleep API. A list of commands can be found [here](https://github.com/throwaway31265/free-sleep/blob/a040434cdd2c160a8188b4452446454bf9c81c0e/server/src/8sleep/deviceApi.ts#L6-L25).
113
+
114
+
##### `value` (optional)
115
+
116
+
The value to send with the command, if applicable.
117
+
118
+
#### Example
119
+
120
+
To set the temperature of the bed to 75 degrees (Fahrenheit), you can use the
121
+
following service call:
122
+
123
+
```yaml
124
+
service: free_sleep.execute
125
+
data:
126
+
command: SET_TEMP
127
+
value: 75
128
+
```
129
+
130
+
Note that the API expects temperature values in Fahrenheit.
131
+
132
+
### `free_sleep.set_schedule`
133
+
134
+
Set the sleep schedule for a specific side of the bed, or both sides. This
135
+
can be used to set the time to turn on the heating or cooling of the bed, or
136
+
control alarms.
137
+
138
+
#### Parameters
139
+
140
+
##### `side`
141
+
142
+
The side(s) of the bed to set the schedule for. This expects one or multiple
143
+
device IDs representing the sides of the bed.
144
+
145
+
##### `day_of_week` (optional)
146
+
147
+
The day of the week to set the schedule for. If not provided, the schedule will
148
+
be set for all days.
149
+
150
+
##### `schedule`
151
+
152
+
An object containing the schedule details. This can be an object containing the
153
+
`temperatures`, `power`, and/or `alarm` fields, following the structure defined
154
+
in the [Free Sleep API](https://github.com/throwaway31265/free-sleep/blob/main/server/API.md#apischedules).
155
+
156
+
> [!NOTE]
157
+
> The temperatures can be specified in Celsisu, Fahrenheit, or Kelvin, depending
158
+
> on the unit system configured in Home Assistant. The integration will handle
159
+
> the conversion to Fahrenheit as required by the Free Sleep API.
160
+
161
+
#### Example
162
+
163
+
To set a schedule for both sides of the bed to turn on heating at 21:00 with a
164
+
temperature of 23°C, then change to 25°C at 22:00 and 21°C at 07:00, you can use
165
+
the following service call (assuming Celsius is the configured unit system):
166
+
167
+
```yaml
168
+
service: free_sleep.set_schedule
169
+
data:
170
+
side:
171
+
- device_id_side_1
172
+
- device_id_side_2
173
+
schedule:
174
+
power:
175
+
"on": "21:00"
176
+
onTemperature: 23
177
+
temperatures:
178
+
- time: "22:00"
179
+
temperature: 25
180
+
- time: "07:00"
181
+
temperature: 21
182
+
```
183
+
184
+
To set an alarm for one side of the bed on Mondays and Tuesdays at 07:30 AM, you
185
+
can use the following service call:
186
+
187
+
```yaml
188
+
service: free_sleep.set_schedule
189
+
data:
190
+
side:
191
+
- device_id_side_1
192
+
day_of_week:
193
+
- monday
194
+
- tuesday
195
+
schedule:
196
+
alarm:
197
+
time: "07:30"
198
+
enabled: true
199
+
```
200
+
201
+
Refer to the [Free Sleep API](https://github.com/throwaway31265/free-sleep/blob/main/server/API.md#apischedules)
202
+
for more details on the schedule structure and available options.
0 commit comments