homebridge#CharacteristicProps TypeScript Examples

The following examples show how to use homebridge#CharacteristicProps. 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: default-characteristic.ts    From homebridge-tapo-p100 with Apache License 2.0 6 votes vote down vote up
export default function defaultCharacteristic(
  Characteristic: typeof CharacteristicClass,
): typeof CharacteristicClass {
  return class DefaultCharacteristic extends Characteristic {
    constructor(
      displayName: string,
      UUID: string,
      props?: MarkOptional<CharacteristicProps, 'format' | 'perms'>,
    ) {
      const combinedProps = {
        format: Formats.FLOAT,
        minValue: 0,
        maxValue: 65535,
        perms: [Perms.PAIRED_READ, Perms.NOTIFY],
        ...props,
      };
      super(displayName, UUID, combinedProps);
      this.value = this.getDefaultValue();
    }
  };
}