Skip to content

Commit 619d5e8

Browse files
authored
Restructure the documentation in more smaller parts (#1008)
1 parent 91d9bde commit 619d5e8

7 files changed

+222
-183
lines changed

DEVELOPMENT.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Setting up your development environment
2+
3+
**For enabling Matter support within Home Assistant, please refer to the Home Assistant documentation. These instructions are for development only!**
4+
5+
Development is only possible on a (recent) Linux or MacOS machine. Other operating systems are **not supported**. See [here](docs/os_requirements.md) for a full list of requirements to the OS and network, especially if you plan on communicating with Thread based devices.
6+
7+
- Download/clone the repo to your local machine.
8+
- Set-up the development environment: `scripts/setup.sh`
9+
10+
## Start Matter server
11+
12+
You can check out the [example script](/scripts/example.py) in the scripts folder for generic directions to run the client and server.
13+
14+
- To run the server in `info` log-level, you can run: `python -m matter_server.server`
15+
- To start the server in `debug` log-level, you can run: `python -m matter_server.server --log-level debug`
16+
- To start the server with SDK in `progress` log-level, you can run: `python -m matter_server.server --log-level-sdk progress`. This will display more information from the Matter SDK (C++) side of the Matter Server.
17+
18+
Use `--help` to get a list of possible log levels and other command line arguments.
19+
20+
The server runs a Matter Controller and includes all logic for storing node information, interviews and subscriptions. To interact with this controller we've created a small Websockets API with an RPC-like interface. The library contains a client as reference implementation which in turn is used by Home Assistant. Splitting the server from the client allows the scenario where multiple consumers can communicate to the same Matter fabric and the Matter fabric can keep running while the consumer (e.g. Home Assistant is down).
21+
22+
## Python client library only
23+
24+
There is also a Python client library hosted in this repository (used by Home Assistant), which consumes the Websockets API published from the server.
25+
26+
The client library has a dependency on the chip/matter clusters package which contains all (Cluster) models and this package is os/platform independent. The server library depends on the Matter Core SDK (still named CHIP) which is architecture and OS specific. We build (and publish) wheels for Linux (amd64 and aarch64) to pypi but for other platforms (like Macos) you will need to build those wheels yourself using the exact same version of the SDK as we use for the clusters package. Take a look at our build script for directions: https://github.com/home-assistant-libs/chip-wheels/blob/main/.github/workflows/build.yaml
27+
28+
To only install the client part: `pip install python-matter-server`
29+
30+
## Websocket commands
31+
32+
[Websocket documentation](/docs/websockets_api.md)

README.md

+15-155
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,43 @@
11
# Open Home Foundation Matter Server
22

3+
![Matter Logo](docs/matter_logo.svg)
4+
35
The Open Home Foundation Matter Server is an [officially certified](https://csa-iot.org/csa_product/open-home-foundation-matter-server/) Software Component to create a Matter controller. It serves as the foundation to provide Matter support to [Home Assistant](https://home-assistant.io) but its universal approach makes it suitable to be used in other projects too.
46

57
This project implements a Matter Controller Server over WebSockets using the
68
[official Matter (formerly CHIP) SDK](https://github.com/project-chip/connectedhomeip)
79
as a base and provides both a server and client implementation.
810

9-
The Open Home Foundation Matter Server software component is funded by [Nabu Casa](https://www.nabucasa.com/) (a member of the CSA) and donated to [The Open Home Foundation](<(https://www.openhomefoundation.org/)>).
11+
The Open Home Foundation Matter Server software component is funded by [Nabu Casa](https://www.nabucasa.com/) (a member of the CSA) and donated to [The Open Home Foundation](https://www.openhomefoundation.org/).
1012

1113
## Support
1214

15+
For developers, making use of this component or contributing to it, use the issue tracker within this repository and/or reach out on discord.
16+
1317
For users of Home Assistant, seek support in the official Home Assistant support channels.
1418

1519
- The Home Assistant [Community Forum](https://community.home-assistant.io/).
1620
- The Home Assistant [Discord Chat Server](https://discord.gg/c5DvZ4e).
1721
- Join [the Reddit subreddit in /r/homeassistant](https://reddit.com/r/homeassistant).
1822

19-
If you experience issues using Matter with Home Assistant, please open an issue
20-
report in the [Home Assistant Core repository](https://github.com/home-assistant/core/issues/new/choose).
23+
- If you experience issues using Matter with Home Assistant, please open an issue
24+
report in the [Home Assistant Core repository](https://github.com/home-assistant/core/issues/new/choose).
2125

2226
Please do not create Home Assistant enduser support issues in the issue tracker of this repository.
2327

24-
For developers, making use of this component, use the issue tracker within this repository and/or reach out on discord.
25-
26-
## Installation
27-
28-
We strongly recommend using Home Assistant OS along with the official Matter
29-
Server add-on to use Matter with Home Assistant. The Matter integration
30-
automatically installs the Python Matter Server add-on. Please refer to the
31-
[Home Assistant documentation](https://www.home-assistant.io/integrations/matter/).
32-
Home Assistant OS has been tested and tuned to be used with Matter and Thread,
33-
which makes this combination the best tested and largely worry free
34-
environment.
35-
36-
If you still prefer a self-managed container installation, we do offer an
37-
official container image. Please keep in mind that you might experience
38-
communication issues with Matter devices, especially Thread based devices.
39-
This is mostly because the container installation uses host networking, and
40-
relies on the networking managed by your operating system.
41-
42-
### Requirements to communicate with Wi-Fi/Ethernet based Matter devices
43-
44-
Make sure you run the container on the host network. The host network
45-
interface needs to be in the same network as the Android/iPhone device
46-
you are using for commissioning. Matter uses link-local multicast protocols
47-
which do not work across different LANs or VLANs.
48-
49-
The host network interface needs IPv6 support enabled.
50-
51-
### Requirements to communicate with Thread devices through Thread border routers
52-
53-
For communication through Thread border routers which are not running on the same
54-
host as the Matter Controller server to work, IPv6 routing needs to be properly
55-
working. IPv6 routing is largely setup automatically through the IPv6 Neighbor
56-
Discovery Protocol, specifically the Route Information Options (RIO). However,
57-
if IPv6 Neighbor Discovery RIO's are processed, and processed correctly depends on the network
58-
management software your system is using. There may be bugs and caveats in
59-
processing this Route Information Options.
60-
61-
In general, make sure the kernel option `CONFIG_IPV6_ROUTER_PREF` is enabled and
62-
that IPv6 forwarding is disabled (sysctl variable `net.ipv6.conf.all.forwarding`).
63-
If IPv6 forwarding is enabled, the Linux kernel doesn't employ reachability
64-
probing (RFC 4191), which can lead to longer outages (up to 30min) until
65-
network changes are detected.
66-
67-
If you are using NetworkManager, make sure to use at least NetworkManager 1.42.
68-
Previous versions lose track of routes and stale routes can lead to unreachable
69-
Thread devices. All current released NetworkManager versions can't handle
70-
multiple routes to the same network properly. This means if you have multiple
71-
Thread border routers, the fallback won't work immediately (see [NetworkManager
72-
issue #1232](https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1232)).
73-
74-
We currently don't have experience with systemd-networkd. It seems to have its
75-
own IPv6 Neighbor Discovery Protocol handling.
76-
77-
If you don't use NetworkManager or systemd-networkd, you can use the kernel's
78-
IPv6 Neighbor Discovery Protocol handling.
79-
80-
Make sure the kernel options `CONFIG_IPV6_ROUTE_INFO` is enabled and the
81-
following sysctl variables are set:
82-
83-
```
84-
sysctl -w net.ipv6.conf.wlan0.accept_ra=1
85-
sysctl -w net.ipv6.conf.wlan0.accept_ra_rt_info_max_plen=64
86-
```
87-
88-
If your system has IPv6 forwarding enabled (not recommended, see above), you'll
89-
have to use `2` for the accept_ra variable. See also the [Thread Border Router - Bidirectional IPv6 Connectivity and DNS-Based Service Discovery codelab](https://openthread.io/codelabs/openthread-border-router#6).
90-
91-
### Running the Matter Server using container image
92-
93-
With the following command you can run the Matter Server in a container using
94-
Docker. The Matter network data (fabric information) are stored in a newly
95-
created directory `data` in the current directory. Adjust the command to
96-
choose another location instead.
97-
98-
```
99-
mkdir data
100-
docker run -d \
101-
--name matter-server \
102-
--restart=unless-stopped \
103-
--security-opt apparmor=unconfined \
104-
-v $(pwd)/data:/data \
105-
--network=host \
106-
ghcr.io/home-assistant-libs/python-matter-server:stable
107-
```
108-
109-
> [!NOTE]
110-
> The container has a default command line set (see Dockerfile). If you intend to pass additional arguments, you have to pass the default command line as well.
111-
112-
To use local commissioning with Bluetooth, make sure to pass the D-Bus socket as well:
113-
114-
```
115-
docker run -d \
116-
--name matter-server \
117-
--restart=unless-stopped \
118-
--security-opt apparmor=unconfined \
119-
-v $(pwd)/data:/data \
120-
-v /run/dbus:/run/dbus:ro \
121-
--network=host \
122-
ghcr.io/home-assistant-libs/python-matter-server:stable --storage-path /data --paa-root-cert-dir /data/credentials --bluetooth-adapter 0
123-
```
124-
125-
### Running using Docker compose
126-
127-
```sh
128-
docker compose up -d
129-
docker compose logs -f
130-
```
131-
132-
NOTE: Both Matter and this implementation are in an early state and features are probably missing or could be improved. See our [development notes](#development) how you can help out, with development and/or testing.
133-
134-
### Note when using Thread based Matter devices
135-
136-
> [!NOTE]
137-
> When communicating with Thread devices through a non-local Thread border router,
138-
> your host must process ICMPv6 Router Advertisements. See the [openthread.io
139-
> Bidirectional IPv6 Connectivity code labs](https://openthread.io/codelabs/openthread-border-router#6)
140-
> on how-to setup your host correctly. Note that NetworkManager has its own ICMPv6
141-
> Router Advertisement processing. A recent version of NetworkManager is
142-
> necessary, and there are still known issues (see NetworkManager issue
143-
> [#1232](https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1232)).
144-
145-
The Home Assistant Operating System 10 and newer correctly processes ICMPv6
146-
Router Advertisements.
147-
14828
## Development
14929

150-
Want to help out with development, testing, and/or documentation? Great! As both this project and Matter keeps evolving and more and more devices are available with actual Matter support, there will be a lot to improve. Reach out to us on discord if you want to help out.
151-
152-
### Setting up your development environment
153-
154-
**For enabling Matter support within Home Assistant, please refer to the Home Assistant documentation. These instructions are for development only!**
155-
156-
Development is only possible on a (recent) Linux or MacOS machine. Other operating systems are not supported.
157-
158-
- Download/clone the repo to your local machine.
159-
- Set-up the development environment: `scripts/setup.sh`
30+
Want to help out with development, testing, and/or documentation? Great! As both this project and Matter keeps evolving there will be a lot to improve. Reach out to us on discord if you want to help out.
16031

161-
### Start Matter server
32+
[Development documentation](DEVELOPMENT.md)
16233

163-
You can check out the [example script](/scripts/example.py) in the scripts folder for generic directions to run the client and server.
34+
## Installation / Running the Matter Server
16435

165-
* To run the server in `info` log-level, you can run: `python -m matter_server.server`
166-
* To start the server in `debug` log-level, you can run: `python -m matter_server.server --log-level debug`
167-
* To start the server with SDK in `progress` log-level, you can run: `python -m matter_server.server --log-level-sdk progress`. This will display more information from the Matter SDK (C++) side of the Matter Server.
36+
- Endusers of Home Assistant, refer to the [Home Assistant documentation](https://www.home-assistant.io/integrations/matter/) how to run Matter in Home Assistant using the official Matter Server add-on, which is based on this project.
16837

169-
Use `--help` to get a list of possible log levels and other command line arguments.
38+
- For running the server and/or client in your development environment, see the [Development documentation](DEVELOPMENT.md).
17039

171-
The server runs a Matter Controller and includes all logic for storing node information, interviews and subscriptions. To interact with this controller we've created a small Websockets API with an RPC-like interface. The library contains a client as reference implementation which in turn is used by Home Assistant. Splitting the server from the client allows the scenario where multiple consumers can communicate to the same Matter fabric and the Matter fabric can keep running while the consumer (e.g. Home Assistant is down).
40+
- For running the Matter Server as a standalone docker container, see our instructions [here](docs/docker.md).
17241

173-
### Python client library only
174-
175-
There is also a Python client library hosted in this repository (used by Home Assistant), which consumes the Websockets API published from the server.
176-
177-
The client library has a dependency on the chip/matter clusters package which contains all (Cluster) models and this package is os/platform independent. The server library depends on the Matter Core SDK (still named CHIP) which is architecture and OS specific. We build (and publish) wheels for Linux (amd64 and aarch64) to pypi but for other platforms (like Macos) you will need to build those wheels yourself using the exact same version of the SDK as we use for the clusters package. Take a look at our build script for directions: https://github.com/home-assistant-libs/chip-wheels/blob/main/.github/workflows/build.yaml
178-
179-
To only install the client part: `pip install python-matter-server`
180-
181-
### Websocket commands
182-
183-
[Websocket documentation](/docs/websockets_api.md)
42+
> [!NOTE]
43+
> Both Matter and this implementation are in an early state and features are probably missing or could be improved. See our [development notes](#development) how you can help out, with development and/or testing.

compose.yml

-18
This file was deleted.

docs/docker.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Running Matter Server in Docker
2+
3+
For testing/evaluation purposes or as a guideline towards other application developers that want to run the Matter Server, we do provide an [official Docker container image](https://github.com/home-assistant-libs/python-matter-server/pkgs/container/python-matter-server). Just make sure that the underlying operating system on which you intend to run the docker container matches the [requirements needed for Matter and Thread](os_requirements.md) so better not attempt to run it on a specific purpose operating system such as a NAS.
4+
5+
> [!NOTE] **Attention Home Assistant users:** The docker image is provided as-is and without official support (due to all the complex requirements to the underlying host/OS). Use it at your own risk if you know what you're doing.
6+
7+
We strongly recommend using Home Assistant OS along with the official Matter
8+
Server add-on to use Matter with Home Assistant. The Matter integration
9+
automatically installs the Matter Server as an add-on. Please refer to the
10+
[Home Assistant documentation](https://www.home-assistant.io/integrations/matter/).
11+
12+
Home Assistant OS has been tested and tuned to be used with Matter and Thread,
13+
which makes this combination the best tested and largely worry free
14+
environment.
15+
16+
If you still prefer a self-managed container installation, you might experience
17+
communication issues with Matter devices, especially Thread based devices.
18+
This is mostly because the container installation uses host networking, and
19+
relies on the networking managed by your operating system.
20+
21+
## Running the Matter Server using container image
22+
23+
With the following command you can run the Matter Server in a container using
24+
Docker. The Matter network data (fabric information) are stored in a newly
25+
created directory `data` in the current directory. Adjust the command to
26+
choose another location instead.
27+
28+
```
29+
mkdir data
30+
docker run -d \
31+
--name matter-server \
32+
--restart=unless-stopped \
33+
--security-opt apparmor=unconfined \
34+
-v $(pwd)/data:/data \
35+
--network=host \
36+
ghcr.io/home-assistant-libs/python-matter-server:stable
37+
```
38+
39+
> [!NOTE]
40+
> The container has a default command line set (see Dockerfile). If you intend to pass additional arguments, you have to pass the default command line as well.
41+
42+
To use local commissioning with Bluetooth, make sure to pass the D-Bus socket as well:
43+
44+
```sh
45+
docker run -d \
46+
--name matter-server \
47+
--restart=unless-stopped \
48+
--security-opt apparmor=unconfined \
49+
-v $(pwd)/data:/data \
50+
-v /run/dbus:/run/dbus:ro \
51+
--network=host \
52+
ghcr.io/home-assistant-libs/python-matter-server:stable --storage-path /data --paa-root-cert-dir /data/credentials --bluetooth-adapter 0
53+
```
54+
55+
## Running using Docker compose
56+
57+
```yaml
58+
services:
59+
# python-matter-server
60+
matter-server:
61+
image: ghcr.io/home-assistant-libs/python-matter-server:stable
62+
container_name: matter-server
63+
restart: unless-stopped
64+
# Required for mDNS to work correctly
65+
network_mode: host
66+
security_opt:
67+
# Needed for Bluetooth via dbus
68+
- apparmor:unconfined
69+
volumes:
70+
# Create an .env file that sets the USERDIR environment variable.
71+
- ${USERDIR:-$HOME}/docker/matter-server/data:/data/
72+
# Required for Bluetooth via D-Bus
73+
- /run/dbus:/run/dbus:ro
74+
# If you adjust command line, make sure to pass the default CMD arguments too:
75+
#command: --storage-path /data --paa-root-cert-dir /data/credentials --bluetooth-adapter 0
76+
```

docs/matter_logo.svg

+11
Loading

0 commit comments

Comments
 (0)