homenet-plugin-zway
Version:
Homenet plugin for Z-Way connected Z-Wave devices
34 lines • 940 B
JavaScript
;
const events_1 = require('events');
const CLASS_LOCK = 98;
class ZwayLock extends events_1.EventEmitter {
constructor(id, controller, deviceId) {
super();
controller.onLockEvent(deviceId, this._onLockEvent.bind(this));
controller.onAlarmEvent(deviceId, this._onAlarmEvent.bind(this));
this._controller = controller;
this._device = controller.getLockDevice(deviceId);
}
set(value) {
if (value) {
console.log('LOCK');
this._device.DoorLock.lock();
}
else {
console.log('UNLOCK');
this._device.DoorLock.unlock();
}
}
get() {
return this._device.DoorLock.isLocked();
}
_onLockEvent(e) {
if (e.event === 'mode') {
}
}
_onAlarmEvent(event) {
this._device.DoorLock.refresh();
}
}
exports.ZwayLock = ZwayLock;
//# sourceMappingURL=lock.js.map