Rust implementation of the Matter protocol.
A pure-Rust, no_std, no-alloc, async-first, extensible and safe implementation of the Matter protocol.
Scales from bare-metal MCUs with 1MB flash and 256KB RAM to ARM embedded Linux and bigger iron!
Rather than a shrink-wrapped solution, it is first and formeost - a toolkit. Users are free to consume all of the APIs, including the provided system clusters, or only pick up bits and pieces. As in:
rs-matter structures for small or big devices;rs-matter futures as e.g. separate tasks in their async executor of choice;rs-matter-stack arrangement and its down-stream crates;rs-matter on baremetal MCUs with Embassy, look at rs-matter-embassy. Currently supported MCUs:rs-matter on top of the ESP-IDF with Espressif MCUs, look at esp-idf-matterrs-matter on top of any other vendor SDK which is not supported out of the box, you'll have to implement the rs-matter platform traits, as rs-matter-embassy and esp-idf-matter do.We'll have an rs-matter Rust Book in future, but in the meantime - look at the examples, docs, as well as the code documentation.
Use the discussions to ask questions.
rs-matter is relatively feature complete, and can be used to implement both accessories (the typical use case),
as well as controllers and commissioners.
With that said, the API is not stable and is likely to still see some backwards-incompatible changes, though the blast radius should be more limited now.
The currently supported Matter Specification version is 1.6.
Provisioning and operating under the major Smart Home controllers should work just fine. Following are tested to work:
rs-matter currently sits at ~ 60KB .bss and ~ 20KB stack in its smallest configuration);rs-matter-embassy and Thread + BLE Coex for the NRF-52840 weights ~ 600 to 650KB);rs-matter.Also look at all open issues.
rs-matter includes comprehensive CI testing:
xtask for running official Matter test casescargo xtask itestrs-matter provides nix files for setting up reproducible shells on systems using the nix package manager.
There are two different environments for different use-cases.
devenv.nixThis is used for normal development of applications.
To enter this shell, run devenv shell in the project root.
You can optionally follow this with your preferred shell e.g. devenv shell zsh.
This requires devenv to be installed on your system.
For nix managed systems, add pkgs.devenv to environment.systemPackages.
shell.nixThis is for cases where tools expect a standard Linux filesystem layout (FHS).
Use this shell when running cargo xtask itest (see testing topics below) as it sets up connectedhomeip which expects a FHS layout.
To enter this shell, run nix-shell in the project root.
See the examples.
Note that using the "Matter Stack" metaphor of rs-matter-stack / rs-matter-embassy / esp-idf-matter results in less bootstrapping boilerplate.
…$ cargo build --features zeroconfThese days mDNS is still a PITA especially on Windows, but not only.
rs-matter currently offers no less than 5 (five!) mDNS implementations:
avahi, resolve and builtin -
for production use-cases on embedded MCUs and embedded Linux;zeroconf and astro-dnssd - which are kept around
for compatibility with Windows and MacOSX; look inside rs-matter/rs-matter/src/transport/network/mdns for more details on those.The TL;DR is, rather than building with --features zeroconf everywhere, you can try:
--features avahi and --features resolve are your best bet in production;--features astro-dnssd is known to work fine;rustcrypto backend)The RustCrypto sha2 and aes crates select their software backend with a --cfg flag rather than with a Cargo feature,
and the default is the unrolled (faster, ~5KB larger) SHA-256.On flash-constrained MCUs, put in your .cargo/config.toml:
[build]
rustflags = ["--cfg", "sha2_backend_soft=\"compact\"", "--cfg", "aes_backend_soft=\"compact\""]This is what the bloat-check project (the CI flash-size gate) does.
cargo test -- --test-threads 1cargo xtask itestchip-toolWith the chip-tool (the tool for testing Matter) run one of our examples, and then use the Ethernet commissioning mechanism:
chip-tool pairing code 12344321 Or alternatively:
chip-tool pairing ethernet 12344321 123456 0 5540Interact with the device
# Read server-list
chip-tool descriptor read server-list 12344321 0
# Read On/Off status
chip-tool onoff read on-off 12344321 1
# Toggle On/Off by invoking the command
chip-tool onoff on 12344321 1All of these should work. Follow the instructions in your controller phone app.
No open issues yet, or sync has not completed.