@matterbridge/core 3.6.0-dev-20260304-ce7cc65 → 3.6.0-dev-20260304-776ca2f

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.
@@ -2,6 +2,8 @@ import { OperationalState } from '@matter/types/clusters/operational-state';
2
2
  import { Semtag } from '@matter/types/globals';
3
3
  import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
4
4
  export interface IrrigationSystemOptions {
5
+ singleZone?: boolean;
6
+ batteryPowered?: boolean;
5
7
  operationalState?: OperationalState.OperationalStateEnum;
6
8
  flowMeasuredValue?: number | null;
7
9
  }
@@ -1,14 +1,26 @@
1
1
  import { LocationTag } from '@matter/main/node';
2
2
  import { OperationalState } from '@matter/types/clusters/operational-state';
3
- import { irrigationSystem, waterValve } from '../matterbridgeDeviceTypes.js';
3
+ import { irrigationSystem, powerSource, waterValve } from '../matterbridgeDeviceTypes.js';
4
4
  import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
5
5
  export class IrrigationSystem extends MatterbridgeEndpoint {
6
6
  constructor(name, serial, options = {}) {
7
- super([irrigationSystem], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
7
+ const deviceTypes = options.singleZone ? [irrigationSystem, waterValve, powerSource] : [irrigationSystem, powerSource];
8
+ super(deviceTypes, { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
8
9
  this.createDefaultIdentifyClusterServer();
9
10
  this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Irrigation System');
11
+ if (options.batteryPowered) {
12
+ this.createDefaultPowerSourceBatteryClusterServer();
13
+ }
14
+ else {
15
+ this.createDefaultPowerSourceWiredClusterServer();
16
+ }
10
17
  this.createDefaultOperationalStateClusterServer(options.operationalState ?? OperationalState.OperationalStateEnum.Stopped);
11
- this.createDefaultFlowMeasurementClusterServer(options.flowMeasuredValue ?? null);
18
+ if (options.flowMeasuredValue !== undefined)
19
+ this.createDefaultFlowMeasurementClusterServer(options.flowMeasuredValue);
20
+ if (options.singleZone) {
21
+ this.createDefaultValveConfigurationAndControlClusterServer();
22
+ }
23
+ this.addRequiredClusterServers();
12
24
  }
13
25
  addZone(tag) {
14
26
  this.addChildDeviceType(`Zone ${tag.tag}`, waterValve, { tagList: [tag, LocationTag.Zone] })
@@ -17,6 +17,8 @@ export declare class SoilMeasurementServer extends SoilMeasurementBehavior {
17
17
  export interface SoilSensorOptions {
18
18
  soilMoistureMeasurementLimits?: MeasurementAccuracy;
19
19
  soilMoistureMeasuredValue?: number | null;
20
+ temperatureMeasuredValue?: number | null;
21
+ batteryPowered?: boolean;
20
22
  }
21
23
  export declare class SoilSensor extends MatterbridgeEndpoint {
22
24
  constructor(name: string, serial: string, options?: SoilSensorOptions);
@@ -2,13 +2,13 @@ import { AttributeElement, ClusterElement, ClusterModel } from '@matter/main/mod
2
2
  import { ClusterBehavior } from '@matter/node';
3
3
  import { MeasurementType } from '@matter/types/globals';
4
4
  import { SoilMeasurement } from '../clusters/soil-measurement.js';
5
- import { soilSensor } from '../matterbridgeDeviceTypes.js';
5
+ import { powerSource, soilSensor } from '../matterbridgeDeviceTypes.js';
6
6
  import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
7
7
  const SoilMeasurementSchema = ClusterElement({
8
8
  id: SoilMeasurement.Cluster.id,
9
9
  name: SoilMeasurement.Cluster.name,
10
10
  classification: 'application',
11
- }, AttributeElement({ id: 0xfffd, name: 'ClusterRevision', type: 'ClusterRevision', conformance: 'M', default: SoilMeasurement.Cluster.revision ?? 1 }), AttributeElement({ id: 0xfffc, name: 'FeatureMap', type: 'FeatureMap', conformance: 'M', default: 0 }), AttributeElement({ id: 0x0000, name: 'soilMoistureMeasurementLimits', type: 'MeasurementAccuracyStruct', conformance: 'M' }), AttributeElement({
11
+ }, AttributeElement({ id: 0xfffd, name: 'ClusterRevision', type: 'ClusterRevision', conformance: 'M', default: SoilMeasurement.Cluster.revision }), AttributeElement({ id: 0xfffc, name: 'FeatureMap', type: 'FeatureMap', conformance: 'M', default: 0 }), AttributeElement({ id: 0x0000, name: 'soilMoistureMeasurementLimits', type: 'MeasurementAccuracyStruct', conformance: 'M' }), AttributeElement({
12
12
  id: 0x0001,
13
13
  name: 'soilMoistureMeasuredValue',
14
14
  type: 'percent',
@@ -21,19 +21,27 @@ export class SoilMeasurementServer extends SoilMeasurementBehavior {
21
21
  }
22
22
  export class SoilSensor extends MatterbridgeEndpoint {
23
23
  constructor(name, serial, options = {}) {
24
- super([soilSensor], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
24
+ super([soilSensor, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
25
25
  this.createDefaultIdentifyClusterServer();
26
26
  this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Soil Sensor');
27
+ if (options.batteryPowered) {
28
+ this.createDefaultPowerSourceBatteryClusterServer();
29
+ }
30
+ else {
31
+ this.createDefaultPowerSourceWiredClusterServer();
32
+ }
27
33
  this.behaviors.require(SoilMeasurementServer, {
28
34
  soilMoistureMeasurementLimits: options.soilMoistureMeasurementLimits ?? {
29
35
  measurementType: MeasurementType.SoilMoisture,
30
36
  measured: true,
31
- minMeasuredValue: 0n,
32
- maxMeasuredValue: 100n,
33
- accuracyRanges: [{ rangeMin: 0n, rangeMax: 100n, fixedMax: 1n }],
37
+ minMeasuredValue: 0,
38
+ maxMeasuredValue: 100,
39
+ accuracyRanges: [{ rangeMin: 0, rangeMax: 100, fixedMax: 1 }],
34
40
  },
35
41
  soilMoistureMeasuredValue: options.soilMoistureMeasuredValue ?? null,
36
42
  });
43
+ if (options.temperatureMeasuredValue !== undefined)
44
+ this.createDefaultTemperatureMeasurementClusterServer(options.temperatureMeasuredValue);
37
45
  }
38
46
  async setSoilMoistureMeasuredValue(value) {
39
47
  await this.setAttribute(SoilMeasurement.Cluster.id, 'soilMoistureMeasuredValue', value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/core",
3
- "version": "3.6.0-dev-20260304-ce7cc65",
3
+ "version": "3.6.0-dev-20260304-776ca2f",
4
4
  "description": "Matterbridge core library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "homepage": "https://matterbridge.io/",
@@ -122,10 +122,10 @@
122
122
  ],
123
123
  "dependencies": {
124
124
  "@matter/main": "0.16.10",
125
- "@matterbridge/dgram": "3.6.0-dev-20260304-ce7cc65",
126
- "@matterbridge/thread": "3.6.0-dev-20260304-ce7cc65",
127
- "@matterbridge/types": "3.6.0-dev-20260304-ce7cc65",
128
- "@matterbridge/utils": "3.6.0-dev-20260304-ce7cc65",
125
+ "@matterbridge/dgram": "3.6.0-dev-20260304-776ca2f",
126
+ "@matterbridge/thread": "3.6.0-dev-20260304-776ca2f",
127
+ "@matterbridge/types": "3.6.0-dev-20260304-776ca2f",
128
+ "@matterbridge/utils": "3.6.0-dev-20260304-776ca2f",
129
129
  "archiver": "7.0.1",
130
130
  "express": "5.2.1",
131
131
  "glob": "13.0.6",