@pst-on-npm/homebridge-enocean
Version:
Integrate EnOcean® devices into Homebridge.
37 lines • 1.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnoAccessory = void 0;
class EnoAccessory {
platform;
accessory;
config;
/**
* Convenience property for `platform.api.hap`
*/
hap;
constructor(platform, accessory, config) {
this.platform = platform;
this.accessory = accessory;
this.config = config;
this.hap = platform.api.hap;
}
/**
* Retrieves the specified property value.
*
* @param property - The characteristic value to retrieve. If undefined, an error is thrown.
* @returns A promise that resolves to the characteristic value.
* @throws HapStatusError - If the property is undefined, indicating a service communication failure.
*/
async getProperty(property) {
// If you need to return an error to show the device as "Not Responding" in the Home app:
// throw new this.platform.api.hap.HapStatusError(this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
if (property === undefined) {
this.platform.log.warn(`${this.accessory.displayName}: GET() was undefined -> com fail`);
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
}
//this.platform.log.debug(`${this.accessory.displayName}: GET() returned '${property}'`);
return property;
}
}
exports.EnoAccessory = EnoAccessory;
//# sourceMappingURL=EnoAccessory.js.map