Skip to content

Commit

Permalink
Merge pull request #43 from Luligu/dev
Browse files Browse the repository at this point in the history
Release 1.2.22
  • Loading branch information
Luligu committed Jun 6, 2024
2 parents 609c1fb + ecc36b1 commit 5782176
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-buildx-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
--platform linux/amd64,linux/arm64,linux/arm/v7 \
-f docker/Dockerfile.main \
-t luligu/matterbridge:latest \
-t luligu/matterbridge:1.2.21 \
-t luligu/matterbridge:1.2.22 \
--push .
docker manifest inspect luligu/matterbridge:latest
timeout-minutes: 60
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file.

## [1.2.22] - 2024-06-04

### Changed
- [matterbridge]: Updated dependencies
- [matterbridge]: Default config and schema for the new plugin matterbridge-shelly

<a href="https://www.buymeacoffee.com/luligugithub">
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
</a>

## [1.2.21] - 2024-06-04

### Changed
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ docker logs --tail 1000 -f matterbridge

## Session XYZ does not exist
This message may appear after Matterbridge restarts, indicating that the controller is still using a session from the previous connection that has since been closed.
After some time, it will reconnect.
After some time, the controller will reconnect.
In this context, the message is not indicative of a problem.

## Apple Home issues
Expand All @@ -494,9 +494,10 @@ Solved with the version 17.5 of the HomePod/AppleTV.

## Home Assistant issues (Matter Server for HA is still in Beta)

- if HA doesn't show all devices just reload the HA Matter Server or reboot HA
- it doesn't seem that HA reacts to removing a device from the aggregator: they remain like unavailable...
- in the Home Assistant Core log you can see sometimes error messages relating to unique id not found but it seems to be an issue related to missing some matter packet during the commissioning and subscription phase...
- If HA doesn't show all devices just reload the HA Matter Server or reboot HA
- Home Assistant doesn't seem to react when a device is removed from the bridge: they remain like unavailable forever...
- In the Home Assistant Core log you can see sometimes error messages relating to unique id not found but it seems to be an issue related to missing some matter packet during the commissioning and subscription phase...
- Version 6.1.0 is more stable and has solved the problem of the commissioning window: now pairing is again easy. Use Apple Home when you have to choose the controller type even if you pair Matterbridge directly with HA.

## Google Home

Expand Down Expand Up @@ -535,6 +536,7 @@ We believe in a welcoming and respectful community for all. Please make sure to
## Support

If you find this project helpful and you wish to support the ongoing development, you can do so by buying me a coffee.
On my side I sponsor the packages that I use in this project. It would be nice to have sponsors too.
Click on the badge below to get started:

<a href="https://www.buymeacoffee.com/luligugithub">
Expand Down
22 changes: 12 additions & 10 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matterbridge",
"version": "1.2.21",
"version": "1.2.22",
"description": "Matterbridge plugin manager for Matter",
"author": "https://github.com/Luligu",
"license": "Apache-2.0",
Expand Down Expand Up @@ -81,13 +81,13 @@
"devDependencies": {
"@tsconfig/node-lts": "^20.1.3",
"@types/express": "^4.17.21",
"@types/node": "^20.14.0",
"@types/node": "^20.14.2",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.3.0",
"prettier": "^3.3.1",
"typescript": "^5.4.5"
},
"dependencies": {
Expand Down
38 changes: 26 additions & 12 deletions src/defaultConfigSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,17 @@ export const somfytahoma_schema: PlatformSchema = {
};

export const shelly_config: PlatformConfig = {
blackList: [],
whiteList: [],
name: 'matterbridge-shelly',
type: 'DynamicPlatform',
unregisterOnShutdown: false,
blackList: [],
whiteList: [],
deviceIp: {},
enableMdnsDiscover: true,
enableStorageDiscover: true,
enableConfigDiscover: true,
resetStorageDiscover: false,
enableConfigDiscover: false,
debug: false,
unregisterOnShutdown: false,
};

export const shelly_schema: PlatformSchema = {
Expand All @@ -248,46 +250,58 @@ export const shelly_schema: PlatformSchema = {
type: 'string',
readOnly: true,
},
username: {
description: 'Username (always admin for gen 2 and 3 devices so use admin also for gen 1)',
type: 'string',
},
password: {
description: 'Password (must be unique for all the devices)',
type: 'string',
},
blackList: {
description: 'The devices in the list will not be exposed.',
description: 'The devices in the list will not be exposed. Use the device id (e.g. shellyplus2pm-5443b23d81f8)',
type: 'array',
items: {
type: 'string',
},
},
whiteList: {
description: 'Only the devices in the list will be exposed.',
description: 'Only the devices in the list will be exposed. Use the device id (e.g. shellyplus2pm-5443b23d81f8)',
type: 'array',
items: {
type: 'string',
},
},
deviceIp: {
description: 'Set the IP address for each device. Enter in the first field the shelly ID of the device and in the second field the IP address.',
description: 'Set the IP address for each device. Enter in the first field the shelly ID of the device and in the second field the IP address. (e.g. shelly1minig3-543204547478: 192.168.1.221)',
type: 'object',
additionalProperties: {
type: 'string',
},
},
enableMdnsDiscover: {
description: 'Enable mdns discovery for shelly devices (it will stop after 10 minutes)',
description: 'Enable the mdns discovery for shelly devices (it will stop after 10 minutes)',
type: 'boolean',
},
enableStorageDiscover: {
description: 'Enable storage discovery for shelly devices (it will load from the storage the devices already registered)',
description: 'Enable storage discovery for shelly devices (it will load from the storage the devices already discovered)',
type: 'boolean',
},
resetStorageDiscover: {
description: 'Reset the storage discovery on the next restart (it will clear the storage of already discovers devices)',
type: 'boolean',
},
enableConfigDiscover: {
description: 'Enable config discovery for shelly devices (it will load the devices from deviceIp)',
description: 'Enable config discovery for shelly devices (it will load the devices from deviceIp config setting)',
type: 'boolean',
},
enableBleDiscover: {
description: 'Enable ble discovery for shelly devices (under development)',
type: 'boolean',
readOnly: true,
},
debugDiscover: {
description: 'Enable the debug for the discovery (development only)',
debug: {
description: 'Enable the debug for the plugin (development only)',
type: 'boolean',
},
unregisterOnShutdown: {
Expand Down
46 changes: 37 additions & 9 deletions src/matterbridgeV8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,25 @@ import { Format, Level, Logger, createFileLogger } from '@project-chip/matter-no
import { StorageContext, StorageManager } from '@project-chip/matter-node.js/storage';
import { Environment, StorageService } from '@project-chip/matter.js/environment';
import { ServerNode } from '@project-chip/matter.js/node';
import { OnOffLightDevice } from '@project-chip/matter.js/devices/OnOffLightDevice';
import { Endpoint, EndpointServer } from '@project-chip/matter.js/endpoint';
import { DeviceTypes, logEndpoint } from '@project-chip/matter-node.js/device';
import { QrCode } from '@project-chip/matter-node.js/schema';
import { FabricAction } from '@project-chip/matter-node.js/fabric';
import { Endpoint, EndpointServer } from '@project-chip/matter.js/endpoint';

import { AggregatorEndpoint } from '@project-chip/matter.js/endpoints/AggregatorEndpoint';
import { BridgedNodeEndpoint } from '@project-chip/matter.js/endpoints/BridgedNodeEndpoint';
import { BridgedDeviceBasicInformationServer } from '@project-chip/matter.js/behavior/definitions/bridged-device-basic-information';

import { IdentifyServer } from '@project-chip/matter.js/behavior/definitions/identify';
import { OnOffServer } from '@project-chip/matter.js/behavior/definitions/on-off';
import { GroupsServer } from '@project-chip/matter.js/behavior/definitions/groups';
import { ScenesServer } from '@project-chip/matter.js/behavior/definitions/scenes';
import { BridgedDeviceBasicInformationServer } from '@project-chip/matter.js/behavior/definitions/bridged-device-basic-information';

import { ColorDimmerSwitchDevice } from '@project-chip/matter.js/devices/ColorDimmerSwitchDevice';
import { OnOffLightDevice, OnOffLightRequirements } from '@project-chip/matter.js/devices/OnOffLightDevice';

import { MutableEndpoint } from '@project-chip/matter.js/endpoint/type';
import { SupportedBehaviors } from '@project-chip/matter.js/endpoint/properties';

import { AnsiLogger, BRIGHT, RESET, TimestampFormat, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, stringify, er, nf, rs, wr, RED, GREEN, zb, CYAN } from 'node-ansi-logger';

Expand Down Expand Up @@ -264,7 +273,6 @@ export class MatterbridgeV8 extends EventEmitter {
reachable: true,
},
});
console.log('lightEndpoint', lightEndpoint);

/**
* Register state change handlers and events of the node for identify and onoff states to react to the commands.
Expand All @@ -277,8 +285,29 @@ export class MatterbridgeV8 extends EventEmitter {

lightEndpoint.events.onOff.onOff$Changed.on((value) => log.notice(`OnOff is now ${value ? 'ON' : 'OFF'}`));

const switchEndpoint = new Endpoint(ColorDimmerSwitchDevice.with(BridgedDeviceBasicInformationServer, OnOffServer), {
const OnOffSwitchDeviceDefinition = MutableEndpoint({
name: 'OnOffSwitch',
deviceType: 0x103,
deviceRevision: 2,
requirements: {
server: {
mandatory: {},
optional: {},
},
client: {
optional: {},
mandatory: {},
},
},
behaviors: SupportedBehaviors(IdentifyServer, GroupsServer, ScenesServer, OnOffServer, BridgedDeviceBasicInformationServer),
});
console.log('OnOffSwitchDeviceDefinition\n', OnOffSwitchDeviceDefinition);

const switchEndpoint = new Endpoint(OnOffSwitchDeviceDefinition, {
id: 'OnOffSwitch',
onOff: {
onOff: false,
},
bridgedDeviceBasicInformation: {
vendorId: VendorId(await this.matterStorageContext.get<number>('vendorId')),
vendorName: await this.matterStorageContext.get<string>('vendorName'),
Expand All @@ -293,8 +322,6 @@ export class MatterbridgeV8 extends EventEmitter {
},
});

console.log('switchEndpoint', switchEndpoint);

// await this.matterServerNode.add(endpoint);
// const mbV8 = new MatterbridgeDeviceV8(DeviceTypes.OnOffLight);
// const endpoint = mbV8.getBridgedNodeEndpointV8();
Expand Down Expand Up @@ -365,8 +392,9 @@ export class MatterbridgeV8 extends EventEmitter {
});

await this.matterServerNode.bringOnline();
console.log('lightEndpoint', lightEndpoint);
console.log('switchEndpoint', switchEndpoint);

console.log('lightEndpoint\n', lightEndpoint);
console.log('switchEndpoint\n', switchEndpoint);
}

showServerNodeQR() {
Expand Down

0 comments on commit 5782176

Please sign in to comment.