Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example: Matter On/Off Light #20456

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

maikerlab
Copy link

@maikerlab maikerlab commented Mar 11, 2024

Contribution description

  • Adds a new example application: rust-matter-light
  • Application code is written in Rust and implements an "OnOff Light" in Matter protocol
  • Potentially supports all boards which provide the rust_target and periph_eth feature (currently tested on native, native64 and nucleo-f429zi)
  • Uses the external rs-matter library, where the Matter protocol is (partly) implemented
  • Interfaces with RIOT Socket API using the Module socket_embedded_nal_async_udp
  • Depends on a patch of rs-matter, which enables the Cargo feature riot-os to make it work with RIOT
  • The feature psm can be activated in Makefile with CARGO_OPTIONS += --features psm to support storing/loading runtime configurations - NOTE: This would need to be implemented dependent of the target platform!

TODO's

  • Optimize memory usage and try to flash on an embedded device (tested on nucleo-f429zi and works)
  • Persist certificates (DAC with Private+Public Key, PAI) in device and read after boot (atm hard-coded in src/dev_att.rs
  • Persist data during runtime (like associated fabrics), maybe using riot_wrappers::vfs module - but this is still read-only
  • Keep up with developments in rs-matter, where memory was already optimized lately (Shared UDP Buffer) - but new Traits would need to be implemented by the RIOT UDP Socket (see Allow buffer sharing between mDNS and Matter transport; const-ify constructors project-chip/rs-matter#138)

Testing procedure

  • Follow the guides to build the chip-tool
  • Build and flash the application in examples/rust-matter-light on native64 Target: BOARD=native64 make all flash term
  • Discover device on network: ./chip-tool discover commissionables
  • QR Code and manual pairing code for commissioning must be printed on terminal
  • Commission the device using the manual pairing code (without "-") and arbitrary chosen node id (e. g. 12344321): ./chip-tool pairing code <node-id> <pairing-code>

Test supported functionality of commissioned device:

  • Read product name: ./chip-tool basicinformation read product-name <node-id> 0
  • Toggle On/Off state: ./chip-tool onoff on <node-id> 1
  • Read On/Off state: ./chip-tool onoff read on-off <node-id> 1

See CHIP-Tool Documentation for more supported commands.

Issues/PRs references

Resolves #19929.

The device now answers mDNS queries sent to [FF02::FB]:5353.
…oggle Board LED's

Enabled 'nightly' feature for embassy-executor, so memory for tasks will be statically allocated at compile time. Commands On,Off,Toggle are now handled so all switches (LEDs) registered at SAUL will be turned on/off. Also did some refactoring and added config.toml for compatibility with rust-analyzer.
@maikerlab maikerlab changed the title WIP: Porting Matter to RIOT OS Porting Matter to RIOT OS Apr 9, 2024
@maikerlab maikerlab marked this pull request as ready for review April 9, 2024 09:55
@maikerlab maikerlab requested a review from chrysn as a code owner April 9, 2024 09:55
… random module from riot-wrappers with HWRNG
…supported, get seconds since UNIX epoch from ztimer_sec
…ecision; print passcode and discriminator with matter shell cmd
… maikerlab/rust-riot-wrappers (branch=with_matter)
@maikerlab maikerlab changed the title Porting Matter to RIOT OS Example: Matter On/Off Light Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: examples Area: Example Applications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Porting the Matter Standard to RIOT OS
1 participant