UNPKG

@ubreu/homebridge-eufy-security

Version:
33 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MotionSensorAccessory = 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 MotionSensorAccessory extends Device_1.DeviceAccessory { constructor(platform, accessory, device) { super(platform, accessory, device); this.platform.log.debug(`${this.accessory.displayName} Constructed Motion Sensor`); if (this.device.hasProperty('motionDetected')) { this.registerCharacteristic({ serviceType: this.platform.Service.MotionSensor, characteristicType: this.platform.Characteristic.MotionDetected, getValue: (data) => this.device.getPropertyValue(eufy_security_client_1.PropertyName.DeviceMotionDetected), onSimpleValue: 'motion detected', }); this.initSensorService(this.platform.Service.MotionSensor); } else { this.platform.log.error(`${this.accessory.displayName} has no motionDetected`); } this.pruneUnusedServices(); } } exports.MotionSensorAccessory = MotionSensorAccessory; //# sourceMappingURL=MotionSensorAccessory.js.map