How home-assistant-libs/python-matter-server works
Project type and purpose
• This is a full-stack, controller-oriented software component (“Open Home Foundation Matter Server”) that implements a Matter Controller Server over WebSockets, plus a web-based dashboard client.
• It provides both a Python “server” (using the official Matter/CHIP SDK under the covers) and a TypeScript/JavaScript “dashboard” client that runs in a browser.
• It is designed to sit between Matter-capable devices and clients such as Home Assistant or the project’s own web dashboard, exposing device control and commissioning via a WebSockets API.
File structure
Top-level directories and key files:
• dashboard/ – web frontend, bundled with Rollup, TypeScript code under src/, a collection of UI components, pages, and a client library in src/client that wraps the WebSockets API.
• matter_server/ – Python package subdivided into:
– client/ – Python equivalents to the TS client library, for programmatic use
– common/ – shared constants, helper functions, JSON serializers, logging, etc.
– server/ – core server implementation: WebSocket server, client_handler, device_controller, OTA stack, storage, SDK bindings, and supporting helpers.
• main.py – entry point for launching the Python server
• Dockerfile(.dev) and docker-entrypoint.sh – containerization instructions
• scripts/ – utility scripts (e.g., code generation, environment setup)
• tests/ – unit and integration tests for both client and server modules
• docs/ – documentation for Docker setup, OS requirements, WebSockets API, etc.
README for additional insights
• Confirms the use of the official Matter SDK as a base.
• The server exposes a WebSockets API for clients to control devices and listen for events.
• There is both a server and a client implementation (Python and TypeScript).
• Target use case includes Home Assistant integration and standalone Docker deployment.