@matterbridge/core 3.10.5 → 3.10.6-dev-20260816-34076cc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ import { CommodityPriceServer } from '@matter/node/behaviors/commodity-price';
2
+ import { CommodityTariffServer } from '@matter/node/behaviors/commodity-tariff';
3
+ import type { CommodityMetering } from '@matter/types/clusters/commodity-metering';
4
+ import type { CommodityPrice } from '@matter/types/clusters/commodity-price';
5
+ import { CommodityTariff } from '@matter/types/clusters/commodity-tariff';
6
+ import type { ElectricalGridConditions } from '@matter/types/clusters/electrical-grid-conditions';
7
+ import type { MeterIdentification } from '@matter/types/clusters/meter-identification';
8
+ import { type Currency, type Semtag, TariffUnit } from '@matter/types/globals';
9
+ import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
10
+ export declare class MatterbridgeCommodityPriceServer extends CommodityPriceServer {
11
+ getDetailedPriceRequest(): CommodityPrice.GetDetailedPriceResponse;
12
+ }
13
+ declare const MatterbridgeCommodityTariffServer_base: import("@matter/node").ClusterBehavior.Type<typeof CommodityTariffServer, import("@matter/types").ClusterType.WithSupportedFeatures<CommodityTariff, {
14
+ auxiliaryLoad: false;
15
+ friendlyCredit: false;
16
+ peakPeriod: false;
17
+ powerThreshold: false;
18
+ pricing: true;
19
+ randomization: false;
20
+ }>, import("@matter/types").ClusterType.Concrete, new () => {}, "commodityTariff">;
21
+ export declare class MatterbridgeCommodityTariffServer extends MatterbridgeCommodityTariffServer_base {
22
+ getTariffComponent(request: CommodityTariff.GetTariffComponentRequest): CommodityTariff.GetTariffComponentResponse;
23
+ getDayEntry(request: CommodityTariff.GetDayEntryRequest): CommodityTariff.GetDayEntryResponse;
24
+ }
25
+ export interface ElectricalUtilityMeterOptions {
26
+ meterType?: MeterIdentification.MeterType | null;
27
+ pointOfDelivery?: string | null;
28
+ meterSerialNumber?: string | null;
29
+ protocolVersion?: string | null;
30
+ tagList?: Semtag[];
31
+ }
32
+ export interface ElectricalMeterOptions {
33
+ voltage?: number | bigint | null;
34
+ current?: number | bigint | null;
35
+ power?: number | bigint | null;
36
+ energyImported?: number | bigint | null;
37
+ energyExported?: number | bigint | null;
38
+ meteredQuantity?: CommodityMetering.MeteredQuantity[] | null;
39
+ meteredQuantityTimestamp?: number | null;
40
+ tariffUnit?: TariffUnit | null;
41
+ maximumMeteredQuantities?: number | null;
42
+ tagList?: Semtag[];
43
+ }
44
+ export interface ElectricalEnergyTariffOptions {
45
+ tariffLabel?: string | null;
46
+ providerName?: string | null;
47
+ tariffUnit?: TariffUnit;
48
+ currency?: Currency | null;
49
+ currentPrice?: CommodityPrice.CommodityPriceStruct | null;
50
+ localGenerationAvailable?: boolean | null;
51
+ currentConditions?: ElectricalGridConditions.ElectricalGridConditionsStruct | null;
52
+ tagList?: Semtag[];
53
+ }
54
+ export declare class ElectricalUtilityMeter extends MatterbridgeEndpoint {
55
+ constructor(name: string, serial: string, options?: ElectricalUtilityMeterOptions);
56
+ createDefaultMeterIdentificationClusterServer(meterType?: MeterIdentification.MeterType | null, pointOfDelivery?: string | null, meterSerialNumber?: string | null, protocolVersion?: string | null): this;
57
+ addElectricalMeter(name: string, options?: ElectricalMeterOptions): MatterbridgeEndpoint;
58
+ addElectricalEnergyTariff(name: string, options?: ElectricalEnergyTariffOptions): MatterbridgeEndpoint;
59
+ }
60
+ export {};
@@ -0,0 +1,90 @@
1
+ import { CommodityTariffChronologyTag, CommodityTariffCommodityTag, PowerSourceTag } from '@matter/node';
2
+ import { CommodityMeteringServer } from '@matter/node/behaviors/commodity-metering';
3
+ import { CommodityPriceServer } from '@matter/node/behaviors/commodity-price';
4
+ import { CommodityTariffServer } from '@matter/node/behaviors/commodity-tariff';
5
+ import { ElectricalGridConditionsServer } from '@matter/node/behaviors/electrical-grid-conditions';
6
+ import { MeterIdentificationServer } from '@matter/node/behaviors/meter-identification';
7
+ import { StatusResponse } from '@matter/types';
8
+ import { CommodityTariff } from '@matter/types/clusters/commodity-tariff';
9
+ import { TariffUnit } from '@matter/types/globals';
10
+ import { electricalEnergyTariff, electricalMeter, electricalSensor, electricalUtilityMeter, meterReferencePoint, powerSource } from '../matterbridgeDeviceTypes.js';
11
+ import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
12
+ import { getSemtag, optionsFor } from '../matterbridgeEndpointHelpers.js';
13
+ export class MatterbridgeCommodityPriceServer extends CommodityPriceServer {
14
+ getDetailedPriceRequest() {
15
+ return { currentPrice: this.state.currentPrice };
16
+ }
17
+ }
18
+ export class MatterbridgeCommodityTariffServer extends CommodityTariffServer.with(CommodityTariff.Feature.Pricing) {
19
+ getTariffComponent(request) {
20
+ const tariffComponent = (this.state.tariffComponents ?? []).find((component) => component.tariffComponentId === request.tariffComponentId);
21
+ if (!tariffComponent) {
22
+ throw new StatusResponse.NotFoundError(`No TariffComponent with id ${request.tariffComponentId}`);
23
+ }
24
+ const period = (this.state.tariffPeriods ?? []).find((p) => p.tariffComponentIDs.includes(request.tariffComponentId));
25
+ return { label: period?.label ?? null, dayEntryIDs: period?.dayEntryIDs ?? [], tariffComponent };
26
+ }
27
+ getDayEntry(request) {
28
+ const dayEntry = (this.state.dayEntries ?? []).find((entry) => entry.dayEntryId === request.dayEntryId);
29
+ if (!dayEntry) {
30
+ throw new StatusResponse.NotFoundError(`No DayEntry with id ${request.dayEntryId}`);
31
+ }
32
+ return { dayEntry };
33
+ }
34
+ }
35
+ export class ElectricalUtilityMeter extends MatterbridgeEndpoint {
36
+ constructor(name, serial, options = {}) {
37
+ const { meterType = null, pointOfDelivery = null, meterSerialNumber = null, protocolVersion = null, tagList = [getSemtag(PowerSourceTag.Grid)] } = options;
38
+ super([electricalUtilityMeter, meterReferencePoint, powerSource], {
39
+ id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
40
+ tagList,
41
+ });
42
+ this.createDefaultIdentifyClusterServer();
43
+ this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Electrical Utility Meter');
44
+ this.createDefaultPowerSourceWiredClusterServer();
45
+ this.createDefaultMeterIdentificationClusterServer(meterType, pointOfDelivery, meterSerialNumber, protocolVersion);
46
+ this.addRequiredClusterServers();
47
+ }
48
+ createDefaultMeterIdentificationClusterServer(meterType = null, pointOfDelivery = null, meterSerialNumber = null, protocolVersion = null) {
49
+ this.behaviors.require(MeterIdentificationServer, optionsFor(MeterIdentificationServer, { meterType, pointOfDelivery, meterSerialNumber, protocolVersion }));
50
+ return this;
51
+ }
52
+ addElectricalMeter(name, options = {}) {
53
+ const { voltage = null, current = null, power = null, energyImported = null, energyExported = null, meteredQuantity = null, meteredQuantityTimestamp = null, tariffUnit = null, maximumMeteredQuantities = null, tagList, } = options;
54
+ const meter = this.addChildDeviceType(name, [electricalMeter, electricalSensor], tagList ? { tagList } : {})
55
+ .createDefaultPowerTopologyClusterServer()
56
+ .createDefaultElectricalPowerMeasurementClusterServer(voltage, current, power)
57
+ .createDefaultElectricalEnergyMeasurementClusterServer(energyImported, energyExported);
58
+ meter.behaviors.require(CommodityMeteringServer, optionsFor(CommodityMeteringServer, { meteredQuantity, meteredQuantityTimestamp, tariffUnit, maximumMeteredQuantities }));
59
+ meter.addRequiredClusterServers();
60
+ return meter;
61
+ }
62
+ addElectricalEnergyTariff(name, options = {}) {
63
+ const { tariffLabel = null, providerName = null, tariffUnit = TariffUnit.KWh, currency = null, currentPrice = null, localGenerationAvailable = null, currentConditions = null, tagList = [getSemtag(CommodityTariffChronologyTag.Current), getSemtag(CommodityTariffCommodityTag.ElectricalEnergy)], } = options;
64
+ const tariff = this.addChildDeviceType(name, electricalEnergyTariff, { tagList });
65
+ tariff.behaviors.require(MatterbridgeCommodityPriceServer, optionsFor(MatterbridgeCommodityPriceServer, { tariffUnit, currency, currentPrice }));
66
+ const tariffInfo = tariffLabel !== null || providerName !== null || currency !== null ? { tariffLabel, providerName, currency, blockMode: CommodityTariff.BlockMode.NoBlock } : null;
67
+ tariff.behaviors.require(MatterbridgeCommodityTariffServer, optionsFor(MatterbridgeCommodityTariffServer, {
68
+ tariffInfo,
69
+ tariffUnit: tariffInfo === null ? null : tariffUnit,
70
+ startDate: null,
71
+ dayEntries: null,
72
+ dayPatterns: null,
73
+ calendarPeriods: null,
74
+ individualDays: null,
75
+ tariffComponents: null,
76
+ tariffPeriods: null,
77
+ currentDay: null,
78
+ nextDay: null,
79
+ currentDayEntry: null,
80
+ currentDayEntryDate: null,
81
+ nextDayEntry: null,
82
+ nextDayEntryDate: null,
83
+ currentTariffComponents: null,
84
+ nextTariffComponents: null,
85
+ }));
86
+ tariff.behaviors.require(ElectricalGridConditionsServer, optionsFor(ElectricalGridConditionsServer, { localGenerationAvailable, currentConditions }));
87
+ tariff.addRequiredClusterServers();
88
+ return tariff;
89
+ }
90
+ }
@@ -16,6 +16,7 @@ export * from './microwaveOven.js';
16
16
  export * from './oven.js';
17
17
  export * from './refrigerator.js';
18
18
  export * from './batteryStorage.js';
19
+ export * from './electricalUtilityMeter.js';
19
20
  export * from './evse.js';
20
21
  export * from './heatPump.js';
21
22
  export * from './solarPower.js';
@@ -16,6 +16,7 @@ export * from './microwaveOven.js';
16
16
  export * from './oven.js';
17
17
  export * from './refrigerator.js';
18
18
  export * from './batteryStorage.js';
19
+ export * from './electricalUtilityMeter.js';
19
20
  export * from './evse.js';
20
21
  export * from './heatPump.js';
21
22
  export * from './solarPower.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/core",
3
- "version": "3.10.5",
3
+ "version": "3.10.6-dev-20260816-34076cc",
4
4
  "description": "Matterbridge core library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "homepage": "https://matterbridge.io/",
@@ -132,16 +132,16 @@
132
132
  },
133
133
  "dependencies": {
134
134
  "@matter/main": "0.17.9",
135
- "@matterbridge/dgram": "3.10.5",
136
- "@matterbridge/thread": "3.10.5",
137
- "@matterbridge/types": "3.10.5",
138
- "@matterbridge/utils": "3.10.5",
135
+ "@matterbridge/dgram": "3.10.6-dev-20260816-34076cc",
136
+ "@matterbridge/thread": "3.10.6-dev-20260816-34076cc",
137
+ "@matterbridge/types": "3.10.6-dev-20260816-34076cc",
138
+ "@matterbridge/utils": "3.10.6-dev-20260816-34076cc",
139
139
  "escape-html": "1.0.3",
140
140
  "express": "5.2.1",
141
141
  "express-rate-limit": "8.6.2",
142
142
  "multer": "2.2.0",
143
143
  "node-ansi-logger": "3.3.0",
144
144
  "node-persist-manager": "2.1.0",
145
- "ws": "8.21.2"
145
+ "ws": "8.21.3"
146
146
  }
147
147
  }