Matter in Home Assistant

Quick Start

A building guide is available here.

A Docker image is available on the Docker Hub. Also see docker/README.md.

Next Steps and Advanced Topics are here.

Runtime settings are documented here.

Build configuration options are detailed in CONFIGURATION FLAGS.md.

The man page, detailing command line options, is here.

Some advanced topics and developed in ADVANCED TOPICS.

 

checklist

This was my abbreviated setup checklist

 

Run and have access to OTBR WEB

 

Correctly recognize RCP dongle

 

 Autodiscover Thread after enabling the OTBR integration http://localhost:8081

 

 Have HA create a new preferred thread network & enable “used for Android + IOS credentials”

 

 Run python-matter-server and enable matter integration in HA ws://localhost:5580/ws

 

Sync Thread Credentials on mobile device

Settings > Companion App > Troubleshooting > Sync Thread credentials

Run sync twice, the message should read “Home Assistant and this device use the same network”

 

Device Pairing

Add device via HA Companion App Settings > Devices & services > Devices tab > Add Device button > Add Matter device

 

 

 

Pre requisites

A Linux based machine that has a Bluetooth HCI interface

64bit Raspberry Pi  a Raspberry Pi 3B+

a SD card at least 16GB to install debain  12 OS

OS Architecture: Arm64

Matter uses Thread, Wi-Fi and Ethernet as networking technologies and use BLE for pairing.

Because Bluetooth LE (BLE) is used for commissioning on Matter, make sure BLE is up and running on Raspberry Pi. 

 

This diagram explains how devices will communicate across the different protocols supported by Matter. Image: Thread Group

Matter works over Wi-Fi, ethernet, and Thread.Thread_Matter.webp

Let me walk through what a simple setup process of a Matter device with Wi-Fi will look like.

Turn on the Matter device
Connect the mobile phone to the home Wi-Fi network and turn on Bluetooth
Scan the QR code on the Matter device
The phone will send the device credentials over to the Matter server on the same network
The matter device will connect with the Matter server
 

 

A Matter controller

To add and control Matter devices, you need a Matter controller. Unlike proprietary hubs and bridges from companies such as Philips Hue and Lutron Caseta, Matter controllers are not brand-specific. As long as it’s a Matter controller, it can control a Matter device — no matter who made it. (It doesn’t get old) 

Matter Controller-1.png

Many different types of devices can be Matter controllers: smart speakers, voice assistants, apps, or hubs with apps. Its primary role is to manage communications, control, automations, and remote access (when enabled). Because of this, your Matter controller is ideally a device that is always in your home, always powered, and has a direct connection to your home network. 

 

Matter controllers are built into the latest versions of Android and Apple’s operating systems, and all the flagship smart speakers and devices will become Matter controllers: including the Apple HomePod Mini, Apple TV 4K, Amazon Echo and Google Nest Hub speakers and displays, and Samsung SmartThings hubs. 

 

It’s worth noting that Matter controllers aren’t necessarily Matter devices. You probably won’t be able to control an Amazon Echo Show with your Google Nest Hub Max or a Samsung Family Hub fridge with your Apple TV. 

 

you need to run the Matter Server

This is a fork of the Matter Server add-on for Home Assistant designed to be run standalone in a container for HA Container and HA Core. It runs and is able to be connected to Home Assistant via the Matter integration.

 

matter  server  hosts a WebSocket  at port 5580(/ws). This Host  can be used to stream information from a Home Assistant instance to any client that implements WebSockets. 

This Matter Server application provides the connection between your Matter network (called Fabric in technical terms) and Home Assistant.

The Home Assistant Matter integration connects to this Matter server via a websocket connection.

The matching Home Assistant Matter integration communicates via WebSocket with this Matter server.

You need to run the Matter Server before you can use the integration.

 

 

you need to  enable Bluetooth the Matter Server

Needed for Bluetooth via dbus.

security_opt:
      # Needed for Bluetooth via dbus
      - apparmor:unconfined

 

version: "3.8"
services:
  # python-matter-server
  matter-server:
    image: ghcr.io/home-assistant-libs/python-matter-server:stable
    container_name: matter-server
    restart: unless-stopped
    # Required for mDNS to work correctly
    network_mode: host
    security_opt:
      # Needed for Bluetooth via dbus
      - apparmor:unconfined
    volumes:
      # Create an .env file that sets the USERDIR environment variable.
      - ${USERDIR:-$HOME}/docker/matter-server/data:/data/
      - /run/dbus:/run/dbus:ro

http://localhost:4999/boards/topic/21954/how-to-use-mdns-within-docker-container#29787

you need to  enable ipv6 the Matter Server

Matter (formerly known as Connected Home over IP or CHIP) is an IPv6 based smart home standard. This provides a Matter Controller which allows you to commission and control of Matter devices.

Homeassistant needs to have an ipv6 adress for matter to function.

After enabling ipv6 in the hassio network settings it started to work as expected.

And the homekit device must be added to hassio by the owner of the homekit home and not by a user.

ha-matter-1.png

修改 Docker 配置,开启容器的 IPv6 功能

http://localhost:4999/boards/topic/21960/00#29792

 

Installation Methods-Install Matter Server 

Part 2 - Install Matter Server using pip

https://blog.matterxiaomi.com/blog/Matter-Home-Assistant-part2/

https://blog.matterxiaomi.com/blog/Matter-Home-Assistant-part1/

 

 

Install Matter Server using pip3

https://pypi.org/project/python-matter-server/

 

Part 2 - Install Matter Server using docker image

https://www.matterxiaomi.com/boards/topic/15701/install-matter-server-using-docker-image

https://blog.matterxiaomi.com/blog/matter-home-assistant-part5/

 

Part 3 - Install Matter Server using docker image via docker compose

https://blog.matterxiaomi.com/blog/Matter-Home-Assistant-part3/

 

Part 4 - Install Matter Server using add-on

 

 

 

 

Troubleshooting

 

 

ERROR MDNS

为树莓派配置mDNS服务 Avahi

http://localhost:4999/boards/topic/21933/

 

Required for mDNS to Docker work correctly

http://localhost:4999/boards/topic/21954/how-to-use-mdns-within-docker-container#29787

 

Matter update history in Home Assistant Core

2022.05.29

Matter in Home Assistant workshop announcement

https://www.home-assistant.io/blog/2022/05/29/matter-in-home-assistant-workshop-announcement/

Before you begin the setup process, have everything you need ready. This includes a Home Assistant system, Matter hub, and Matter devices.

 

Most Matter-compatible devices will not hit the market until 2023 and for many devices, the move to Matter won’t be a simple firmware upgrade, rather people will need to buy new devices.

 

December 7, 2022

we release the first iteration of the Matter integration for Home Assistant Core 2022.12.

Matter integration for Home Assistant Core

https://www.home-assistant.io/integrations/matter

 

 

 

 

Useful links

https://community.home-assistant.io/t/aqara-m2-cn-gateway-matter-support/559344/5

 

Home Assistant Add-on: Matter Server - GitHub

https://github.com/home-assistant/addons/blob/master/matter_server/DOCS.md

 

 

Here are some links for more informations:
-official Thread webside 
-official Matter website 
-Chip/Matter on github 
-Thread on github 
-Thread firmware for TexasInstruments ZigbeeSticks like CC2652 
-General infos about an openThread border router 
-How to set up a border router

 

 



Comments


Comments are closed