diff --git a/.github/workflows/pull-request-lint.yaml b/.github/workflows/pull-request-lint.yaml index 4534ba4..b29f909 100644 --- a/.github/workflows/pull-request-lint.yaml +++ b/.github/workflows/pull-request-lint.yaml @@ -14,7 +14,7 @@ on: jobs: validate: - name: Validate PR title + name: ✏️ Validate PR title runs-on: ubuntu-latest permissions: pull-requests: write diff --git a/.gitignore b/.gitignore index 1fe1b00..7a3a383 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ +# OS +.DS_Store + +# IDE .idea/ + +# Dependencies node_modules/ diff --git a/README.md b/README.md index d6d482c..4803f9b 100644 --- a/README.md +++ b/README.md @@ -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.
-# 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) --- diff --git a/docs/hass-add-repo.png b/docs/hass-add-repo.png new file mode 100644 index 0000000..cac9936 Binary files /dev/null and b/docs/hass-add-repo.png differ diff --git a/docs/hass-addon-store-with-repo.png b/docs/hass-addon-store-with-repo.png new file mode 100644 index 0000000..ff0eac6 Binary files /dev/null and b/docs/hass-addon-store-with-repo.png differ diff --git a/docs/hass-addon-store.png b/docs/hass-addon-store.png new file mode 100644 index 0000000..e2b034e Binary files /dev/null and b/docs/hass-addon-store.png differ diff --git a/docs/hass-matterbridge-addon.png b/docs/hass-matterbridge-addon.png new file mode 100644 index 0000000..58c4607 Binary files /dev/null and b/docs/hass-matterbridge-addon.png differ diff --git a/docs/hass-matterbridge-configuration.png b/docs/hass-matterbridge-configuration.png new file mode 100644 index 0000000..07aa0e2 Binary files /dev/null and b/docs/hass-matterbridge-configuration.png differ diff --git a/docs/hass-settings.png b/docs/hass-settings.png new file mode 100644 index 0000000..9b1fae1 Binary files /dev/null and b/docs/hass-settings.png differ diff --git a/matterbridge/config.yaml b/matterbridge/config.yaml index 52356a5..ca0cd11 100644 --- a/matterbridge/config.yaml +++ b/matterbridge/config.yaml @@ -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? diff --git a/matterbridge/run.sh b/matterbridge/run.sh index 2e108e2..be36c31 100644 --- a/matterbridge/run.sh +++ b/matterbridge/run.sh @@ -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 diff --git a/matterbridge/translations/en.yaml b/matterbridge/translations/en.yaml new file mode 100644 index 0000000..4fd467e --- /dev/null +++ b/matterbridge/translations/en.yaml @@ -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.