Skip to content

Commit 0a2323b

Browse files
authored
Use MkDocs for documentation (#592)
1 parent 6bb3233 commit 0a2323b

24 files changed

+1228
-593
lines changed

.github/workflows/build-docs.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ jobs:
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install --upgrade pip
20+
pip install -r requirements.txt
2021
pip install -r requirements_docs.txt
2122
pip install -e .
22-
- name: Sphinx build
23+
- name: Build and deploy documentation
2324
run: |
24-
sphinx-build docs/source docs/build/html
25-
- name: Deploy to GitHub Pages
26-
uses: peaceiris/actions-gh-pages@v3
27-
with:
28-
publish_branch: gh-pages
29-
github_token: ${{ secrets.GITHUB_TOKEN }}
30-
publish_dir: docs/build/html
31-
force_orphan: true
25+
make publish
26+
# - name: Build and Deploy to GitHub Pages
27+
# uses: peaceiris/actions-gh-pages@v3
28+
# with:
29+
# publish_branch: gh-pages
30+
# github_token: ${{ secrets.GITHUB_TOKEN }}
31+
# publish_dir: docs/build/html
32+
# force_orphan: true

.github/workflows/publish.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,9 @@ jobs:
7171
- name: Install dependencies
7272
run: |
7373
python -m pip install --upgrade pip
74+
pip install -r requirements.txt
7475
pip install -r requirements_docs.txt
7576
pip install -e .
76-
- name: Sphinx build
77+
- name: Build and deploy documentation
7778
run: |
78-
sphinx-build docs/source docs/build/html
79-
- name: Deploy to GitHub Pages
80-
uses: peaceiris/actions-gh-pages@v3
81-
with:
82-
publish_branch: gh-pages
83-
github_token: ${{ secrets.GITHUB_TOKEN }}
84-
publish_dir: docs/build/html
85-
force_orphan: true
79+
make publish

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5-
65
# C extensions
76
*.so
87

@@ -67,7 +66,6 @@ docs/_build/
6766
target/
6867

6968
# IPython Notebook
70-
.ipynb_checkpoints
7169

7270
# pyenv
7371
.python-version
@@ -114,3 +112,4 @@ venv*/
114112
#own config file
115113
homematic.ini
116114
src/homematicip/_version.py
115+
/site/

Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Makefile for HomematicIP Cloud Rest API Wrapper
2+
3+
.PHONY: install test docs serve clean publish
4+
5+
install:
6+
pip install -r requirements.txt
7+
pip install -r requirements_dev.txt
8+
pip install -r requirements_docs.txt
9+
10+
test:
11+
pytest
12+
13+
docs:
14+
cp CHANGELOG.md ./docs/changelog.md
15+
mkdocs build
16+
17+
serve:
18+
cp CHANGELOG.md ./docs/changelog.md
19+
mkdocs serve
20+
21+
publish:
22+
cp CHANGELOG.md ./docs/changelog.md
23+
mkdocs gh-deploy --force
24+
25+
clean:
26+
rm -rf site

docs/Makefile

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/api-introduction.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# API Introduction_old
2+
3+
There are a few key classes for communication with the Rest API of HomematicIP.
4+
5+
- **Home:** The most important object as it has the "overview" of the installation
6+
- **Group:** A group of devices for a specific need. E.g. Heating group, security group, ...
7+
- **MetaGroup:** A collection of groups. In the HomematicIP App this is called a "Room"
8+
- **Device:** A hardware device e.g. shutter contact, heating thermostat, alarm siren, ...
9+
- **FunctionChannel:** A channel of a device. For example DoorLockChannel for DoorLockDrive or **DimmerChannel**. A device has multiple channels - depending on its functions.
10+
11+
For example:
12+
The device HmIP-DLD is represented by the class **DoorLockDrive** (or AsyncDoorLockDrive). The device has multiple channels.
13+
The base channel holds information about the device and has the index 0.
14+
The device also has a channel called **DoorLockChannel** which contains the functions "set_lock_state" and "async_set_lock_state". These are functions to set the lock state of that device.
15+
16+
If you have a dimmer with multiple I/Os, there are multiple channels. For each I/O a unique channel.
17+

docs/batch-testing.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Batch Testing of Applicable Commands
2+
3+
HomematicIP devices can have different channels, and each channel can have different commands. To test which commands are applicable for a channel, use the `hmip_batch` script. This script will try to execute commands for a device and print the result. It will also print the commands that are not applicable for the device.
4+
5+
The script takes the device ID and the channel index as arguments. You also need a JSON batch file containing the commands.
6+
7+
> **Warning**
8+
> Please pay close attention to the parameters used for each command. Incorrect or inappropriate parameters may lead to unexpected behavior or even malfunction of your HomematicIP devices. Executing commands is at your own risk. Always double-check the documentation and ensure you understand the effects of each command before using it in your environment.
9+
10+
### Steps to Run a Batch Test
11+
12+
1. Install this library with pip: `pip install -U homematicip`
13+
2. Get an access token as described above.
14+
3. Get your device ID and channel index from the device list using:
15+
`hmip_cli --list-devices`
16+
or dump the configuration with:
17+
`hmip_cli --dump-configuration`
18+
4. Download the JSON batch file from [GitHub](https://github.com/hahn-th/homematicip-rest-api/blob/master/homematicip_demo/hmip_batch.json).
19+
5. Edit the JSON batch file to choose which commands you want to test. You can enable or disable commands by setting the `active` flag to `true` or `false`.
20+
21+
With the `active` flag you can enable or disable commands:
22+
23+
```json
24+
{
25+
"function": "set_shutter_level_async",
26+
"active": false,
27+
"params": {
28+
"shutter_level": 0.7
29+
}
30+
},
31+
```
32+
33+
To run the batch test, use the following command:
34+
35+
```sh
36+
hmip_batch -d <device-id> -i <channel-index> <path-to-json-batch-file>
37+
```

0 commit comments

Comments
 (0)