homebridge-nanoleaf-multi 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +24 -0
- package/README.md +9 -0
- package/dist/Device.d.ts +17 -0
- package/dist/Effect.d.ts +22 -0
- package/dist/RandomEffect.d.ts +23 -0
- package/dist/SolidEffect.d.ts +22 -0
- package/dist/WaveEffect.d.ts +23 -0
- package/dist/Zone.d.ts +26 -0
- package/dist/accessories/DynamicEffectColorAccessory.d.ts +5 -0
- package/dist/accessories/ZoneAccessory.d.ts +13 -0
- package/dist/accessories/index.d.ts +3 -0
- package/dist/constants.d.ts +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +17 -0
- package/dist/platformFactory.d.ts +12 -0
- package/dist/types/Context.d.ts +9 -0
- package/dist/types/PlatformConfiguration.d.ts +6 -0
- package/dist/types/devices/DeviceConfiguration.d.ts +7 -0
- package/dist/types/devices/ZoneConfiguration.d.ts +8 -0
- package/dist/types/devices/index.d.ts +3 -0
- package/dist/types/effects/ConstantEffectColorConfiguration.d.ts +4 -0
- package/dist/types/effects/DynamicEffectColorConfiguration.d.ts +6 -0
- package/dist/types/effects/EffectColorConfiguration.d.ts +5 -0
- package/dist/types/effects/EffectColorConfigurationBase.d.ts +3 -0
- package/dist/types/effects/EffectColorType.d.ts +6 -0
- package/dist/types/effects/EffectConfiguration.d.ts +5 -0
- package/dist/types/effects/EffectConfigurationBase.d.ts +8 -0
- package/dist/types/effects/EffectType.d.ts +6 -0
- package/dist/types/effects/RemoteEffectColorConfiguration.d.ts +4 -0
- package/dist/types/effects/index.d.ts +14 -0
- package/dist/types/effects/native/NativeDirection.d.ts +7 -0
- package/dist/types/effects/native/NativeEffect.d.ts +13 -0
- package/dist/types/effects/native/NativeEffectColor.d.ts +6 -0
- package/dist/types/effects/native/NativeEffectOption.d.ts +18 -0
- package/dist/types/effects/native/NativeEffectType.d.ts +9 -0
- package/dist/types/effects/native/index.d.ts +6 -0
- package/dist/types/effects/random-effect/RandomEffectConfiguration.d.ts +9 -0
- package/dist/types/effects/random-effect/index.d.ts +2 -0
- package/dist/types/effects/solid-effect/SolidEffectColorConfiguration.d.ts +4 -0
- package/dist/types/effects/solid-effect/SolidEffectConfiguration.d.ts +7 -0
- package/dist/types/effects/solid-effect/index.d.ts +3 -0
- package/dist/types/effects/wave-effect/WaveEffectConfiguration.d.ts +11 -0
- package/dist/types/effects/wave-effect/index.d.ts +2 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/utilities/HomebridgeLogAppender.d.ts +7 -0
- package/dist/utilities/colorToNanoleafColor.d.ts +4 -0
- package/dist/utilities/index.d.ts +4 -0
- package/dist/utilities/nativeEffectTypeToPluginUuid.d.ts +3 -0
- package/package.json +52 -0
- package/src/Device.ts +73 -0
- package/src/Effect.ts +80 -0
- package/src/RandomEffect.ts +82 -0
- package/src/SolidEffect.ts +38 -0
- package/src/WaveEffect.ts +95 -0
- package/src/Zone.ts +151 -0
- package/src/accessories/DynamicEffectColorAccessory.ts +19 -0
- package/src/accessories/ZoneAccessory.ts +46 -0
- package/src/accessories/index.ts +4 -0
- package/src/constants.ts +32 -0
- package/src/index.ts +11 -0
- package/src/platformFactory.ts +88 -0
- package/src/types/Context.ts +10 -0
- package/src/types/PlatformConfiguration.ts +7 -0
- package/src/types/devices/DeviceConfiguration.ts +7 -0
- package/src/types/devices/ZoneConfiguration.ts +9 -0
- package/src/types/devices/index.ts +4 -0
- package/src/types/effects/ConstantEffectColorConfiguration.ts +9 -0
- package/src/types/effects/DynamicEffectColorConfiguration.ts +12 -0
- package/src/types/effects/EffectColorConfiguration.ts +10 -0
- package/src/types/effects/EffectColorConfigurationBase.ts +3 -0
- package/src/types/effects/EffectColorType.ts +9 -0
- package/src/types/effects/EffectConfiguration.ts +10 -0
- package/src/types/effects/EffectConfigurationBase.ts +9 -0
- package/src/types/effects/EffectType.ts +7 -0
- package/src/types/effects/RemoteEffectColorConfiguration.ts +9 -0
- package/src/types/effects/index.ts +25 -0
- package/src/types/effects/native/NativeDirection.ts +8 -0
- package/src/types/effects/native/NativeEffect.ts +14 -0
- package/src/types/effects/native/NativeEffectColor.ts +6 -0
- package/src/types/effects/native/NativeEffectOption.ts +25 -0
- package/src/types/effects/native/NativeEffectType.ts +10 -0
- package/src/types/effects/native/index.ts +13 -0
- package/src/types/effects/random-effect/RandomEffectConfiguration.ts +11 -0
- package/src/types/effects/random-effect/index.ts +3 -0
- package/src/types/effects/solid-effect/SolidEffectColorConfiguration.ts +8 -0
- package/src/types/effects/solid-effect/SolidEffectConfiguration.ts +9 -0
- package/src/types/effects/solid-effect/index.ts +4 -0
- package/src/types/effects/wave-effect/WaveEffectConfiguration.ts +13 -0
- package/src/types/effects/wave-effect/index.ts +3 -0
- package/src/types/index.ts +6 -0
- package/src/utilities/HomebridgeLogAppender.ts +15 -0
- package/src/utilities/colorToNanoleafColor.ts +14 -0
- package/src/utilities/index.ts +9 -0
- package/src/utilities/nativeEffectTypeToPluginUuid.ts +4 -0
- package/tsconfig.json +21 -0
- package/webpack.config.js +42 -0
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
image: node
|
|
2
|
+
|
|
3
|
+
stages:
|
|
4
|
+
- build
|
|
5
|
+
- publish
|
|
6
|
+
|
|
7
|
+
build:
|
|
8
|
+
stage: build
|
|
9
|
+
before_script:
|
|
10
|
+
- npm install
|
|
11
|
+
script:
|
|
12
|
+
- npm run build:development
|
|
13
|
+
|
|
14
|
+
publish:
|
|
15
|
+
stage: publish
|
|
16
|
+
dependencies:
|
|
17
|
+
- build
|
|
18
|
+
only:
|
|
19
|
+
- main
|
|
20
|
+
before_script:
|
|
21
|
+
- npm install
|
|
22
|
+
- npm run build:production
|
|
23
|
+
script:
|
|
24
|
+
- npm publish -y
|
package/README.md
ADDED
package/dist/Device.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Context, DeviceConfiguration, NativeEffect } from './types';
|
|
2
|
+
import Effect from './Effect';
|
|
3
|
+
export default class Device {
|
|
4
|
+
private readonly configuration;
|
|
5
|
+
private readonly context;
|
|
6
|
+
private initialized;
|
|
7
|
+
private nativeDevice;
|
|
8
|
+
private lock;
|
|
9
|
+
constructor(configuration: DeviceConfiguration, context: Context);
|
|
10
|
+
get name(): string;
|
|
11
|
+
get size(): number;
|
|
12
|
+
initialize(): Promise<void>;
|
|
13
|
+
private withWriteLock;
|
|
14
|
+
setActive(active: boolean): Promise<void>;
|
|
15
|
+
setActiveEffect(effect: Effect<any>): Promise<void>;
|
|
16
|
+
addNativeEffect(nativeEffect: NativeEffect): Promise<void>;
|
|
17
|
+
}
|
package/dist/Effect.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ColorHSV } from '@manganese/palette-kit-core';
|
|
3
|
+
import EventEmitter from 'events';
|
|
4
|
+
import { Context, EffectConfigurationBase, NativeEffect, ConstantEffectColorConfiguration, DynamicEffectColorConfiguration, RemoteEffectColorConfiguration } from './types';
|
|
5
|
+
import Device from './Device';
|
|
6
|
+
export default abstract class Effect<EffectConfigurationType extends EffectConfigurationBase> extends EventEmitter {
|
|
7
|
+
protected readonly configuration: EffectConfigurationType;
|
|
8
|
+
protected readonly context: Context;
|
|
9
|
+
protected enabled: boolean;
|
|
10
|
+
constructor(configuration: EffectConfigurationType, context: Context);
|
|
11
|
+
initialize(): Promise<void>;
|
|
12
|
+
get id(): string;
|
|
13
|
+
get name(): string;
|
|
14
|
+
protected get nativeEffectBase(): Partial<NativeEffect>;
|
|
15
|
+
protected handleChange(): void;
|
|
16
|
+
abstract getNativeEffectForDevice(device: Device): NativeEffect;
|
|
17
|
+
abstract getColors(): Array<ConstantEffectColorConfiguration | DynamicEffectColorConfiguration | RemoteEffectColorConfiguration>;
|
|
18
|
+
hasColor(colorId: string): boolean;
|
|
19
|
+
abstract setColor(colorId: string, color: ColorHSV): any;
|
|
20
|
+
getDynamicColors(): DynamicEffectColorConfiguration[];
|
|
21
|
+
getRemoteColors(): RemoteEffectColorConfiguration[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ColorHSV } from '@manganese/palette-kit-core';
|
|
2
|
+
import { Context, RandomEffectConfiguration, EffectColorConfiguration, NativeEffectOption } from './types';
|
|
3
|
+
import Effect from './Effect';
|
|
4
|
+
import Device from './Device';
|
|
5
|
+
export default class RandomEffect extends Effect<RandomEffectConfiguration> {
|
|
6
|
+
private colors;
|
|
7
|
+
constructor(configuration: RandomEffectConfiguration, context: Context);
|
|
8
|
+
initialize(): Promise<void>;
|
|
9
|
+
private getColor;
|
|
10
|
+
getNativeEffectForDevice(_device: Device): {
|
|
11
|
+
pluginUuid: string;
|
|
12
|
+
pluginOptions: NativeEffectOption[];
|
|
13
|
+
palette: import("./types").NativeEffectColor[];
|
|
14
|
+
version: "2.0";
|
|
15
|
+
animName: string;
|
|
16
|
+
animType: "plugin";
|
|
17
|
+
colorType: "HSB";
|
|
18
|
+
pluginType: "color";
|
|
19
|
+
hasOverlay: false;
|
|
20
|
+
};
|
|
21
|
+
getColors(): EffectColorConfiguration[];
|
|
22
|
+
setColor(colorId: string, color: ColorHSV): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ColorHSV } from '@manganese/palette-kit-core';
|
|
2
|
+
import { Context, SolidEffectConfiguration } from './types';
|
|
3
|
+
import Effect from './Effect';
|
|
4
|
+
import Device from './Device';
|
|
5
|
+
export default class SolidEffect extends Effect<SolidEffectConfiguration> {
|
|
6
|
+
private color;
|
|
7
|
+
constructor(configuration: SolidEffectConfiguration, context: Context);
|
|
8
|
+
initialize(): Promise<void>;
|
|
9
|
+
getNativeEffectForDevice(_device: Device): {
|
|
10
|
+
version: "2.0";
|
|
11
|
+
animName: string;
|
|
12
|
+
animType: "plugin";
|
|
13
|
+
colorType: "HSB";
|
|
14
|
+
palette: import("./types").NativeEffectColor[];
|
|
15
|
+
pluginType: "color";
|
|
16
|
+
pluginUuid: string;
|
|
17
|
+
pluginOptions: import("./types/effects/native/NativeEffectOption").default[];
|
|
18
|
+
hasOverlay: false;
|
|
19
|
+
};
|
|
20
|
+
getColors(): import("./types/effects/solid-effect/SolidEffectColorConfiguration").default[];
|
|
21
|
+
setColor(_colorId: string, color: ColorHSV): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ColorHSV } from '@manganese/palette-kit-core';
|
|
2
|
+
import { Context, WaveEffectConfiguration, EffectColorConfiguration, NativeEffectOption } from './types';
|
|
3
|
+
import Effect from './Effect';
|
|
4
|
+
import Device from './Device';
|
|
5
|
+
export default class WaveEffect extends Effect<WaveEffectConfiguration> {
|
|
6
|
+
private colors;
|
|
7
|
+
constructor(configuration: WaveEffectConfiguration, context: Context);
|
|
8
|
+
initialize(): Promise<void>;
|
|
9
|
+
private getColor;
|
|
10
|
+
getNativeEffectForDevice(device: Device): {
|
|
11
|
+
pluginUuid: string;
|
|
12
|
+
pluginOptions: NativeEffectOption[];
|
|
13
|
+
palette: import("./types").NativeEffectColor[];
|
|
14
|
+
version: "2.0";
|
|
15
|
+
animName: string;
|
|
16
|
+
animType: "plugin";
|
|
17
|
+
colorType: "HSB";
|
|
18
|
+
pluginType: "color";
|
|
19
|
+
hasOverlay: false;
|
|
20
|
+
};
|
|
21
|
+
getColors(): EffectColorConfiguration[];
|
|
22
|
+
setColor(colorId: string, color: ColorHSV): void;
|
|
23
|
+
}
|
package/dist/Zone.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Context, ZoneConfiguration, EffectConfiguration, EffectConfigurationBase } from './types';
|
|
2
|
+
import Effect from './Effect';
|
|
3
|
+
import SolidEffect from './SolidEffect';
|
|
4
|
+
import WaveEffect from './WaveEffect';
|
|
5
|
+
import RandomEffect from './RandomEffect';
|
|
6
|
+
export default class Zone {
|
|
7
|
+
readonly configuration: ZoneConfiguration;
|
|
8
|
+
private context;
|
|
9
|
+
constructor(configuration: ZoneConfiguration, context: Context);
|
|
10
|
+
get name(): string;
|
|
11
|
+
get id(): string;
|
|
12
|
+
createEffect(configuration: EffectConfiguration): SolidEffect | WaveEffect | RandomEffect;
|
|
13
|
+
initialize(): Promise<void>;
|
|
14
|
+
private devices;
|
|
15
|
+
private get devicesArray();
|
|
16
|
+
setActive(active: boolean): Promise<void>;
|
|
17
|
+
private effects;
|
|
18
|
+
private activeEffectId;
|
|
19
|
+
getEffects(): Map<string, Effect<any>>;
|
|
20
|
+
getEffect<T extends Effect<any> = Effect<EffectConfigurationBase>>(effectId: string): T | null;
|
|
21
|
+
get activeEffect(): Effect<EffectConfigurationBase>;
|
|
22
|
+
getDefaultActiveEffectId(): string;
|
|
23
|
+
setActiveEffectById(effectId: string): Promise<void>;
|
|
24
|
+
setActiveEffect(effect: Effect<any>): Promise<void>;
|
|
25
|
+
getActiveEffectId(): string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LocalPaletteColorAccessory } from 'helpers-for-homebridge';
|
|
2
|
+
import { Context, DynamicEffectColorConfiguration } from '../types';
|
|
3
|
+
export default class DynamicEffectColorAccessory extends LocalPaletteColorAccessory {
|
|
4
|
+
constructor(colorConfiguration: DynamicEffectColorConfiguration, context: Context);
|
|
5
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SelectionAccessory } from 'helpers-for-homebridge';
|
|
2
|
+
import { Context } from '../types';
|
|
3
|
+
import Zone from '../Zone';
|
|
4
|
+
export default class ZoneAccessory extends SelectionAccessory {
|
|
5
|
+
private readonly zone;
|
|
6
|
+
constructor(zone: Zone, context: Context);
|
|
7
|
+
private active;
|
|
8
|
+
private activeOptionId;
|
|
9
|
+
protected getActiveOptionId(): Promise<string>;
|
|
10
|
+
protected setActiveOptionId(effectId: string): Promise<void>;
|
|
11
|
+
protected getActive(): Promise<boolean>;
|
|
12
|
+
protected setActive(active: boolean): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColorHSV } from '@manganese/palette-kit-core';
|
|
2
|
+
import { NativeEffect, NativeEffectType } from './types';
|
|
3
|
+
export declare const OFF_COLOR: ColorHSV;
|
|
4
|
+
export declare const DEFAULT_DEVICE_SIZE = 50;
|
|
5
|
+
export declare const EFFECT_CHANGE_EVENT = "change";
|
|
6
|
+
export declare const EFFECT_SPEED_COEFFICIENT = 300;
|
|
7
|
+
export declare const DEFAULT_NATIVE_EFFECT_NAME = "Dynamic Effect";
|
|
8
|
+
export declare const NATIVE_EFFECT_TYPE_UUIDS: Map<NativeEffectType, string>;
|
|
9
|
+
export declare const NATIVE_EFFECT_BASE: NativeEffect;
|
package/dist/index.d.ts
ADDED