Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions spk/matter-server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
SPK_NAME = matter-server
SPK_VERS = 8.1.0
SPK_REV = 1
SPK_ICON = src/matter.png

# 64-bit OS supported only
# and therefore home-assistant-chip-core is only available for x64 and aarch64
UNSUPPORTED_ARCHS = $(32bit_ARCHS)

# home-assistant-chip-core requires "glibc >= 2.34"
# Despite home-assistant-chip-core wheel is provided as manylinux_2_31, it requires glibc 2.34 and not 2.31
REQUIRED_MIN_DSM = 7.2

PYTHON_PACKAGE = python312
SPK_DEPENDS = "$(PYTHON_PACKAGE)"

MAINTAINER = SynoCommunity
DESCRIPTION = The Open Home Foundation Matter Server is an officially certified Software Component to create a Matter controller. It serves as the foundation to provide Matter support to Home Assistant but its universal approach makes it suitable to be used in other projects too. This package conains a custom library for home-assistant-chip-core to allow definition of config data path.
DISPLAY_NAME = Python Matter Server
CHANGELOG = "1. Initial package with custom build of home_assistant_chip_core==2025.7.0"

HOMEPAGE = https://github.com/home-assistant-libs/python-matter-server
LICENSE = Apache 2.0

STARTABLE = yes
SERVICE_SETUP = src/service-setup.sh

FWPORTS = src/matter-server.sc
SERVICE_PORT = 5580

USE_ALTERNATE_TMPDIR = 1

POST_STRIP_TARGET = matter-server_extra_install

WHEELS = src/requirements-crossenv.txt

# [PyYAML]
DEPENDS += cross/libyaml

include ../../mk/spksrc.python.mk

ifeq ($(findstring $(ARCH),$(x64_ARCHS)),$(ARCH))
CUSTOM_CHIP_WHEELS_DIR = src/custom_wheels/x64
else ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
CUSTOM_CHIP_WHEELS_DIR = src/custom_wheels/aarch64
endif

.PHONY: matter-server_extra_install
matter-server_extra_install:
@install -m 755 -d $(STAGING_DIR)/share/wheelhouse
@install -m 644 src/requirements-pure.txt $(STAGING_DIR)/share/
@install -m 644 $(CUSTOM_CHIP_WHEELS_DIR)/* $(STAGING_DIR)/share/wheelhouse/
1 change: 1 addition & 0 deletions spk/matter-server/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rsc:share/wheelhouse
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions spk/matter-server/src/matter-server.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[matter_ws]
title="Matter WebService (TCP)"
desc="matter ws"
port_forward="yes"
dst.ports="5580/tcp"
Binary file added spk/matter-server/src/matter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions spk/matter-server/src/requirements-crossenv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
aiohttp==3.12.15
cffi==1.17.1
cryptography==45.0.7
frozenlist==1.7.0
#home_assistant_chip_core==2025.7.0 # no source available, prebuilt custom version added to package
multidict==6.6.4
orjson==3.11.3
propcache==0.3.2
PyYAML==6.0.2
yarl==1.20.1
zeroconf==0.147.0 # requirement not found with generate requirements script
42 changes: 42 additions & 0 deletions spk/matter-server/src/requirements-pure.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
aenum==3.1.16
aiohappyeyeballs==2.6.1
aiorun==2025.1.1
aiosignal==1.4.0
asttokens==3.0.0
async_timeout==5.0.1
atomicwrites==1.4.1 # dependency not found with generate requirements script
attrs==25.3.0
coloredlogs==15.0.1
construct==2.10.70
dacite==1.9.2
decorator==5.2.1
deprecation==2.1.0
ecdsa==0.19.1
executing==2.2.1
home_assistant_chip_clusters==2025.7.0
humanfriendly==10.0
idna==3.10
ifaddr==0.2.0 # dependency of zeroconf (not found with generate requirements script)
ipdb==0.13.13
ipython==9.5.0
ipython_pygments_lexers==1.1.1
jedi==0.19.2
markdown_it_py==4.0.0
matplotlib_inline==0.1.7
mdurl==0.1.2
packaging==25.0
parso==0.8.5
pexpect==4.9.0
#pip==25.0.1 # => python312
prompt_toolkit==3.0.52
ptyprocess==0.7.0
pure_eval==0.2.3
pycparser==2.22
pygments==2.19.2
python_matter_server==8.1.0
rich==14.1.0
six==1.17.0
stack_data==0.6.3
traitlets==5.14.3
typing_extensions==4.15.0
wcwidth==0.2.13
35 changes: 35 additions & 0 deletions spk/matter-server/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
PYTHON_VER=python3.12
PYTHON_DIR="/var/packages/python312/target/bin"
PATH="${SYNOPKG_PKGDEST}/env/bin:${SYNOPKG_PKGDEST}/bin:${PYTHON_DIR}:${PATH}"

DATA_PATH=${SYNOPKG_PKGVAR}/data
# config data path provided by custom chip library only:
export CHIP_CONIFG_DATA_PATH=${DATA_PATH}
OTA_PROVIDER_DIR=${SYNOPKG_PKGVAR}/ota
SERVER=${SYNOPKG_PKGDEST}/env/bin/matter-server
SERVICE_COMMAND="${SERVER} --log-file ${LOG_FILE} --storage-path ${DATA_PATH} --ota-provider-dir ${OTA_PROVIDER_DIR}"
SVC_WRITE_PID=y
SVC_BACKGROUND=y


service_postinst ()
{
separator="===================================================="

echo ${separator}
echo "Install Python virtual environment"
install_python_virtualenv

echo ${separator}
echo "Install packages from wheelhouse"
pip install --disable-pip-version-check --no-deps --no-input --no-index ${SYNOPKG_PKGDEST}/share/wheelhouse/*.whl

echo ${separator}
echo "Install python packages from index"
pip install --disable-pip-version-check --no-deps --no-input --requirement ${SYNOPKG_PKGDEST}/share/requirements-pure.txt

echo ${separator}
echo "create special folders"
mkdir -p ${DATA_PATH}
mkdir -p ${OTA_PROVIDER_DIR}
}