Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
feat!: optimized add on configuration (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
t0bst4r authored Jun 8, 2024
1 parent 90021af commit 550e8f0
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
validate:
name: Validate PR title
name: ✏️ Validate PR title
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# OS
.DS_Store

# IDE
.idea/

# Dependencies
node_modules/
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
# Matterbridge Home Assistant Addon

This AddOn for home assistant populates all entities of the home assistant instance as a Matter-bridge.
This Home Assistant Add-On populates entities of the home assistant instance as a Matter-bridge.

# Installation

## Home Assistant AddOn
Open Home Assistant and navigate to the addon settings.
![Home Assistant Settings](docs/hass-settings.png)

You can add this repository to your home assistant as a new plugin source.
Open up the Add-On store and open the "Repositories" menu in the top-right corner.
![!Home Assistant Add-On Store](docs/hass-addon-store.png)

Home assistant should find the plugin afterward, and you can install and configure it as you like.
Enter the URL of the GitHub Repo to the list of your add-on repositories (`https://github.com/t0bst4r/matterbridge-home-assistant-addon`).
![Home Assistant Add Repository](docs/hass-add-repo.png)

## Configuration
After the repository is added, refresh your Add-On Store page and find the Add-On in your list of Add-Ons.
![Home Assistant Add-On Store with the new Add-On](docs/hass-addon-store-with-repo.png)

This addon needs to be configured using the following configuration option:
Open the Add-On page and click "install".
![Home Assistant Matterbridge Add-On](docs/hass-matterbridge-addon.png)

- **HOME_ASSISTANT_CLIENT_CONFIG**: JSON-string of the include/exclude configuration (see [the documentation](https://github.com/t0bst4r/matterbridge-home-assistant?tab=readme-ov-file#configuration))
**Before starting the plugin** open the configuration tab and enter your configuration.<br />

# Contributors
![Home Assistant Matterbridge Add-On Configuration](docs/hass-matterbridge-configuration.png)

- [t0bst4r](https://github.com/t0bst4r)
- [genehand](https://github.com/genehand)
# Contributors
[![Contributors](https://contrib.rocks/image?repo=t0bst4r/matterbridge-home-assistant-addon)](https://github.com/t0bst4r/matterbridge-home-assistant-addon/graphs/contributors)

---

Expand Down
Binary file added docs/hass-add-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hass-addon-store-with-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hass-addon-store.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hass-matterbridge-addon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hass-matterbridge-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/hass-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 30 additions & 9 deletions matterbridge/config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
---
# General Info
version: 0.0.7
slug: matterbridge
name: Matterbridge
description: Populate your Home Assistant instance as Matter Bridge
slug: matterbridge
version: 0.0.7
image: ghcr.io/t0bst4r/matterbridge-home-assistant-addon/{arch}
options:
home_assistant_client_config: '{}'
schema:
home_assistant_client_config: str
url: https://github.com/t0bst4r/matterbridge-home-assistant-addon

# Requirements
homeassistant: 2024.1.0

# Permissions
homeassistant_api: true
host_network: true
webui: http://[HOST]:[PORT:8283]/

# Architecture & Image Options
# image: ghcr.io/t0bst4r/matterbridge-home-assistant-addon/{arch}
init: false
arch:
- aarch64
- amd64
- armv7
- aarch64
webui: http://[HOST]:[PORT:8283]/
map:
- addon_config:rw

# Options & Schema
options:
include_domains: [ ]
include_patterns: [ ]
exclude_domains: [ ]
exclude_patterns: [ ]
schema:
include_domains:
- str?
include_patterns:
- str?
exclude_domains:
- str?
exclude_patterns:
- str?
19 changes: 18 additions & 1 deletion matterbridge/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@

HOME_ASSISTANT_URL=http://supervisor/core
HOME_ASSISTANT_ACCESS_TOKEN=$SUPERVISOR_TOKEN
HOME_ASSISTANT_CLIENT_CONFIG=$(bashio::config 'home_assistant_client_config')

CONFIG_INCLUDE_DOMAINS=$(bashio::config 'include_domains' | jq --raw-input --compact-output --slurp 'split("\n")')
CONFIG_INCLUDE_PATTERNS=$(bashio::config 'include_patterns' | jq --raw-input --compact-output --slurp 'split("\n")')
CONFIG_EXCLUDE_DOMAINS=$(bashio::config 'exclude_domains' | jq --raw-input --compact-output --slurp 'split("\n")')
CONFIG_EXCLUDE_PATTERNS=$(bashio::config 'exclude_patterns' | jq --raw-input --compact-output --slurp 'split("\n")')

HOME_ASSISTANT_CLIENT_CONFIG=$(jq --null-input --compact-output \
--argjson includeDomains "$CONFIG_INCLUDE_DOMAINS" \
--argjson includePatterns "$CONFIG_INCLUDE_PATTERNS" \
--argjson excludeDomains "$CONFIG_EXCLUDE_DOMAINS" \
--argjson excludePatterns "$CONFIG_EXCLUDE_PATTERNS" \
'{ "includeDomains": $includeDomains, "includePatterns": $includePatterns, "excludeDomains": $excludeDomains, "excludePatterns": $excludePatterns }'
)

echo "#############################"
echo "CURRENT CLIENT CONFIGURATION:"
echo "$HOME_ASSISTANT_CLIENT_CONFIG" | jq
echo "#############################"

export HOME_ASSISTANT_URL
export HOME_ASSISTANT_ACCESS_TOKEN
Expand Down
24 changes: 24 additions & 0 deletions matterbridge/translations/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
configuration:
include_domains:
name: Include Domains
description: |
List of domains to include (e.g. light, switch, media_player).
If empty, all domains are included.
include_patterns:
name: Include Patterns
description: |
List of glob patterns to include entities (e.g. light.kitchen*).
If empty, all entities are included.
exclude_domains:
name: Exclude Domains
description: |
List of domains to exclude (e.g. light, switch, media_player).
Even included entities need to NOT match this domains.
If empty, no domain is excluded.
exclude_patterns:
name: Exclude Patterns
description: |
List of glob patterns to exclude entities (e.g. media_player.*echo*).
Even included entities need to NOT match this patterns.
If empty, no entity is excluded.

0 comments on commit 550e8f0

Please sign in to comment.