UNPKG

@dr_chai/homebridge-airthings

Version:

Connecting all your Airthings devices over bluetooth with zero configuration.

63 lines 2.37 kB
export const newRadonSta = (Char) => class RadonSta extends Char { static UUID = '000000C5-0000-1000-8000-0026BB765291'; //SulphurDioxideDensity UUID constructor() { super('Radon Short Term Avg.', RadonSta.UUID, { format: "uint16" /* Formats.UINT16 */, perms: ["ev" /* Perms.NOTIFY */, "pr" /* Perms.PAIRED_READ */], unit: 'Bq/m³', minValue: 0, maxValue: 65535, minStep: 1, }); this.value = this.getDefaultValue(); } }; const newRadonLta = (Char) => class RadonLta extends Char { static UUID = '000000C3-0000-1000-8000-0026BB765291'; // Using OzoneDensity constructor() { super('Radon Long Term Avg.', RadonLta.UUID, { format: "uint16" /* Formats.UINT16 */, perms: ["ev" /* Perms.NOTIFY */, "pr" /* Perms.PAIRED_READ */], unit: 'Bq/m³', minValue: 0, maxValue: 65535, minStep: 1, }); this.value = this.getDefaultValue(); } }; class AirthingsTypes { hap; displayRadonLTA; displayRadonSTA; constructor(homebridge, displayRadonSTA = false, displayRadonLTA = false) { this.hap = homebridge.hap; this.displayRadonLTA = displayRadonLTA; this.displayRadonSTA = displayRadonSTA; } get Service() { const Characteristics = this.Characteristics; const hapCharacteristic = this.hap.Characteristic; return class AirThingsSensor extends this.hap.Service.AirQualitySensor { constructor(displayName, subtype) { super(displayName, subtype); if (this.displayRadonSTA) { this.removeCharacteristic(hapCharacteristic.SulphurDioxideDensity); this.addCharacteristic(Characteristics.RadonSta); } if (this.displayRadonLTA) { this.removeCharacteristic(hapCharacteristic.OzoneDensity); this.addCharacteristic(Characteristics.RadonLta); } } }; } get Characteristics() { return { RadonLta: newRadonLta(this.hap.Characteristic), RadonSta: newRadonSta(this.hap.Characteristic), }; } } export default AirthingsTypes; //# sourceMappingURL=customCharacteristics.js.map