Implementation of Matter protocol in Typescript with no native dependencies (and very limited dependencies).
Matter is a new secure / reliable / local / standard protocol for smart devices launched at the end of 2022. To know more about Matter: https://csa-iot.org/all-solutions/matter/
matter-node.js is compatible with:
- Apple iOS (iPhone or iPad) and tvOS 16 (Apple TV) - "Home" app by Apple: fully working
- Google Home Ecosystem (Android or Google Nest smart speakers/display) - "Google Home" app: fully working
- Amazon Alexa (Amazon Echo smart speakers/displays) : fully working
- Home Assistant - Matter integration: fully working
- Tuya Smart (SmartLife) app: fully working
- Samsung SmartThings (Station or Hub v2 and later): pairing works, but for controlling seems like Smartthings implementation itself has issues
Each system have their own specialities, see Pairing and Usage Information for more details.
This repository contains multiple packages (and because of this it is a monorepo). The packages are contained in the packages
directory and are all published separately to NPM.
- matter.js: the core Matter implementation in typescript which is JavaScript only and has no native dependencies.
- matter-node.js: a node.js implementation of a Matter DeviceNode and ControllerNode which also re-exports all matter.js exports and so can be used as only dependency
This repository uses the workspaces feature on npm to manage the dependencies between the packages. Because of this please only use npm install
on the root of the repository. This will install all the dependencies for all the packages and also take care to create relevant symlinks between the packages.
Additionally, it uses typescript project references to allow IDE support for the dependencies. These dependencies need to be added to the tsconfig.json files if needed.
You can build and test the packages separately or all by using npm run build
or npm run test
on root package level.
If you have issues please use the GitHub "Issues" feature of this repository. For questions or idea discussions please use the "Discussions" feature in GitHub.
Additionally, we started a Discord server for Matter-Integrators to allow to communicate about the protocol and how to implement Matter in various environments (not only just JavaScript/Typescript). You can join it here: https://discord.gg/ujmRNrhDuW .
If you like to develop matter.js itself or want to contribute to it, you can use the following commands:
git clone https://github.com/project-chip/matter.js
cd matter.js
npm install
This will install all dependencies and create symlinks between the packages, so that it can be used locally. It also builds all packages.
Matter.js is the core implementation of the Matter protocol in typescript. It is a JavaScript only implementation and has no native dependencies. It is build and published as CommonJS and ES6 variants in one package. For an overview of the exported functionality please refer to the README.md
Because Matter required UDP/MDNS technologies, other implementations are needed to implement this core functionality platform specific.
For more Details see the README.md in the package.
PS: The above statements are only half true right now (March 2023) because we are in the middle of the split-up to move "non-Node.js" code from matter-node.js into matter.js.
Matter-node.js uses Node.js to implement the platform specific parts using Node.js for networking and other needed native features. Additionally, it also implements a Matter DeviceNode and ControllerNode as a example implementation and allows to use this directly as CLI script. For an overview of the exported functionality please refer to the README.md
For more Details see the README.md in the package.
The project contains eslint as linter and typescript-formatter as formatter. The configuration files are located in the root directory and are valid for all packages.
The following commands are available:
npm run lint
: runs eslint on all packages and outputs the results and errorsnpm run lint-fix
: runs eslint on all packages and tries to fix the errorsnpm run format
: runs typescript-formatter on all packages and formats the code. Files will be changed in place.npm run format-check
: runs typescript-formatter on all packages and checks if the code is formatted correctly. If not it will output the files that need to be formatted.
You can use npm run build
on the root level to build all packages in an incremental way. This will only build the changed files.
You can use npm run build-clean
on the root level to build all packages from scratch.
You can use npm run test
on the root level to run all tests for all packages.
This is work in progress.
Completed implementations:
- TLV codec (coder/decoder) and schema mapping and validation engine
- 12 cluster definitions (including TLV structures for all messages)
matter.js is used at the core of those two projects:
- matternode: a light-weight node.js implementation of a Matter Node
- matter-node.js: a Matter client / server running on node.js compatible with HA (Android / iOs support in progress)
It should work with any Matter-compatible home automation app when Matter will be released. We tested the Library with the "big" ones and can provide additional information.
A good guide with images on how to add devices to Alexa, Google and Apple in general is available in the TP-Link FAQ.
Minimum OS Required for iOS and tvOS devices: iOS 16.2 or later.
Apple support to set up HomePod, HomePod mini, Apple TV, or iPad (will not be supported anymore with the new Home Architecture starting iOS 16.3!) as a Matter Hub. The pairing itself can also be done using an iPhone, but the later controlling can only be done by one of the Hub options listed above!
When pairing with node-matter the Home app will ask you to allow to pair an "uncertified device"which you need to allow. After that the device will be added to the Home app, and you can control it from there.
We currently have no information which device types are supported by the Home app. But Lights and Sockets are support in any case.
Apple is using "two fabric IDs" on the paired devices (all others only use one). This needs to be considered when planning to pair devices with multiple controllers. How many fabrics are available depends on the device manufacturer (minimum are 3).
Minimum Version Required for the "Google Home" app:2.62.1.15 or later.
Also for Google you need to have a Hub device (Android or Google Nest smart speakers/display) out of the list of supported devices to control your Matter devices.
Pairing is currently only possible using the Google Home Android App on Android 8.1 or higher. The iOS App is not supporting Matter yet.
Before you can pair node-matter to Google Home you need to allow uncertified devices for your Google Account. For this open the Google Developer Console to add an Integration and setup the device there. Please use 0xFFF1 as Vendor ID because node-matter uses this by the current scripts. If you do this that pairing will not be possible! If you have issues with pairing please refer to the Troubleshootling pages from Google.
Google supports several Matter device types already.
Minimum Version Required for the "Amazon Alexa" app:2.2.491118.0 or later.
Please note that because Alexa’s temporarily limited setting, Alexa ecosystem (Amazon Echo smart speakers/displays) needs to be paired with Matter-certified device as the first ecosystem. If you are unsure, please factory default your device before setup.
For Amazon Alexa Usage you also need one Alexa device as Matter hub in your local network.
Pairing is currently only possible using the Alexa Android App on Android 8.1 or higher. The iOS App is not supporting Matter yet.
For Alexa no special setup is needed to pair node-matter as development device.
The list of supported device types is basic currently, but will get enhanced in the future.
Home Assistant's official Matter integration is in Beta-stage however it is fully working and compatible with the Matter 1.0 standard. To connect Thread based devices you also need an Thread Border Router radio that is compatible with Home Assistant's official Thread integration, that includes their official Home Assistant Yellow hub and their Home Assistant SkyConnect Zigbee/Thread USB dongle.
- https://www.home-assistant.io/integrations/matter/
- https://www.home-assistant.io/integrations/thread/
Should work but no more detatailed information here as of yet.
Samsung is building its SmartThings hub software into 2022 Samsung Smart TVs, Smart Monitors, and Family Hub refrigerators, allowing them to control Matter smart home devices. Currently, Samsung SmartThings Station or Samsung SmartThings Hub v2 and later are needed as a hub for Matter.
- Samsung "Samsung SmartThings Station" does support Matter devices over LAN, Wi-Fi, and over Thread radio (Thread Border Router).
- "Aeotec Smart Home Hub" (rebranded Samsung SmartThings Hub v3) will be getting an update to supports Matter over Wi-Fi.
- "Samsung SmartThings Hub v3" (ETH-ETH-300 from 2018) has been updated to support Matter over Wi-Fi.
- "Samsung SmartThings Hub v2" (ETH-ETH-250 from 2016) has been updated to support Matter over Wi-Fi.
- "Samsung SmartThings Hub v2" (ETH-ETH-200 from 2015) has been updated to support Matter over Wi-Fi.
- "SmartThings Family Hub" smart fridge might or might not get updated to support Matter at a later date.
- "SmartThings Hub v1" (F-H-ETH-001 and STH-ETH-001) has been discontinued and will not get updated to support Matter.
- "Samsung SmartThings Link" (USB dongle) for Nvidia Shield has been discontinued and will not get updated to support Matter.
Note! Samsung has started that they do not plan on bridging Zigbee and Z-Wave devices connected to their hubs with Matter (e.i. no protocol bridge so far).
Compile chip-tool from project-chip
Provisioning the device:
chip-tool pairing onnetwork 222 20202021
Controlling the device:
chip-tool onoff toggle 222 1
Clearing the data:
chip-tool pairing unpair 222
and/or
chip-tool storage clear-all
You can also control it with Matter test app: https://github.com/project-chip/connectedhomeip/tree/master/src/android/CHIPTest You can find a compiled apk in /matter-test-apk in this repository.
Provisioning the device: click "provision with WiFi" > "Input DeviceNode address" > type IP address of the machine running node-matter
Controlling the device: click "Light on/of" and you can control the light
Well, the original codebase is platform dependent, has finicky tool version requirements and is over 8GB with all dependencies. This tool is less than 500kB and works on anything supporting node. Sure, it supports only the barebone Matter protocol for now.
Not yet, but I know how to make it works with a few tricks.
Adding more clusters should be pretty easy now the core protocol is working. Have a look at the implementation of the OnOff cluster: pretty simple, right?
I am planning on adding more clusters, so stay tuned or pinged me to implement first the one you need.
For other questions, you can post a message on the github forum, open an issue, or join Discord https://discord.gg/ujmRNrhDuW .