@pietrolubini/homebridge-ecoflow
Version:
Homebridge plugin for EcoFlow devices
24 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContactSensorService = void 0;
const serviceBase_1 = require("@ecoflow/services/serviceBase");
class ContactSensorService extends serviceBase_1.ServiceBase {
ecoFlowAccessory;
contactState = this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED;
constructor(ecoFlowAccessory, serviceSubType) {
super(ecoFlowAccessory.platform.Service.ContactSensor, ecoFlowAccessory, serviceSubType);
this.ecoFlowAccessory = ecoFlowAccessory;
}
addCharacteristics() {
const contactSensorStateCharacteristic = this.addCharacteristic(this.platform.Characteristic.ContactSensorState).onGet(() => this.processOnGet(this.contactState));
return [contactSensorStateCharacteristic];
}
updateState(closed) {
this.contactState = closed
? this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED
: this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
this.updateCharacteristic(this.platform.Characteristic.ContactSensorState, 'State', this.contactState);
}
}
exports.ContactSensorService = ContactSensorService;
//# sourceMappingURL=contactSensorService.js.map