UNPKG

@ubreu/homebridge-eufy-security

Version:
33 lines 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EntrySensorAccessory = void 0; const Device_1 = require("./Device"); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const eufy_security_client_1 = require("eufy-security-client"); /** * Platform Accessory * An instance of this class is created for each accessory your platform registers * Each accessory may expose multiple services of different service types. */ class EntrySensorAccessory extends Device_1.DeviceAccessory { constructor(platform, accessory, device) { super(platform, accessory, device); this.platform.log.debug(`${this.accessory.displayName} Constructed Entry Sensor`); if (this.device.hasProperty('sensorOpen')) { this.registerCharacteristic({ serviceType: this.platform.Service.ContactSensor, characteristicType: this.platform.Characteristic.ContactSensorState, getValue: (data) => this.device.getPropertyValue(eufy_security_client_1.PropertyName.DeviceSensorOpen), onSimpleValue: 'open', }); this.initSensorService(this.platform.Service.ContactSensor); } else { this.platform.log.error(`${this.accessory.displayName} has no sensorOpen`); } this.pruneUnusedServices(); } } exports.EntrySensorAccessory = EntrySensorAccessory; //# sourceMappingURL=EntrySensorAccessory.js.map