forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'matter' into matter_colortemperature
- Loading branch information
Showing
35 changed files
with
959 additions
and
194 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
bundles/org.openhab.binding.matter/matter-server/src/bridge/devices/DoorLockDeviceType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Endpoint } from "@matter/node"; | ||
import { DoorLockDevice } from "@matter/node/devices/door-lock"; | ||
import { BridgedDeviceBasicInformationServer } from "@matter/node/behaviors/bridged-device-basic-information"; | ||
import { GenericDeviceType } from './GenericDeviceType'; // Adjust the path as needed | ||
import { BridgeController } from "../BridgeController"; | ||
import { Logger } from "@matter/general"; | ||
|
||
const logger = Logger.get("DoorLockDeviceType"); | ||
|
||
export class DoorLockDeviceType extends GenericDeviceType { | ||
|
||
override createEndpoint() { | ||
|
||
const defaultParams = { | ||
lockState: 0, | ||
lockType: 0, | ||
actuatorEnabled: true, | ||
doorState: 1 | ||
} | ||
const finalMap = { ...defaultParams, ...this.attributeMap } | ||
|
||
const endpoint = new Endpoint(DoorLockDevice.with(BridgedDeviceBasicInformationServer), { | ||
id: this.endpointId, | ||
bridgedDeviceBasicInformation: { | ||
nodeLabel: this.nodeLabel, | ||
productName: this.productName, | ||
productLabel: this.productLabel, | ||
serialNumber: this.serialNumber, | ||
reachable: true, | ||
}, | ||
doorLock: { | ||
...finalMap | ||
}, | ||
}); | ||
endpoint.events.doorLock.lockState$Changed.on(value => { | ||
this.sendBridgeEvent("doorLock", "lockState", value); | ||
}); | ||
|
||
return endpoint | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
bundles/org.openhab.binding.matter/matter-server/src/bridge/devices/HumiditySensorType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Endpoint } from "@matter/node"; | ||
import { HumiditySensorDevice } from "@matter/node/devices/humidity-sensor"; | ||
import { BridgedDeviceBasicInformationServer } from "@matter/node/behaviors/bridged-device-basic-information"; | ||
import { GenericDeviceType } from './GenericDeviceType'; // Adjust the path as needed | ||
import { BridgeController } from "../BridgeController"; | ||
import { Logger } from"@matter/general"; | ||
|
||
const logger = Logger.get("HumiditySensorType"); | ||
|
||
export class HumiditySensorType extends GenericDeviceType { | ||
|
||
override createEndpoint() { | ||
const endpoint = new Endpoint(HumiditySensorDevice.with(BridgedDeviceBasicInformationServer), { | ||
id: this.endpointId, | ||
bridgedDeviceBasicInformation: { | ||
nodeLabel: this.nodeLabel, | ||
productName: this.productName, | ||
productLabel: this.productLabel, | ||
serialNumber: this.serialNumber, | ||
reachable: true, | ||
}, | ||
relativeHumidityMeasurement: { | ||
measuredValue: this.attributeMap.measuredValue || 0, | ||
}, | ||
}); | ||
return endpoint | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
.../org.openhab.binding.matter/matter-server/src/bridge/devices/OccupancySensorDeviceType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Endpoint } from "@matter/node"; | ||
import { OccupancySensorDevice } from "@matter/node/devices/occupancy-sensor"; | ||
import { BridgedDeviceBasicInformationServer } from "@matter/node/behaviors/bridged-device-basic-information"; | ||
import { GenericDeviceType } from './GenericDeviceType'; // Adjust the path as needed | ||
import { BridgeController } from "../BridgeController"; | ||
import { Logger } from"@matter/general"; | ||
|
||
const logger = Logger.get("OccupancySensorDeviceType"); | ||
|
||
export class OccupancySensorDeviceType extends GenericDeviceType { | ||
|
||
override createEndpoint() { | ||
logger.info(`Creating Occupancy Sensor Device Endpoint ${JSON.stringify(this.attributeMap)}`); | ||
const endpoint = new Endpoint(OccupancySensorDevice.with(BridgedDeviceBasicInformationServer), { | ||
id: this.endpointId, | ||
bridgedDeviceBasicInformation: { | ||
nodeLabel: this.nodeLabel, | ||
productName: this.productName, | ||
productLabel: this.productLabel, | ||
serialNumber: this.serialNumber, | ||
reachable: true, | ||
}, | ||
occupancySensing: { | ||
occupancy: this.attributeMap.occupancy, | ||
occupancySensorType : this.attributeMap.occupancySensorType || 3, | ||
}, | ||
}); | ||
return endpoint | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
bundles/org.openhab.binding.matter/matter-server/src/bridge/devices/TemperatureSensorType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Endpoint } from "@matter/node"; | ||
import { TemperatureSensorDevice } from "@matter/node/devices/temperature-sensor"; | ||
import { BridgedDeviceBasicInformationServer } from "@matter/node/behaviors/bridged-device-basic-information"; | ||
import { GenericDeviceType } from './GenericDeviceType'; // Adjust the path as needed | ||
import { BridgeController } from "../BridgeController"; | ||
import { Logger } from"@matter/general"; | ||
|
||
const logger = Logger.get("TemperatureSensorType"); | ||
|
||
export class TemperatureSensorType extends GenericDeviceType { | ||
|
||
override createEndpoint() { | ||
const endpoint = new Endpoint(TemperatureSensorDevice.with(BridgedDeviceBasicInformationServer), { | ||
id: this.endpointId, | ||
bridgedDeviceBasicInformation: { | ||
nodeLabel: this.nodeLabel, | ||
productName: this.productName, | ||
productLabel: this.productLabel, | ||
serialNumber: this.serialNumber, | ||
reachable: true, | ||
}, | ||
temperatureMeasurement: { | ||
measuredValue: this.attributeMap.measuredValue || 0, | ||
}, | ||
}); | ||
return endpoint | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.