Skip to content

Commit

Permalink
Add matter server discovery (home-assistant#2746)
Browse files Browse the repository at this point in the history
* Add matter server discovery

* Update changelog

* Fix discovery script location

* Rename discovery script
  • Loading branch information
MartinHjelmare authored Nov 22, 2022
1 parent 6256222 commit c8baf75
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
10 changes: 9 additions & 1 deletion matter_server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# Changelog

## 0.4.0

- Add add-on discovery

## 0.3.0

- Bump to CHIP version 989ad8e (2022-09-16 16:52 -0500) (start of the v1 branch!)
- Bump Matter Server to 0.3.0

## 0.2.2

- Bump to CHIP version 5b603f3874 (2022-07-05 21:21:19 -0700)
- Bump Matter Server to 0.2.3
- Avoid cloning not required git repositories during build speedup build process

## 0.2.2
## 0.2.1

- Bump Matter Server to 0.2.2

## 0.2.0
Expand All @@ -22,6 +29,7 @@
- Bump Matter Server to first official release 0.1.0

## 0.1.1

- Fix Matter Server start location so it can find device certificates
- Bump Matter Server to git version ac5545b (2022-06-11 00:04:34 +0200)

Expand Down
4 changes: 3 additions & 1 deletion matter_server/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 0.3.0
version: 0.4.0
slug: matter_server
name: Matter Server
description: Matter WebSocket Server for Home Assistant Matter support.
Expand All @@ -8,6 +8,8 @@ url: >-
arch:
- aarch64
- amd64
discovery:
- matter
hassio_api: true
# IPC is only used within the Add-on
host_ipc: false
Expand Down
3 changes: 3 additions & 0 deletions matter_server/rootfs/etc/s6-overlay/s6-rc.d/matter-server/run
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ fi

export CHIP_WS_SERVER_PORT="${chip_ws_server_port:-5580}"

# Send out discovery information to Home Assistant
/etc/s6-overlay/scripts/matter-server-discovery &

cd /root

exec matter-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Send matter discovery information to Home Assistant
# ==============================================================================
declare ha_config

# Prepare discovery payload
ha_config=$(\
bashio::var.json \
host "$(hostname)" \
port "^5580" \
)

if bashio::discovery "matter" "${ha_config}" > /dev/null; then
bashio::log.info "Successfully send discovery information to Home Assistant."
else
bashio::log.error "Discovery message to Home Assistant failed!"
fi

0 comments on commit c8baf75

Please sign in to comment.