Skip to content

Commit

Permalink
Fixed ElectricalEnergyMeasurement and ElectricalPowerMeasurement
Browse files Browse the repository at this point in the history
  • Loading branch information
Luligu committed Jun 28, 2024
1 parent c10581e commit 7d8276c
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 44 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.5 \
-t luligu/matterbridge:1.3.6 \
--push .
docker manifest inspect luligu/matterbridge:latest
timeout-minutes: 60
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ 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.6] - 2024-06-28

### Fixed

- [matterbridge]: Fixed exports
- [matterbridgeDevice]: Fixed ElectricalEnergyMeasurement and ElectricalPowerMeasurement

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

## [1.3.5] - 2024-06-26

### Added
Expand Down
26 changes: 24 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matterbridge",
"version": "1.3.5",
"version": "1.3.6",
"description": "Matterbridge plugin manager for Matter",
"author": "https://github.com/Luligu",
"license": "Apache-2.0",
Expand Down Expand Up @@ -39,13 +39,35 @@
],
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.js",
"types": "dist/index.d.ts",
"bin": {
"matterbridge": "dist/cli.js"
},
"engines": {
"node": ">=18.0.0"
},
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./utils/*": {
"import": "./dist/utils/*.js",
"types": "./dist/utils/*.d.ts"
},
"./cluster/*": {
"import": "./dist/cluster/*.js",
"types": "./dist/cluster/*.d.ts"
},
"./log": {
"import": "./dist/log/export.js",
"types": "./dist/log/export.d.ts"
},
"./storage": {
"import": "./dist/storage/export.js",
"types": "./dist/storage/export.d.ts"
}
},
"scripts": {
"build": "tsc",
"watch": "tsc --watch",
Expand Down
2 changes: 1 addition & 1 deletion src/cluster/ElectricalEnergyMeasurementCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export namespace ElectricalEnergyMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.12.5.1.1
*/
energy: TlvField(0, TlvInt64.bound({ min: 0, max: 262 })),
energy: TlvField(0, TlvInt64.bound({ min: 0, max: 2 ** 62 })),

/**
* This field shall indicate the timestamp in UTC of the beginning of the period during which the value of the
Expand Down
20 changes: 10 additions & 10 deletions src/cluster/ElectricalPowerMeasurementCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.5.3.2
*/
measurement: TlvField(1, TlvNullable(TlvInt64.bound({ min: -262, max: 262 }))),
measurement: TlvField(1, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 }))),
});

/**
Expand Down Expand Up @@ -95,15 +95,15 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.5.2.2
*/
min: TlvField(1, TlvInt64.bound({ min: -262, max: 262 })),
min: TlvField(1, TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })),

/**
* This field shall be the largest measured value for the associated measurement over the period between either
* StartTimestamp and EndTimestamp or the period between StartSystime and EndSystime, or both.
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.5.2.3
*/
max: TlvField(2, TlvInt64.bound({ min: -262, max: 262 })),
max: TlvField(2, TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })),

/**
* This field shall be the timestamp in UTC of the beginning of the measurement period.
Expand Down Expand Up @@ -246,7 +246,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.7
*/
reactiveCurrent: OptionalAttribute(0x6, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
reactiveCurrent: OptionalAttribute(0x6, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),

/**
* This shall indicate the most recent ApparentCurrent (square root sum of the squares of active and
Expand All @@ -265,7 +265,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.8
*/
apparentCurrent: OptionalAttribute(0x7, TlvNullable(TlvInt64.bound({ min: 0, max: 262 })), { default: null }),
apparentCurrent: OptionalAttribute(0x7, TlvNullable(TlvInt64.bound({ min: 0, max: 2 ** 62 })), { default: null }),

/**
* This shall indicate the most recent ReactivePower reading in millivolt-amps reactive (mVAR). A positive
Expand All @@ -287,7 +287,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.10
*/
reactivePower: OptionalAttribute(0x9, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
reactivePower: OptionalAttribute(0x9, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),

/**
* This shall indicate the most recent ApparentPower reading in millivolt-amps (mVA).
Expand All @@ -307,7 +307,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.11
*/
apparentPower: OptionalAttribute(0xa, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
apparentPower: OptionalAttribute(0xa, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),

/**
* This shall indicate the most recent RMSVoltage reading in millivolts (mV).
Expand All @@ -325,7 +325,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.12
*/
rmsVoltage: OptionalAttribute(0xb, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
rmsVoltage: OptionalAttribute(0xb, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),

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

/**
* This shall indicate the most recent RMSPower reading in milliwatts (mW).
Expand All @@ -366,7 +366,7 @@ export namespace ElectricalPowerMeasurement {
*
* @see {@link MatterSpecification.v13.Cluster} § 2.13.6.14
*/
rmsPower: OptionalAttribute(0xd, TlvNullable(TlvInt64.bound({ min: -262, max: 262 })), { default: null }),
rmsPower: OptionalAttribute(0xd, TlvNullable(TlvInt64.bound({ min: -(2 ** 62), max: 2 ** 62 })), { default: null }),

/**
* This shall indicate the most recent Frequency reading in millihertz (mHz).
Expand Down
24 changes: 0 additions & 24 deletions src/cluster/export.ts

This file was deleted.

8 changes: 4 additions & 4 deletions src/matterbridgeDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods<typeof Device
measured: true,
minMeasuredValue: 0,
maxMeasuredValue: 0,
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMax: 10, fixedMin: 10, fixedTypical: 0 }],
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMin: 10, fixedMax: 10, fixedTypical: 0 }],
},
cumulativeEnergyImported: { energy },
cumulativeEnergyExported: null,
Expand Down Expand Up @@ -1264,21 +1264,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods<typeof Device
measured: true,
minMeasuredValue: 0,
maxMeasuredValue: 100,
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMax: 10, fixedMin: 10, fixedTypical: 0 }],
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMin: 10, fixedMax: 10, fixedTypical: 0 }],
},
{
measurementType: MeasurementType.ActiveCurrent,
measured: true,
minMeasuredValue: 0,
maxMeasuredValue: 100,
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMax: 10, fixedMin: 10, fixedTypical: 0 }],
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMin: 10, fixedMax: 10, fixedTypical: 0 }],
},
{
measurementType: MeasurementType.ActivePower,
measured: true,
minMeasuredValue: 0,
maxMeasuredValue: 100,
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMax: 10, fixedMin: 10, fixedTypical: 0 }],
accuracyRanges: [{ rangeMin: 0, rangeMax: 2 ** 62, fixedMin: 10, fixedMax: 10, fixedTypical: 0 }],
},
],
voltage: voltage,
Expand Down
2 changes: 0 additions & 2 deletions src/utils/export.ts

This file was deleted.

0 comments on commit 7d8276c

Please sign in to comment.