Skip to content

Commit

Permalink
Merge pull request #74 from Luligu/dev
Browse files Browse the repository at this point in the history
Release 1.3.9
  • Loading branch information
Luligu committed Jul 2, 2024
2 parents 8651e7e + c43fef6 commit 328e73e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 3,050 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.3.8 \
-t luligu/matterbridge:1.3.9 \
--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 @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge and sponsoring it.

## [1.3.9] - 2024-07-02

### Fixed
- [matterbridge]: Fixed nodeLabel in childbridge mode
- [matterbridge]: Fixed MeasurementClusters

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

## [1.3.8] - 2024-07-01

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matterbridge",
"version": "1.3.8",
"version": "1.3.9",
"description": "Matterbridge plugin manager for Matter",
"author": "https://github.com/Luligu",
"license": "Apache-2.0",
Expand Down
8 changes: 4 additions & 4 deletions src/cluster/ElectricalPowerMeasurementCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.19
*/
neutralCurrent: OptionalAttribute(0x12, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
neutralCurrent: OptionalAttribute(0x12, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),
},
});

Expand Down Expand Up @@ -649,7 +649,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.5
*/
voltage: OptionalAttribute(0x4, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
voltage: OptionalAttribute(0x4, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),

/**
* This shall indicate the most recent ActiveCurrent reading in milliamps (mA).
Expand All @@ -670,7 +670,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.6
*/
activeCurrent: OptionalAttribute(0x5, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
activeCurrent: OptionalAttribute(0x5, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),

/**
* This shall indicate the most recent ActivePower reading in milliwatts (mW). If the power cannot be
Expand All @@ -692,7 +692,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.9
*/
activePower: Attribute(0x8, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
activePower: Attribute(0x8, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),
},

events: {
Expand Down
20 changes: 16 additions & 4 deletions src/matterbridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ export class Matterbridge extends EventEmitter {

private mdnsInterface: string | undefined; // matter server mdnsInterface: 'eth0' or 'wlan0' or 'WiFi'
private port = 5540; // first commissioning server port
private passcode?: number; // first commissioning server passcode
private discriminator?: number; // first commissioning server discriminator
private log!: AnsiLogger;
private hasCleanupStarted = false;
// private plugins = new Map<string, RegisteredPlugin>();
Expand Down Expand Up @@ -395,6 +397,10 @@ export class Matterbridge extends EventEmitter {

// Set the first port to use for the commissioning server
this.port = getIntParameter('port') ?? 5540;
// Set the first passcode to use for the commissioning server
this.passcode = getIntParameter('passcode');
// Set the first discriminator to use for the commissioning server
this.discriminator = getIntParameter('discriminator');

// Set the restart mode
if (hasParameter('service')) this.restartMode = 'service';
Expand Down Expand Up @@ -1147,7 +1153,8 @@ export class Matterbridge extends EventEmitter {
if (!plugin.locked) {
plugin.locked = true;
this.log.debug(`Creating commissioning server context for ${plg}${plugin.name}${db}`);
plugin.storageContext = await this.createCommissioningServerContext(plugin.name, 'Matterbridge', DeviceTypes.AGGREGATOR.code, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Dynamic Platform');
// plugin.storageContext = await this.createCommissioningServerContext(plugin.name, 'Matterbridge', DeviceTypes.AGGREGATOR.code, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Dynamic Platform');
plugin.storageContext = await this.createCommissioningServerContext(plugin.name, 'Matterbridge', DeviceTypes.AGGREGATOR.code, 0xfff1, 'Matterbridge', 0x8000, plugin.description);
this.log.debug(`Creating commissioning server for ${plg}${plugin.name}${db}`);
plugin.commissioningServer = await this.createCommisioningServer(plugin.storageContext, plugin.name);
this.log.debug(`Creating aggregator for plugin ${plg}${plugin.name}${db}`);
Expand Down Expand Up @@ -1986,6 +1993,7 @@ export class Matterbridge extends EventEmitter {
this.log.error('importCommissioningServerContext error: no storage manager initialized');
process.exit(1);
}

this.log.debug(`Importing commissioning server storage context for ${plg}${pluginName}${db}`);
const storageContext = this.storageManager.createContext(pluginName);
await storageContext.set('deviceName', basic.getNodeLabelAttribute());
Expand Down Expand Up @@ -2233,16 +2241,17 @@ export class Matterbridge extends EventEmitter {
const hardwareVersion = await context.get<number>('hardwareVersion', 1);
const hardwareVersionString = await context.get<string>('hardwareVersionString', '1.0.0');

this.log.debug(`Creating matter commissioning server for plugin ${plg}${pluginName}${db} with deviceName ${deviceName} deviceType ${deviceType}(0x${deviceType.toString(16).padStart(4, '0')})`);
this.log.debug(`Creating matter commissioning server for plugin ${plg}${pluginName}${db} with deviceName '${deviceName}' deviceType ${deviceType}(0x${deviceType.toString(16).padStart(4, '0')})`);
this.log.debug(`Creating matter commissioning server for plugin ${plg}${pluginName}${db} with uniqueId ${uniqueId} serialNumber ${serialNumber}`);
this.log.debug(`Creating matter commissioning server for plugin ${plg}${pluginName}${db} with softwareVersion ${softwareVersion} softwareVersionString ${softwareVersionString}`);
this.log.debug(`Creating matter commissioning server for plugin ${plg}${pluginName}${db} with hardwareVersion ${hardwareVersion} hardwareVersionString ${hardwareVersionString}`);
this.log.debug(`Creating matter commissioning server for plugin ${plg}${pluginName}${db} with nodeLabel '${productName}' port ${this.port} passcode ${this.passcode} discriminator ${this.discriminator}`);
const commissioningServer = new CommissioningServer({
port: this.port++,
// listeningAddressIpv4
// listeningAddressIpv6
passcode: undefined,
discriminator: undefined,
passcode: this.passcode,
discriminator: this.discriminator,
deviceName,
deviceType,
basicInformation: {
Expand Down Expand Up @@ -2341,6 +2350,9 @@ export class Matterbridge extends EventEmitter {
}
},
});
if (this.passcode !== undefined) this.passcode++;
if (this.discriminator !== undefined) this.discriminator++;

commissioningServer.addCommandHandler('testEventTrigger', async ({ request: { enableKey, eventTrigger } }) => this.log.info(`testEventTrigger called on GeneralDiagnostic cluster: ${enableKey} ${eventTrigger}`));
return commissioningServer;
}
Expand Down
Loading

0 comments on commit 328e73e

Please sign in to comment.