@pmouli/isy-matter-server
Version:
Service to expose an ISY device as a Matter Border router
23 lines • 850 B
JavaScript
import { OnOffLightRequirements } from '@matter/node/devices/on-off-light';
import { Devices } from 'isy-nodejs/ISY';
import { BehaviorRegistry } from '../BehaviorRegistry.js';
import { ISYClusterBehavior } from '../ISYClusterBehavior.js';
export class OnOffSwitchBehavior extends ISYClusterBehavior(OnOffLightRequirements.OnOffServer, Devices.ZigBee.ExtendedColorLight) {
async initialize(_options) {
await super.initialize(_options);
}
on = async () => {
if (!this.state.onOff) {
await this.device.onOff.on();
this.state.onOff = true;
}
};
async off() {
if (this.state.onOff) {
await this.device.onOff.off();
this.state.onOff = false;
}
}
}
BehaviorRegistry.register(OnOffSwitchBehavior);
//# sourceMappingURL=OnOffSwitchBehavior.js.map