Skip to content

Commit 8e84b1f

Browse files
authored
docs: Add screenshots and service documentation to README (#44)
1 parent 5ad6f3c commit 8e84b1f

4 files changed

Lines changed: 145 additions & 1 deletion

File tree

.github/assets/main-device.png

1.02 MB
Loading

.github/assets/side-device.png

1010 KB
Loading

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ repos:
77
- id: poetry-check
88
- id: poetry-lock
99

10+
- repo: https://github.com/thlorenz/doctoc
11+
rev: v2.2.0
12+
hooks:
13+
- id: doctoc
14+
args:
15+
- --maxlevel=3
16+
- --update-only
17+
1018
- repo: https://github.com/pre-commit/pre-commit-hooks
1119
rev: v6.0.0
1220
hooks:

README.md

Lines changed: 137 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# `hass-free-sleep`
22

3-
An unofficial Home Assistant custom integration for Free Sleep devices.
3+
[![HACS Custom](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/custom-components/hacs) ![GitHub Release](https://img.shields.io/github/v/release/Mrtenz/hass-free-sleep)
4+
5+
An unofficial Home Assistant custom integration for [Free Sleep](https://github.com/throwaway31265/free-sleep)
6+
devices.
47

58
> [!NOTE]
69
> This integration was only tested with an Eight Sleep Pod 4, and does not
@@ -9,6 +12,25 @@ An unofficial Home Assistant custom integration for Free Sleep devices.
912
>
1013
> Some functionality like vitals may not be accurate.
1114
15+
## Table of Contents
16+
17+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
18+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
19+
20+
- [Overview](#overview)
21+
- [Features](#features)
22+
- [Installation](#installation)
23+
- [Installation via HACS (Recommended)](#installation-via-hacs-recommended)
24+
- [Manual Installation](#manual-installation)
25+
- [Configuration](#configuration)
26+
- [Services](#services)
27+
- [`free_sleep.execute`](#free_sleepexecute)
28+
- [`free_sleep.set_schedule`](#free_sleepset_schedule)
29+
30+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
31+
32+
## Overview
33+
1234
This integration allows you to control and monitor your Free Sleep device
1335
directly from Home Assistant. You can adjust bed settings, monitor sleep data,
1436
and view historical sleep information.
@@ -19,6 +41,9 @@ It creates three devices in Home Assistant:
1941
- Two devices representing each side of the bed, providing access to
2042
side-specific settings and data, such as temperature and sleep metrics.
2143

44+
[![Main device view](.github/assets/main-device.png)](.github/assets/main-device.png)
45+
[![Side device view](.github/assets/side-device.png)](.github/assets/side-device.png)
46+
2247
## Features
2348

2449
- Control bed settings such as temperature and alarms.
@@ -64,3 +89,114 @@ UI:
6489
2. Click on "Add Integration" and search for "Free Sleep".
6590
3. Follow the prompt to enter the hostname or IP address of your Free Sleep
6691
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

Comments
 (0)