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

Commit

Permalink
fix: removed npm provenance and added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
t0bst4r committed Jun 2, 2024
1 parent 88bb0d6 commit 30d4f3c
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const project = new typescript.TypeScriptProject({
],

releaseToNpm: true,
npmProvenance: false,

tsconfig: {
compilerOptions: {
Expand Down
58 changes: 56 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,63 @@

---

The Matterbridge Home Assistant package provides bindings to connect [HomeAssistant](https://www.npmjs.com/package/home-assistant-js-websocket) to [Matterbridge](https://github.com/Luligu/matterbridge/).
This **Matterbridge Home Assistant** package provides bindings to connect [HomeAssistant](https://www.npmjs.com/package/home-assistant-js-websocket) to [Matterbridge](https://github.com/Luligu/matterbridge/).

Currently supported entities:
## Installation
- Follow [those instructions](https://github.com/Luligu/matterbridge/?tab=readme-ov-file#installation) to setup `matterbridge`.
- Run `matterbridge -add matterbridge-home-assistant`
- Make the plugin is configured properly using environment variables.
- Start matterbridge using `matterbridge -bridge`

## Configuration
This package can be configured using environment variables.

- `HOME_ASSISTANT_URL` - the home assistant url (e.g. `http://192.168.178.23:8123`)
- `HOME_ASSISTANT_ACCSESS_TOKEN` - a long living access token created in Home Assistant
- `HOME_ASSISTANT_CLIENT_CONFIG` - a json string containing the client config (see below)

### Client Config
The client config has to be a json string and can have the following properties:
```typescript
interface HomeAssistantClientConfig {
/**
* The domains to include.
* If set, ALL entities must match one of those domains - even those configured in `includePatterns`
* @example [ "light", "media_player" ]
*/
includeDomains?: Array<string>;
/**
* Glob-Patterns to include entities.
* If set, ALL entities must match at least one pattern - even those configured in `includeDomains`
* @example [ "light.*", "media_player.*_tv_*" ]
*/
includePatterns?: Array<string>;
/**
* The domains to exclude.
* If set, entities must not match any of those domains.
* Exclusions are always winning against inclusions.
* @example [ "media_player" ]
*/
excludeDomains?: Array<string>;
/**
* Glob-Patterns to exclude entities.
* If set, entities must not match at any of those patterns.
* Exclusions are always winning against inclusions.
* @example [ "media_player.*echo*" ]
*/
excludePatterns?: Array<string>;
}
```

### Example Configuration
```
HOME_ASSISTANT_URL=http://192.168.178.23:8123
HOME_ASSISTANT_ACCSESS_TOKEN=ey....yQ
HOME_ASSISTANT_CLIENT_CONFIG={ "includeDomains": ["light", "media_player"], "excludePatterns": ["media_player.*echo*"] }
```

## Supported Entities
- Light entities (`light.`) including on-off, brightness and hue & saturation control
- Switch entities (`switch.`) including on-off control
- Media Players (`media_player.`) are mapped to Switches and currently only support on-off control

3 changes: 0 additions & 3 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/home-assistant/home-assistant-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface HomeAssistantClientConfig {

export class HomeAssistantClient {
public static async create(url: string, accessToken: string, config?: HomeAssistantClientConfig): Promise<HomeAssistantClient> {
url = url.replace(/\/$/, '');
const auth = createLongLivedTokenAuth(url, accessToken);
const connection = await createConnection({ auth });
return new HomeAssistantClient(connection, config ?? {});
Expand Down

0 comments on commit 30d4f3c

Please sign in to comment.