|
1 | 1 | # Python Matter Server
|
2 | 2 |
|
3 |
| -This project implements a Matter Controller Server over WebSockets using the [official Matter (formerly CHIP) SDK](https://github.com/project-chip/connectedhomeip) as a base and provides both a server and client implementation. |
| 3 | +This project implements a Matter Controller Server over WebSockets using the |
| 4 | +[official Matter (formerly CHIP) SDK](https://github.com/project-chip/connectedhomeip) |
| 5 | +as a base and provides both a server and client implementation. |
4 | 6 |
|
5 |
| -The goal of this project is primary to have Matter support in Home Assistant but its universal approach makes it suitable to be used in other projects too. |
| 7 | +The goal of this project is primary to have Matter support in Home Assistant |
| 8 | +but its universal approach makes it suitable to be used in other projects too. |
6 | 9 |
|
7 |
| -This repository is for development only (so not for enduser support). For enabling Matter support within Home Assistant, please refer to the [Home Assistant documentation](https://www.home-assistant.io/integrations/matter/). |
| 10 | +## Support |
| 11 | + |
| 12 | +Got questions? |
| 13 | + |
| 14 | +You have several options to get them answered: |
| 15 | + |
| 16 | + * The Home Assistant [Community Forum](https://community.home-assistant.io/). |
| 17 | + * The Home Assistant [Discord Chat Server](https://discord.gg/c5DvZ4e). |
| 18 | + * Join [the Reddit subreddit in /r/homeassistant](https://reddit.com/r/homeassistant). |
| 19 | + |
| 20 | +If you experience issues using Matter with Home Assistant, please open an issue |
| 21 | +report in the [Home Assistant Core repository](https://github.com/home-assistant/core/issues/new/choose). |
| 22 | + |
| 23 | +You may also open issues in this repository if you are absolutely sure that your |
| 24 | +issue is related to the Matter Server component. |
| 25 | + |
| 26 | +## Installation |
| 27 | + |
| 28 | +We strongly recommend to use 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 Thead, |
| 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 Thread devices |
| 43 | + |
| 44 | +Make sure your 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 accross 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 ND RIO's are processed, and processed correctly depends on the network |
| 58 | +management software your system is using. There may be bugs and cavats 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 | + -v /run/dbus:/run/dbus:ro \ |
| 106 | + --network=host \ |
| 107 | + ghcr.io/home-assistant-libs/python-matter-server:stable |
| 108 | +``` |
| 109 | + |
| 110 | +### Running using Docker compose |
| 111 | + |
| 112 | +```sh |
| 113 | +docker compose up -d |
| 114 | +docker compose logs -f |
| 115 | +``` |
8 | 116 |
|
9 | 117 | NOTE: Both Matter and this implementation are in early (v1) 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.
|
10 | 118 |
|
|
0 commit comments