diff --git a/matter_server/CHANGELOG.md b/matter_server/CHANGELOG.md new file mode 100644 index 0000000..0ffcb4c --- /dev/null +++ b/matter_server/CHANGELOG.md @@ -0,0 +1,353 @@ +# Changelog + +## 8.1.1 + +- Bump Python Matter Server to [8.1.1](https://github.com/matter-js/python-matter-server/releases/tag/8.1.1) + +## 8.1.0 + +- Bump Python Matter Server to [8.1.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/8.1.0) +- Update bashio to 0.17.1 + +## 8.0.0 + +- Bump Python Matter Server to [8.0.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/8.0.0) + +## 7.0.0 + +- Bump Python Matter Server to [7.0.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/7.0.1) + - This updates Matter to 1.4 +- Update base image components to what is being used in Home Assistant Debian + base images: + - Update tempio to 2024.11.2 + - Update s6-overlay to 3.1.6.2 + - Update bashio to 0.16.2 + +## 6.6.1 + +- Bump Python Matter Server to [6.6.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.6.1) + +## 6.6.0 + +- Bump Python Matter Server to [6.6.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.6.0) + +## 6.5.1 + +- Bump Python Matter Server to [6.5.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.5.1) + +## 6.5.0 + +- Bump Python Matter Server to [6.5.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.5.0) + +## 6.4.2 + +- Add support for custom Matter Server arguments +- Add support to install custom Matter Server and Matter SDK (CHIP) versions + +## 6.4.1 + +- Bump Python Matter Server to [6.4.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.4.0) + +## 6.4.0 + +- Use add-on config directory as update directory + +## 6.3.1 + +- Fix Matter SDK log level when using beta flag + +## 6.3.0 + +- Bump Python Matter Server to [6.3.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.3.0) + +## 6.2.1 + +- Bump Python Matter Server to [6.2.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.2.1) + +## 6.1.2 + +- Bump Python Matter Server to [6.1.2](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.1.2) + +## 6.1.1 + +- Bump Python Matter Server to [6.1.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.1.1) + +## 6.1.0 + +- Bump Python Matter Server to [6.1.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.1.0) + - This update is required for Home Assistant Core 2024.6.0 + +## 6.0.0 + +- Bump Python Matter Server to [6.0.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/6.0.0) + - This updates Matter to 1.3 + +## 5.6.0 + +- Bump Python Matter Server to [5.10.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.10.0) + +## 5.5.1 + +- Fix logging in case fallback method for determining the primary network interface is used + +## 5.5.0 + +- Bump Python Matter Server to [5.9.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.9.0) +- Enable Ingress for the Python Matter Server built-in web interface +- Store PAA root certificates in /data to avoid download on every startup (downloads once a day) + +## 5.4.1 + +- Bump Python Matter Server to [5.8.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.8.1) + +## 5.4.0 + +- Bump Python Matter Server to [5.8.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.8.0) + +## 5.3.0 + +- Bump Python Matter Server to [5.7.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.7.0) +- Add Matter SDK log options + +## 5.2.0 + +- Bump Python Matter Server to [5.6.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.6.0) + +## 5.1.2 + +- Bump Python Matter Server to [5.5.3](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.5.3) + +## 5.1.1 + +- Bump Python Matter Server to [5.5.2](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.5.2) + +## 5.1.0 + +- Bump Python Matter Server to [5.5.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.5.1) +- Bind Python WebSocket on internal interface only by default + +## 5.0.4 + +- Correctly bump Python Matter Server to [5.2.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.2.1) + +## 5.0.3 + +- Bump Python Matter Server to [5.2.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.2.1) +- Pass primary interface to Python Matter server + +## 5.0.2 + +- Bump Python Matter Server to [5.1.4](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.1.4) + +## 5.0.1 + +- Bump Python Matter Server to [5.0.3](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.0.3) +- Fix matter-server finish script to report exit code +- Attach gdb debugger in beta mode to print stack traces on crash + +## 5.0.0 + +- Bump Python Matter Server to [5.0.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/5.0.1) +- Bump minimum required Home Assistant core version to 2023.12 due to breaking changes in the schema + +## 4.10.2 + +- Bump Python Matter Server to [4.0.2](https://github.com/home-assistant-libs/python-matter-server/releases/tag/4.0.2) + +## 4.10.1 + +- Bump Python Matter Server to [4.0.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/4.0.1) + +## 4.10.0 + +- Add beta flag to the add-on which installs Python Matter Server pre-releases at startup. + +## 4.9.0 + +- Bump Python Matter Server to [3.7.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.7.0) + +## 4.8.3 + +- Bump Python Matter Server to [3.6.4](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.6.4) + +## 4.8.2 + +- Bump Python Matter Server to [3.6.3](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.6.3) + +## 4.8.1 + +- Bump Python Matter Server to [3.6.2](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.6.2) + +## 4.8.0 + +- Bump Python Matter Server to [3.6.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.6.1) + +## 4.7.0 + +- Use the Python Matter Server container as base +- Bump Python Matter Server to [3.5.2](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.5.2) + +## 4.6.1 + +- Bump Python Matter Server to [3.5.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.5.1) + - Various small bug/stability fixes + +## 4.6.0 + +- Bump Python Matter Server to [3.5.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.5.0) + - Uses libnl based address selection to avoid using deprecated/temporary IP addresses + - libnl avoids "Endpoint pool full" errors as well +- Add dependency to support libnl based IP address selection + +## 4.5.1 + +- Bump Python Matter Server to [3.4.2](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.4.2) + +## 4.5.0 + +- Bump Python Matter Server to [3.4.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.4.1) +- Bump to Python 3.11 + +## 4.4.0 + +- Bump Python Matter Server to [3.4.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.4.0) + - This updates Matter to 1.1 +- Update S6 Overlay to v3.1.5.0 + +## 4.3.1 + +- Bump Python Matter Server to [3.3.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.3.1) + +## 4.3.0 + +- Bump Matter Server to [3.3.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.3.0) + +## 4.2.0 + +- Bump Matter Server to [3.2.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.2.0) +- Significantly reduced add-on size + +## 4.1.0 + +- Bump Matter Server to [3.1.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.1.0) + +## 4.0.0 + +- Bump Matter Server to [3.0.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/3.0.0) + +## 3.1.0 + +- Use Python 3.10 + +## 3.0.4 + +- Bump Matter Server to [2.1.1](https://github.com/home-assistant-libs/python-matter-server/releases/tag/2.1.1) +- Drop unnecessary Python dependencies from image + +## 3.0.3 + +- Bump Matter Server to [2.1.0](https://github.com/home-assistant-libs/python-matter-server/releases/tag/2.1.0) + +## 3.0.2 + +- Bump Matter Server to [2.0.2](https://github.com/home-assistant-libs/python-matter-server/releases/tag/2.0.2) + +## 3.0.1 + +- Bump Matter Server fabric ID after changing vendor ID + +## 3.0.0 + +- Bump Matter Server to 2.0.1 +- Use Nabu Casa Vendor ID by default + +### Breaking + +- All commissioned devices need to be recommissioned. + +## 2.1.0 + +- Bump Matter Server to 1.1.0 + +## 2.0.0 + +- Require Home Assistant Core 2023.1.0b1 to install the add-on. The chip SDK was bumped in [Matter Server 1.0.8](https://github.com/home-assistant-libs/python-matter-server/releases/tag/1.0.8). + +## 1.2.0 + +- Bump Matter Server to 1.0.8 +- Bump pre-built Matter SDK wheels to 2022.12.0 +- Make sure production PAA certificates work too + +## 1.1.2 + +- Get most recent certificates from master branch + +## 1.1.1 + +- Fix startup when Matter Server WebSocket port is not exposed + +## 1.1.0 + +- Allow to set Matter Server logging level +- Set storage path correctly +- Fix support for custom port + +## 1.0.7 + +- Bump Matter Server to 1.0.7 + +## 1.0.6 + +- Bump Matter Server to 1.0.6 + +## 1.0.5 + +- Bump Matter Server to 1.0.5 + +## 1.0.4 + +- Bump Matter Server to 1.0.4 + +## 1.0.1 + +- Bump Matter Server to 1.0.1 +- Use pre-built Matter SDK (CHIP) wheels + +## 0.4.0 + +- Add add-on discovery + +## 0.3.0 + +- Bump to CHIP version 989ad8e (2022-09-16 16:52 -0500) (start of the v1 branch!) +- Bump Matter Server to 0.3.0 + +## 0.2.2 + +- Bump to CHIP version 5b603f3874 (2022-07-05 21:21:19 -0700) +- Bump Matter Server to 0.2.3 +- Avoid cloning not required git repositories during build speedup build process + +## 0.2.1 + +- Bump Matter Server to 0.2.2 + +## 0.2.0 + +- Bump to CHIP version 5d8599d195 (2022-06-09 12:57:45 -0400) +- Bump Matter Server to 0.2.1 + +## 0.1.2 + +- Bump Matter Server to first official release 0.1.0 + +## 0.1.1 + +- Fix Matter Server start location so it can find device certificates +- Bump Matter Server to git version ac5545b (2022-06-11 00:04:34 +0200) + +## 0.1.0 + +- initial version +- CHIP version 55ab764bea (2022-06-06 23:10:48 -0400) diff --git a/matter_server/DOCS.md b/matter_server/DOCS.md new file mode 100644 index 0000000..7c96639 --- /dev/null +++ b/matter_server/DOCS.md @@ -0,0 +1,58 @@ +# Home Assistant Add-on: Matter Server + +## Installation + +Use the following steps to install this add-on. + +1. Click the Home Assistant My button below to open the add-on page on your + Home Assistant instance. + + [![Open this add-on in your Home Assistant instance.][addon-badge]][addon] + +1. Click the "Install" button to install the add-on. + +## How to use + +Start the Matter Server add-on to make the WebSocket available to Home +Assistant Core. Install the [Matter integration][matter_integration] +in Home Assistant Core. + +### Access WebSocket interface externally (advanced) + +By default, the Python Matter Server's WebSocket interface is only exposed +internally. It is still possible to enable access through the host interface +To do so, click on "Show disabled ports" and enter a port (e.g. 5580) in the +Matter Server WebSocket server port field. + +## Configuration + +Add-on configuration: + +| Configuration | Description | +|---------------------|-------------------------------------------------------------| +| log_level | Logging level of the Matter Server component. | +| log_level_sdk | Logging level for Matter SDK logs. | +| beta | Whether to install the latest beta version on startup | +| enable_test_net_dcl | Enable test-net DCL for PAA root certificates and other device information. | +| bluetooth_adapter_id | Set BlueZ Bluetooth Controller ID (for local commissioning) | + +## Support + +Got questions? + +You have several options to get them answered: + +- The [Home Assistant Discord Chat Server][discord]. +- The Home Assistant [Community Forum][forum]. +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] + +In case you've found a bug, please [open an issue on our GitHub][issue]. + +[addon]: https://my.home-assistant.io/redirect/supervisor_addon/?addon=core_matter_server +[addon-badge]: https://my.home-assistant.io/badges/supervisor_addon.svg +[discord]: https://discord.gg/c5DvZ4e +[forum]: https://community.home-assistant.io +[reddit]: https://reddit.com/r/homeassistant +[issue]: https://github.com/home-assistant/addons/issues +[matter_server_repo]: https://github.com/home-assistant-libs/python-matter-server +[matter_integration]: https://www.home-assistant.io/integrations/matter/ diff --git a/Dockerfile b/matter_server/Dockerfile similarity index 100% rename from Dockerfile rename to matter_server/Dockerfile diff --git a/matter_server/README.md b/matter_server/README.md new file mode 100644 index 0000000..1cab39a --- /dev/null +++ b/matter_server/README.md @@ -0,0 +1,15 @@ +# Home Assistant Add-on: Matter Server + +![Supports aarch64 Architecture][aarch64-shield] +![Supports amd64 Architecture][amd64-shield] + +## About + +Matter Python WebSocket Server for Home Assistant Core. Matter (formerly +known as Connected Home over IP or CHIP) is an IPv6 based smart home +standard. This add-on provides a Matter Controller which allows you to +commission and control of Matter devices. The matching Home Assistant Core +integration communicates via WebSocket with this server. + +[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg +[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg diff --git a/matter_server/RELEASE.md b/matter_server/RELEASE.md new file mode 100644 index 0000000..66d6391 --- /dev/null +++ b/matter_server/RELEASE.md @@ -0,0 +1,11 @@ +# Release documentation for developers + +## Matter Server Update Procedure + +When updating the server library in the add-on follow these steps: + +1. Update the `MATTER_SERVER_VERSION` argument in `build.yaml`. +2. Check if the chip SDK version has changed in the server library. +3. If the minimal supported schema version has changed, set the `homeassistant` key in `config.yaml` to the minimum version of Home Assistant Core required to install or update the add-on. +4. Update the add-on version in `config.yaml`. Bump to a new major version if the minimum schema version has changed. +5. Update the changelog in `CHANGELOG.md`. Include a markdown link to the GitHub release of the server in the changelog. diff --git a/matter_server/build.yaml b/matter_server/build.yaml new file mode 100644 index 0000000..b9d8156 --- /dev/null +++ b/matter_server/build.yaml @@ -0,0 +1,8 @@ +--- +build_from: + aarch64: ghcr.io/matter-js/python-matter-server:8.1.1 + amd64: ghcr.io/matter-js/python-matter-server:8.1.1 +args: + BASHIO_VERSION: 0.17.1 + TEMPIO_VERSION: 2024.11.2 + S6_OVERLAY_VERSION: 3.1.6.2 diff --git a/matter_server/config.yaml b/matter_server/config.yaml new file mode 100644 index 0000000..1f2c082 --- /dev/null +++ b/matter_server/config.yaml @@ -0,0 +1,44 @@ +--- +version: 8.1.1 +slug: matter_server +name: Matter Server +description: Matter WebSocket Server for Home Assistant Matter support. +url: >- + https://github.com/home-assistant/addons/tree/master/matter_server +arch: + - aarch64 + - amd64 +discovery: + - matter +hassio_api: true +homeassistant: 2024.6.0 +# IPC is only used within the Add-on +host_ipc: false +host_network: true +host_dbus: true +image: homeassistant/{arch}-addon-matter-server +ingress: true +ingress_port: 5580 +init: false +map: + - type: addon_config + read_only: false +options: + log_level: info + log_level_sdk: error + beta: false + enable_test_net_dcl: false +schema: + log_level: list(verbose|debug|info|warning|error|critical) + log_level_sdk: list(automation|detail|progress|error|none)? + beta: bool? + enable_test_net_dcl: bool? + bluetooth_adapter_id: int? + matter_server_args: + - str? + matter_server_version: str? + matter_sdk_wheels_version: str? +ports: + 5580/tcp: null +stage: stable +startup: services diff --git a/matter_server/icon.png b/matter_server/icon.png new file mode 100644 index 0000000..1fe6a56 Binary files /dev/null and b/matter_server/icon.png differ diff --git a/matter_server/logo.png b/matter_server/logo.png new file mode 100644 index 0000000..3ba729e Binary files /dev/null and b/matter_server/logo.png differ diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/banner/type b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/banner/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/banner/type @@ -0,0 +1 @@ +oneshot diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/banner/up b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/banner/up new file mode 100644 index 0000000..dc29231 --- /dev/null +++ b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/banner/up @@ -0,0 +1 @@ +/etc/s6-overlay/scripts/banner.sh diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/dependencies.d/banner b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/dependencies.d/banner new file mode 100644 index 0000000..e69de29 diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/finish b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/finish new file mode 100644 index 0000000..40aba91 --- /dev/null +++ b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/finish @@ -0,0 +1,19 @@ +#!/usr/bin/env bashio +# vim: ft=bash +# ============================================================================== +# s6-overlay docs: https://github.com/just-containers/s6-overlay +# ============================================================================== + +if test "$1" -eq 256 ; then + e=$((128 + $2)) +else + e="$1" +fi + +if test "$e" -ne 0; then + bashio::log.warning "matter-server service exited with code $e (by signal $2)." + echo "$e" > /run/s6-linux-init-container-results/exitcode + exec /run/s6/basedir/bin/halt +else + bashio::log.info "matter-server service exited with code $e (by signal $2)." +fi diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run new file mode 100644 index 0000000..4b74c10 --- /dev/null +++ b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run @@ -0,0 +1,107 @@ +#!/usr/bin/with-contenv bashio +# vim: ft=bash +# shellcheck shell=bash +# ============================================================================== +# Start matter-server service +# ============================================================================== +bashio::log.info "Starting Matter Server..." + +declare server_port +declare log_level +declare log_level_sdk +declare primary_interface +declare matter_server_version +declare chip_version +matter_server_args=() +extra_args=() + +if ! bashio::config.exists log_level; then + bashio::log.magenta 'No log_level set in config, fallback to info' +fi +log_level=$(bashio::string.lower "$(bashio::config log_level info)") + +# Make Matter SDK log level currently default to error +log_level_sdk=$(bashio::string.lower "$(bashio::config log_level_sdk error)") + +if bashio::config.has_value "matter_server_version"; then + matter_server_version=$(bashio::config 'matter_server_version') + bashio::log.info "Installing Python Matter Server ${matter_server_version}" + # shellcheck disable=SC2102 + pip3 install --pre python-matter-server[server]=="${matter_server_version}" +elif bashio::config.true "beta"; then + bashio::log.info 'Upgrading Python Matter Server to latest pre-release' + # shellcheck disable=SC2102 + pip3 install --upgrade --pre python-matter-server[server] +fi + +if bashio::config.has_value "matter_sdk_wheels_version"; then + chip_version=$(bashio::config 'matter_sdk_wheels_version') + bashio::log.info "Installing Matter SDK ${chip_version}" + pip3 install --pre --no-dependencies \ + home-assistant-chip-clusters=="${chip_version}" \ + home-assistant-chip-core=="${chip_version}" +fi + +# Bind to internal hassio network only unless user requests to expose +server_port="$(bashio::addon.port 5580)" +if ! bashio::var.has_value "${server_port}"; then + server_port=5580 + extra_args+=('--listen-address' "$(bashio::addon.ip_address)") +fi + +if bashio::config.true "enable_test_net_dcl"; then + extra_args+=('--enable-test-net-dcl') +fi + +primary_interface="$(bashio::api.supervisor 'GET' '/network/info' '' 'first(.interfaces[] | select (.primary == true)) .interface')" + +# Try fallback method (e.g. in case NetworkManager is not available) +# shellcheck disable=SC2086 +if [ -z ${primary_interface} ]; then + bashio::log.warning 'Trying fallback method to determine primary interface' + primary_interface="$(ip --json route show default | jq --raw-output '.[0].dev')" +fi + +# shellcheck disable=SC2086 +if [ -z ${primary_interface} ] || [ ${primary_interface} == "null" ]; then + bashio::exit.nok "No primary network interface found!" +fi + +if bashio::config.has_value "bluetooth_adapter_id"; then + # shellcheck disable=SC2207 + extra_args+=('--bluetooth-adapter' $(bashio::config 'bluetooth_adapter_id')) +fi + +if bashio::config.has_value "matter_server_args"; then + # shellcheck disable=SC2207 + extra_args+=($(bashio::config 'matter_server_args')) +fi + +bashio::log.info "Using '${primary_interface}' as primary network interface." + +# Send out discovery information to Home Assistant +/etc/s6-overlay/scripts/matter-server-discovery & + +# shellcheck disable=SC2164 +cd /root + +# shellcheck disable=SC2206 +matter_server_args+=( + '--storage-path' "/data" + '--port' "${server_port}" + '--log-level' "${log_level}" + '--log-level-sdk' "${log_level_sdk}" + '--primary-interface' "${primary_interface}" + '--paa-root-cert-dir' "/data/credentials" + '--ota-provider-dir' "/config/updates" + '--fabricid' 2 + '--vendorid' 4939 + ${extra_args[@]} +) + +if bashio::config.true "beta"; then + exec /usr/bin/gdb --quiet -ex="set confirm off" -ex run -ex backtrace -ex "quit \$_exitcode" --args /usr/local/bin/python \ + /usr/local/bin/matter-server "${matter_server_args[@]}" +else + exec /usr/local/bin/matter-server "${matter_server_args[@]}" +fi diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/type b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/type @@ -0,0 +1 @@ +longrun diff --git a/matter_server/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/matter-server b/matter_server/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/matter-server new file mode 100644 index 0000000..e69de29 diff --git a/matter_server/rootfs/etc/s6-overlay/scripts/banner.sh b/matter_server/rootfs/etc/s6-overlay/scripts/banner.sh new file mode 100644 index 0000000..074dc41 --- /dev/null +++ b/matter_server/rootfs/etc/s6-overlay/scripts/banner.sh @@ -0,0 +1,38 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash +# ============================================================================== +# Home Assistant Community Add-on: Base Images +# Displays a simple add-on banner on startup +# ============================================================================== +if bashio::supervisor.ping; then + bashio::log.blue \ + '-----------------------------------------------------------' + bashio::log.blue " Add-on: $(bashio::addon.name)" + bashio::log.blue " $(bashio::addon.description)" + bashio::log.blue \ + '-----------------------------------------------------------' + + bashio::log.blue " Add-on version: $(bashio::addon.version)" + if bashio::var.true "$(bashio::addon.update_available)"; then + bashio::log.magenta ' There is an update available for this add-on!' + bashio::log.magenta \ + " Latest add-on version: $(bashio::addon.version_latest)" + bashio::log.magenta ' Please consider upgrading as soon as possible.' + else + bashio::log.green ' You are running the latest version of this add-on.' + fi + + bashio::log.blue " System: $(bashio::info.operating_system)" \ + " ($(bashio::info.arch) / $(bashio::info.machine))" + bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)" + bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)" + + bashio::log.blue \ + '-----------------------------------------------------------' + bashio::log.blue \ + ' Please, share the above information when looking for help' + bashio::log.blue \ + ' or support in, e.g., GitHub, forums or the Discord chat.' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/matter_server/rootfs/etc/s6-overlay/scripts/matter-server-discovery b/matter_server/rootfs/etc/s6-overlay/scripts/matter-server-discovery new file mode 100644 index 0000000..d36992d --- /dev/null +++ b/matter_server/rootfs/etc/s6-overlay/scripts/matter-server-discovery @@ -0,0 +1,20 @@ +#!/usr/bin/with-contenv bashio +# vim: ft=bash +# shellcheck shell=bash +# ============================================================================== +# Send matter discovery information to Home Assistant +# ============================================================================== +declare ha_config + +# Prepare discovery payload +ha_config=$(\ + bashio::var.json \ + host "$(hostname)" \ + port "^5580" \ +) + +if bashio::discovery "matter" "${ha_config}" > /dev/null; then + bashio::log.info "Successfully send discovery information to Home Assistant." +else + bashio::log.error "Discovery message to Home Assistant failed!" +fi diff --git a/matter_server/translations/en.yaml b/matter_server/translations/en.yaml new file mode 100644 index 0000000..d7e4432 --- /dev/null +++ b/matter_server/translations/en.yaml @@ -0,0 +1,46 @@ +--- +configuration: + log_level: + name: Matter Server Log Level + description: Logging level of the Matter Server component. + log_level_sdk: + name: Matter SDK Log Level + description: Logging level of the Matter SDK. + beta: + name: Use the latest beta version + description: >- + Installs the latest beta of the Python Matter Server. It is recommended + to create a backup before starting the add-on with this flag enabled! + enable_test_net_dcl: + name: Enable test-net DCL usage. + description: >- + Enable PAA root certificates and other device information from test-net + DCL. This is meant for development and testing purposes. + bluetooth_adapter_id: + name: Bluetooth Adapter ID + description: >- + BlueZ Bluetooth Adapter Controller ID used by the Matter Server. This is + required if local commissioning via Bluetooth is used. Note: Using the + Home Assistant Companion app commissioning method is recommended as it is + better tested and allows to commission directly in proximity of the device + itself. + matter_server_args: + name: Extra Matter Server arguments + description: >- + This allows to pass additional command line arguments to the Python Matter + Server. Use `--help` to get a list of possible arguments. Note that + arguments are also added by the startup script controlled by other add-on + options. + matter_server_version: + name: Matter Server version + description: >- + Install custom Matter Server version. WARNING: An older version might have + an incompatible storage format! Use this feature with caution! Make sure + you have a recent backup of the add-on! + matter_sdk_wheels_version: + name: Matter SDK wheels version + description: >- + Install custom Matter SDK wheels version. NOTE: The API might not be + compatible with the Python Matter server. +network: + 5580/tcp: Matter Server WebSocket server port.