homebridge#Units TypeScript Examples
The following examples show how to use
homebridge#Units.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts From homebridge-zigbee-nt with Apache License 2.0 | 5 votes |
export function initCustomCharacteristics(homebridge: API): void {
HAP.Service = homebridge.hap.Service;
HAP.Characteristic = homebridge.hap.Characteristic;
HAP.PlatformAccessory = homebridge.platformAccessory;
HAP.FakeGatoHistoryService = fakegato(homebridge);
HAP.CurrentPowerConsumption = class CurrentPowerConsumption extends HAP.Characteristic {
public static readonly UUID: string = 'E863F10D-079E-48FF-8F27-9C2605A29F52';
constructor() {
super('CurrentConsumption', CurrentPowerConsumption.UUID, {
format: Formats.UINT16,
unit: 'watts' as Units, // ??
maxValue: 100000,
minValue: 0,
minStep: 1,
perms: [Perms.PAIRED_READ, Perms.NOTIFY],
});
}
};
HAP.CurrentVoltage = class CurrentVoltage extends HAP.Characteristic {
public static readonly UUID: string = 'E863F10A-079E-48FF-8F27-9C2605A29F52';
constructor() {
super('CurrentVoltage', CurrentVoltage.UUID, {
format: Formats.UINT16,
unit: 'volts' as Units, // ??
maxValue: 1000,
minValue: 0,
minStep: 1,
perms: [Perms.PAIRED_READ, Perms.NOTIFY],
});
}
};
HAP.CurrentConsumption = class CurrentConsumption extends HAP.Characteristic {
public static readonly UUID: string = 'E863F126-079E-48FF-8F27-9C2605A29F52';
constructor() {
super('CurrentConsumption', CurrentConsumption.UUID, {
format: Formats.UINT16,
unit: 'ampere' as Units, // ??
maxValue: 1000,
minValue: 0,
minStep: 1,
perms: [Perms.PAIRED_READ, Perms.NOTIFY],
});
}
};
HAP.TotalConsumption = class TotalConsumption extends HAP.Characteristic {
public static readonly UUID: string = 'E863F10C-079E-48FF-8F27-9C2605A29F52';
constructor() {
super('TotalConsumption', TotalConsumption.UUID, {
format: Formats.FLOAT,
unit: 'kWh' as Units, // ??
minValue: 0,
minStep: 0.001,
perms: [Perms.PAIRED_READ, Perms.NOTIFY],
});
}
};
}