How can I control a Matter device?
Asked on 2024-07-30
1 search
To control a Matter device, you can follow these steps as demonstrated in the session "Go small with Embedded Swift" at WWDC 2024:
- Set Up HomeKit: Ensure you have a working HomeKit setup with a Wi-Fi network and connected Apple devices.
- Prepare Your Device: Use a programmable embedded device, such as an ESP32-C6 development board with a color LED attached.
- Write the Program: Write a program in Embedded Swift that implements a HomeKit accessory. You can use Swift's interoperability to call existing C APIs from the Matter SDK.
- Create the Root Node and Endpoint: Create a root node representing the entire Matter accessory and an endpoint for the specific device (e.g., a color LED light). The endpoint will handle states like color and brightness and receive commands.
- Register the Device: Flash the application to the device and register it in your HomeKit network. The device will join the Wi-Fi network and appear in the Home app on your Apple devices.
- Control the Device: Use the Home app to control the device, such as turning the light on and off, changing brightness, or adjusting color temperature.
For a detailed walkthrough, you can refer to the following chapters from the session:
- Using Swift's interoperability to control the LED
- Adding the Matter protocol
- Using a Swift enum in the event handler
These chapters provide a comprehensive guide on setting up and controlling a Matter device using Embedded Swift.

Platforms State of the Union 5-Minute Recap
Watch a quick recap of the newest advancements on Apple platforms.

Explore game input in visionOS
Discover how to design and implement great input for your game in visionOS. Learn how system gestures let you provide frictionless ways for players to interact with your games. And explore best practices for supporting custom gestures and game controllers.

Go small with Embedded Swift
Embedded Swift brings the safety and expressivity of Swift to constrained environments. Explore how Embedded Swift runs on a variety of microcontrollers through a demonstration using an off-the-shelf Matter device. Learn how the Embedded Swift subset packs the benefits of Swift into a tiny footprint with no runtime, and discover plenty of resources to start your own Embedded Swift adventure.
