homebridge-openrgb-multi 6.4.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 +1 -0
- package/dist/Device.d.ts +21 -0
- package/dist/Device.js +139 -0
- package/dist/Device.js.map +1 -0
- package/dist/Zone.d.ts +10 -0
- package/dist/Zone.js +64 -0
- package/dist/Zone.js.map +1 -0
- package/dist/accessories/ZoneBrightnessAccessory.d.ts +9 -0
- package/dist/accessories/ZoneBrightnessAccessory.js +35 -0
- package/dist/accessories/ZoneBrightnessAccessory.js.map +1 -0
- package/dist/accessories/ZoneEffectAccessory.d.ts +11 -0
- package/dist/accessories/ZoneEffectAccessory.js +54 -0
- package/dist/accessories/ZoneEffectAccessory.js.map +1 -0
- package/dist/accessories/ZoneSceneTransitionAccessory.d.ts +9 -0
- package/dist/accessories/ZoneSceneTransitionAccessory.js +37 -0
- package/dist/accessories/ZoneSceneTransitionAccessory.js.map +1 -0
- package/dist/accessories/index.d.ts +3 -0
- package/dist/accessories/index.js +20 -0
- package/dist/accessories/index.js.map +1 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +11 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/platformFactory.d.ts +11 -0
- package/dist/platformFactory.js +87 -0
- package/dist/platformFactory.js.map +1 -0
- package/dist/services/PersistenceService.d.ts +13 -0
- package/dist/services/PersistenceService.js +83 -0
- package/dist/services/PersistenceService.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +18 -0
- package/dist/services/index.js.map +1 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +38 -0
- package/dist/test.js.map +1 -0
- package/dist/types/Context.d.ts +14 -0
- package/dist/types/Context.js +3 -0
- package/dist/types/Context.js.map +1 -0
- package/dist/types/configuration/ConfigurationVector2.d.ts +4 -0
- package/dist/types/configuration/ConfigurationVector2.js +3 -0
- package/dist/types/configuration/ConfigurationVector2.js.map +1 -0
- package/dist/types/configuration/DeviceConfiguration.d.ts +8 -0
- package/dist/types/configuration/DeviceConfiguration.js +3 -0
- package/dist/types/configuration/DeviceConfiguration.js.map +1 -0
- package/dist/types/configuration/PlatformConfiguration.d.ts +10 -0
- package/dist/types/configuration/PlatformConfiguration.js +3 -0
- package/dist/types/configuration/PlatformConfiguration.js.map +1 -0
- package/dist/types/configuration/SegmentConfiguration.d.ts +7 -0
- package/dist/types/configuration/SegmentConfiguration.js +3 -0
- package/dist/types/configuration/SegmentConfiguration.js.map +1 -0
- package/dist/types/configuration/ZoneConfiguration.d.ts +6 -0
- package/dist/types/configuration/ZoneConfiguration.js +3 -0
- package/dist/types/configuration/ZoneConfiguration.js.map +1 -0
- package/dist/types/configuration/index.d.ts +5 -0
- package/dist/types/configuration/index.js +22 -0
- package/dist/types/configuration/index.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +20 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/persistence/PlatformPersistence.d.ts +6 -0
- package/dist/types/persistence/PlatformPersistence.js +3 -0
- package/dist/types/persistence/PlatformPersistence.js.map +1 -0
- package/dist/types/persistence/ZonePersistence.d.ts +5 -0
- package/dist/types/persistence/ZonePersistence.js +3 -0
- package/dist/types/persistence/ZonePersistence.js.map +1 -0
- package/dist/types/persistence/index.d.ts +2 -0
- package/dist/types/persistence/index.js +19 -0
- package/dist/types/persistence/index.js.map +1 -0
- package/package.json +53 -0
- package/src/Device.ts +175 -0
- package/src/Zone.ts +82 -0
- package/src/accessories/ZoneBrightnessAccessory.ts +27 -0
- package/src/accessories/ZoneEffectAccessory.ts +44 -0
- package/src/accessories/ZoneSceneTransitionAccessory.ts +29 -0
- package/src/accessories/index.ts +3 -0
- package/src/constants.ts +11 -0
- package/src/index.ts +16 -0
- package/src/platformFactory.ts +116 -0
- package/src/services/PersistenceService.ts +74 -0
- package/src/services/index.ts +1 -0
- package/src/test.ts +44 -0
- package/src/types/Context.ts +15 -0
- package/src/types/configuration/ConfigurationVector2.ts +4 -0
- package/src/types/configuration/DeviceConfiguration.ts +9 -0
- package/src/types/configuration/PlatformConfiguration.ts +11 -0
- package/src/types/configuration/SegmentConfiguration.ts +8 -0
- package/src/types/configuration/ZoneConfiguration.ts +7 -0
- package/src/types/configuration/index.ts +5 -0
- package/src/types/index.ts +3 -0
- package/src/types/persistence/PlatformPersistence.ts +7 -0
- package/src/types/persistence/ZonePersistence.ts +5 -0
- package/src/types/persistence/index.ts +2 -0
- package/tsconfig.json +20 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Homebridge OpenRGB Multi
|
package/dist/Device.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ColorHSV } from '@manganese/palette-kit-core';
|
|
2
|
+
import { Controller, ApplyParameters } from '@manganese/effect-kit';
|
|
3
|
+
import { Context, DeviceConfiguration } from './types';
|
|
4
|
+
export declare class Device implements Controller {
|
|
5
|
+
private readonly configuration;
|
|
6
|
+
private readonly context;
|
|
7
|
+
private openRgbDeviceId;
|
|
8
|
+
private lock;
|
|
9
|
+
private colors;
|
|
10
|
+
private size;
|
|
11
|
+
constructor(configuration: DeviceConfiguration, context: Context);
|
|
12
|
+
get name(): string;
|
|
13
|
+
private get position();
|
|
14
|
+
private get virtual();
|
|
15
|
+
initialize(): Promise<void>;
|
|
16
|
+
private withWriteLock;
|
|
17
|
+
getSize(): number;
|
|
18
|
+
getIndexPosition(index: number): any;
|
|
19
|
+
setActive(active: boolean): Promise<void>;
|
|
20
|
+
applyRange(fromIndex: number, toIndex: number, colors: ColorHSV[], parameters?: ApplyParameters): Promise<void>;
|
|
21
|
+
}
|
package/dist/Device.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Device = void 0;
|
|
16
|
+
const rwlock_1 = __importDefault(require("rwlock"));
|
|
17
|
+
const three_1 = require("three");
|
|
18
|
+
const openrgb_sdk_1 = require("openrgb-sdk");
|
|
19
|
+
const palette_kit_core_1 = require("@manganese/palette-kit-core");
|
|
20
|
+
const helpers_for_homebridge_1 = require("helpers-for-homebridge");
|
|
21
|
+
class Device {
|
|
22
|
+
constructor(configuration, context) {
|
|
23
|
+
this.configuration = configuration;
|
|
24
|
+
this.context = context;
|
|
25
|
+
this.openRgbDeviceId = -1;
|
|
26
|
+
this.lock = new rwlock_1.default();
|
|
27
|
+
}
|
|
28
|
+
get name() {
|
|
29
|
+
return this.configuration.name;
|
|
30
|
+
}
|
|
31
|
+
get position() {
|
|
32
|
+
return new three_1.Vector2(this.configuration.position.x, this.configuration.position.y);
|
|
33
|
+
}
|
|
34
|
+
get virtual() {
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = this.configuration.virtual) !== null && _a !== void 0 ? _a : false;
|
|
37
|
+
}
|
|
38
|
+
initialize() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (this.virtual) {
|
|
41
|
+
this.context.log.info(`Initialized virtual device <${this.configuration.name}>`);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const openRgbDevices = yield this.context.openRgbClient.getAllControllerData();
|
|
45
|
+
const openRgbDevice = openRgbDevices.find((openRgb) => openRgb.serial.replace(/\s+$/g, '') ===
|
|
46
|
+
this.configuration.serial);
|
|
47
|
+
if (!openRgbDevice) {
|
|
48
|
+
this.context.log.warn(`Could not resolve device <${this.name}> to OpenRGB controller`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.openRgbDeviceId = openRgbDevice.deviceId;
|
|
52
|
+
this.size = openRgbDevice.leds.length;
|
|
53
|
+
this.colors = new Array(this.size).fill(palette_kit_core_1.DEFAULT_COLOR);
|
|
54
|
+
this.context.log.info(`Resolved device <${this.name}> to OpenRGB controller ID [${this.openRgbDeviceId}] with size ${this.size}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
withWriteLock(callback) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
if (!this.virtual && this.openRgbDeviceId < 0) {
|
|
62
|
+
this.context.log.warn(`Ignoring write lock request because device <${this.name}> was not initialized`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
return this.lock.writeLock((release) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
try {
|
|
67
|
+
yield callback();
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.context.log.error('Error while holding write lock', error);
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
release();
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
getSize() {
|
|
79
|
+
return this.size;
|
|
80
|
+
}
|
|
81
|
+
getIndexPosition(index) {
|
|
82
|
+
const { segments } = this.configuration;
|
|
83
|
+
for (let segmentIndex = 0; segmentIndex < segments.length; segmentIndex++) {
|
|
84
|
+
const segment = segments[segmentIndex];
|
|
85
|
+
const segmentLength = segment.toIndex - segment.fromIndex;
|
|
86
|
+
if (index < segmentLength) {
|
|
87
|
+
const ratio = index / segmentLength;
|
|
88
|
+
return new three_1.Vector2(this.position.x +
|
|
89
|
+
segment.fromPosition.x +
|
|
90
|
+
(segment.toPosition.x - segment.fromPosition.x) * ratio, this.position.y +
|
|
91
|
+
segment.fromPosition.y +
|
|
92
|
+
(segment.toPosition.y - segment.fromPosition.y) * ratio);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
index -= segmentLength;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return this.position;
|
|
99
|
+
}
|
|
100
|
+
setActive(active) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
yield this.withWriteLock(() => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
if (this.virtual)
|
|
104
|
+
return;
|
|
105
|
+
this.context.log.debug(`Applied <${this.name}>.active = ${(0, helpers_for_homebridge_1.logBoolean)(active)}`);
|
|
106
|
+
}));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
applyRange(fromIndex, toIndex, colors, parameters) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
yield this.withWriteLock(() => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
if (!this.virtual) {
|
|
113
|
+
this.context.openRgbClient.updateLeds(this.openRgbDeviceId, new Array(this.size)
|
|
114
|
+
.fill(palette_kit_core_1.DEFAULT_COLOR)
|
|
115
|
+
.map((defaultColor, index) => {
|
|
116
|
+
if (index >= fromIndex && index < toIndex) {
|
|
117
|
+
return colors[index - fromIndex];
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
return this.colors[index];
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
.map((colorHsv) => {
|
|
124
|
+
return openrgb_sdk_1.utils.HSVColor(colorHsv.hue * 360, colorHsv.saturation, colorHsv.value);
|
|
125
|
+
}));
|
|
126
|
+
for (let index = fromIndex; index < toIndex; index++) {
|
|
127
|
+
this.colors[index] = colors[index - fromIndex];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
this.context.log.debug(`Applied <${this.name}>[${fromIndex}-${toIndex}] = [\n${colors
|
|
131
|
+
.map(palette_kit_core_1.colorToString)
|
|
132
|
+
.map((colorString) => ' ' + colorString)
|
|
133
|
+
.join(',\n')}\n]`);
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.Device = Device;
|
|
139
|
+
//# sourceMappingURL=Device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Device.js","sourceRoot":"","sources":["../src/Device.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAmC;AACnC,iCAAgC;AAChC,6CAAoD;AAEpD,kEAOqC;AAGrC,mEAAoD;AAEpD,MAAa,MAAM;IAMjB,YACmB,aAAkC,EAClC,OAAgB;QADhB,kBAAa,GAAb,aAAa,CAAqB;QAClC,YAAO,GAAP,OAAO,CAAS;QAP3B,oBAAe,GAAW,CAAC,CAAC,CAAC;QAC7B,SAAI,GAAG,IAAI,gBAAa,EAAE,CAAC;IAOhC,CAAC;IA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AI,KAAK,GAAG,OAAO,EAAE,CAAC;4BAC1C,OAAO,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;wBACnC,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wBAC5B,CAAC;oBACH,CAAC,CAAC;yBACD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;wBAChB,OAAO,mBAAY,CAAC,QAAQ,CAC1B,QAAQ,CAAC,GAAG,GAAG,GAAG,EAClB,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,KAAK,CACf,CAAC;oBACJ,CAAC,CAAC,CACL,CAAC;oBAEF,KAAK,IAAI,KAAK,GAAG,SAAS,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;wBACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;oBACjD,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CACpB,YAAY,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,UAAU,MAAM;qBAC3D,GAAG,CAAC,gCAAa,CAAC;qBAClB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,GAAG,WAAW,CAAC;qBACxC,IAAI,CAAC,KAAK,CAAC,KAAK,CACpB,CAAC;YACJ,CAAC,CAAA,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AA9JD,wBA8JC"}
|
package/dist/Zone.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context, ZoneConfiguration } from './types';
|
|
2
|
+
import { Zone as EffectKitZone } from '@manganese/effect-kit';
|
|
3
|
+
export declare class Zone extends EffectKitZone {
|
|
4
|
+
protected configuration: ZoneConfiguration;
|
|
5
|
+
protected context: Context;
|
|
6
|
+
constructor(configuration: ZoneConfiguration, context: Context);
|
|
7
|
+
initialize(): Promise<void>;
|
|
8
|
+
private devices;
|
|
9
|
+
private get devicesArray();
|
|
10
|
+
}
|
package/dist/Zone.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Zone = void 0;
|
|
13
|
+
const Device_1 = require("./Device");
|
|
14
|
+
const helpers_for_homebridge_1 = require("helpers-for-homebridge");
|
|
15
|
+
const effect_kit_1 = require("@manganese/effect-kit");
|
|
16
|
+
class Zone extends effect_kit_1.Zone {
|
|
17
|
+
constructor(configuration, context) {
|
|
18
|
+
const devices = new Set(configuration.devices.map((deviceConfiguration) => {
|
|
19
|
+
return new Device_1.Device(deviceConfiguration, context);
|
|
20
|
+
}));
|
|
21
|
+
super(configuration, devices, context);
|
|
22
|
+
this.configuration = configuration;
|
|
23
|
+
this.context = context;
|
|
24
|
+
this.devices = devices;
|
|
25
|
+
}
|
|
26
|
+
// Initialization
|
|
27
|
+
initialize() {
|
|
28
|
+
const _super = Object.create(null, {
|
|
29
|
+
initialize: { get: () => super.initialize }
|
|
30
|
+
});
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield _super.initialize.call(this);
|
|
33
|
+
if (this.context.persistence) {
|
|
34
|
+
const active = yield this.context.persistence.getZoneActive(this.id);
|
|
35
|
+
const brightness = yield this.context.persistence.getZoneBrightness(this.id);
|
|
36
|
+
const effectId = yield this.context.persistence.getZoneEffectId(this.id);
|
|
37
|
+
if (effectId) {
|
|
38
|
+
const effect = this.getEffect(effectId);
|
|
39
|
+
this.context.log.debug(`Restoring persisted zone ${(0, helpers_for_homebridge_1.logAccessoryName)(this.name)} effect ID = [${effect.name}]`);
|
|
40
|
+
yield this.setEffectId(effectId);
|
|
41
|
+
}
|
|
42
|
+
this.context.log.debug(`Restoring persisted zone ${(0, helpers_for_homebridge_1.logAccessoryName)(this.name)} active = ${(0, helpers_for_homebridge_1.logBoolean)(active)}, brightness = ${(0, helpers_for_homebridge_1.logPercent)(brightness)}`);
|
|
43
|
+
yield this.setBrightness(brightness);
|
|
44
|
+
yield this.setActive(active);
|
|
45
|
+
}
|
|
46
|
+
this.on('updateActive', (active) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield this.context.persistence.setZoneActive(this.id, active);
|
|
48
|
+
}));
|
|
49
|
+
this.on('updateBrightness', (brightness) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
yield this.context.persistence.setZoneBrightness(this.id, brightness);
|
|
51
|
+
}));
|
|
52
|
+
this.on('updateEffect', (effectId) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
if (effectId) {
|
|
54
|
+
yield this.context.persistence.setZoneEffectId(this.id, effectId);
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
get devicesArray() {
|
|
60
|
+
return Array.from(this.devices);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Zone = Zone;
|
|
64
|
+
//# sourceMappingURL=Zone.js.map
|
package/dist/Zone.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Zone.js","sourceRoot":"","sources":["../src/Zone.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAkC;AAClC,mEAIgC;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one';
|
|
4
|
+
export declare class ZoneBrightnessAccessory extends BrightnessAccessory {
|
|
5
|
+
private readonly zone;
|
|
6
|
+
constructor(zone: Zone, context: Context);
|
|
7
|
+
getBrightness(): Promise<number>;
|
|
8
|
+
setBrightness(brightness: number): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ZoneBrightnessAccessory = void 0;
|
|
13
|
+
const helpers_for_homebridge_1 = require("helpers-for-homebridge");
|
|
14
|
+
class ZoneBrightnessAccessory extends helpers_for_homebridge_1.BrightnessAccessory {
|
|
15
|
+
constructor(zone, context) {
|
|
16
|
+
super({
|
|
17
|
+
name: zone.name + ' Brightness',
|
|
18
|
+
serial: zone.id + '_brightness',
|
|
19
|
+
model: 'OpenRGB Multi Zone Brightness',
|
|
20
|
+
}, context);
|
|
21
|
+
this.zone = zone;
|
|
22
|
+
}
|
|
23
|
+
getBrightness() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
return this.zone.getBrightness();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
setBrightness(brightness) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return this.zone.setBrightness(brightness);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ZoneBrightnessAccessory = ZoneBrightnessAccessory;
|
|
35
|
+
//# sourceMappingURL=ZoneBrightnessAccessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoneBrightnessAccessory.js","sourceRoot":"","sources":["../../src/accessories/ZoneBrightnessAccessory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAA6D;AAI7D,MAAa,uBAAwB,SAAQ,4CAAmB;IAC9D,YACmB,IAAU,EAC3B,OAAgB;QAEhB,KAAK,CACH;YACE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,aAAa;YAC/B,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,aAAa;YAC/B,KAAK,EAAE,+BAA+B;SACvC,EACD,OAAO,CACR,CAAC;QAVe,SAAI,GAAJ,IAAI,CAAM;IAW7B,CAAC;IAEqB,aAAa;;YACjC,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC;KAAA;IAEqB,aAAa,CAAC,UAAkB;;YACpD,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC;KAAA;CACF;AAtBD,0DAsBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectionAccessory } from 'helpers-for-homebridge';
|
|
2
|
+
import { Context } from '../types';
|
|
3
|
+
import { Zone } from '../Zone';
|
|
4
|
+
export declare class ZoneEffectAccessory extends SelectionAccessory {
|
|
5
|
+
private readonly zone;
|
|
6
|
+
constructor(zone: Zone, context: Context);
|
|
7
|
+
protected getActiveOptionId(): Promise<string>;
|
|
8
|
+
protected setActiveOptionId(effectId: string): Promise<void>;
|
|
9
|
+
protected getActive(): Promise<boolean>;
|
|
10
|
+
protected setActive(active: boolean): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ZoneEffectAccessory = void 0;
|
|
13
|
+
const helpers_for_homebridge_1 = require("helpers-for-homebridge");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
class ZoneEffectAccessory extends helpers_for_homebridge_1.SelectionAccessory {
|
|
16
|
+
constructor(zone, context) {
|
|
17
|
+
super({
|
|
18
|
+
name: zone.name + ' Effect',
|
|
19
|
+
serial: zone.id + '_effect',
|
|
20
|
+
model: 'OpenRGB Multi Zone Effect',
|
|
21
|
+
mode: constants_1.ZONE_EFFECT_SELECTION_ACCESSORY_MODE,
|
|
22
|
+
options: Array.from(zone.getEffects().values()).map((effect) => {
|
|
23
|
+
return {
|
|
24
|
+
name: effect.name,
|
|
25
|
+
id: effect.id,
|
|
26
|
+
hapIdentifier: effect.hapIdentifier,
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
}, context);
|
|
30
|
+
this.zone = zone;
|
|
31
|
+
}
|
|
32
|
+
getActiveOptionId() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return this.zone.getEffectIdOrDefault();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
setActiveOptionId(effectId) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
yield this.zone.setActiveEffectId(effectId);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
getActive() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return this.zone.active;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
setActive(active) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
yield this.zone.setActive(active);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ZoneEffectAccessory = ZoneEffectAccessory;
|
|
54
|
+
//# sourceMappingURL=ZoneEffectAccessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoneEffectAccessory.js","sourceRoot":"","sources":["../../src/accessories/ZoneEffectAccessory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAA4D;AAG5D,4CAAoE;AAEpE,MAAa,mBAAoB,SAAQ,2CAAkB;IACzD,YACmB,IAAU,EAC3B,OAAgB;QAEhB,KAAK,CACH;YACE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,SAAS;YAC3B,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,SAAS;YAC3B,KAAK,EAAE,2BAA2B;YAClC,IAAI,EAAE,gDAAoC;YAC1C,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC7D,OAAO;oBACL,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,EAAE,EAAE,MAAM,CAAC,EAAE;oBACb,aAAa,EAAE,MAAM,CAAC,aAAa;iBACpC,CAAC;YACJ,CAAC,CAAC;SACH,EACD,OAAO,CACR,CAAC;QAlBe,SAAI,GAAJ,IAAI,CAAM;IAmB7B,CAAC;IAEwB,iBAAiB;;YACxC,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1C,CAAC;KAAA;IAEwB,iBAAiB,CAAC,QAAgB;;YACzD,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC9C,CAAC;KAAA;IAEwB,SAAS;;YAChC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,CAAC;KAAA;IAEwB,SAAS,CAAC,MAAe;;YAChD,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;KAAA;CACF;AAtCD,kDAsCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SwitchAccessory } from 'helpers-for-homebridge';
|
|
2
|
+
import { Context } from '../types';
|
|
3
|
+
import { Zone } from '../Zone';
|
|
4
|
+
export declare class ZoneSceneTransitionAccessory extends SwitchAccessory {
|
|
5
|
+
private readonly zone;
|
|
6
|
+
constructor(zone: Zone, context: Context);
|
|
7
|
+
getOn(): Promise<boolean>;
|
|
8
|
+
setOn(on: boolean): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ZoneSceneTransitionAccessory = void 0;
|
|
13
|
+
const helpers_for_homebridge_1 = require("helpers-for-homebridge");
|
|
14
|
+
class ZoneSceneTransitionAccessory extends helpers_for_homebridge_1.SwitchAccessory {
|
|
15
|
+
constructor(zone, context) {
|
|
16
|
+
super({
|
|
17
|
+
name: zone.name + ' Scene Transition',
|
|
18
|
+
serial: zone.id + '_scene_transition',
|
|
19
|
+
model: 'OpenRGB Multi Zone Scene Transition',
|
|
20
|
+
}, context);
|
|
21
|
+
this.zone = zone;
|
|
22
|
+
}
|
|
23
|
+
getOn() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
return this.zone.sceneTransitionActive;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
setOn(on) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (!on)
|
|
31
|
+
return;
|
|
32
|
+
this.zone.sceneTransition();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ZoneSceneTransitionAccessory = ZoneSceneTransitionAccessory;
|
|
37
|
+
//# sourceMappingURL=ZoneSceneTransitionAccessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoneSceneTransitionAccessory.js","sourceRoot":"","sources":["../../src/accessories/ZoneSceneTransitionAccessory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAyD;AAIzD,MAAa,4BAA6B,SAAQ,wCAAe;IAC/D,YACmB,IAAU,EAC3B,OAAgB;QAEhB,KAAK,CACH;YACE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,mBAAmB;YACrC,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,mBAAmB;YACrC,KAAK,EAAE,qCAAqC;SAC7C,EACD,OAAO,CACR,CAAC;QAVe,SAAI,GAAJ,IAAI,CAAM;IAW7B,CAAC;IAEqB,KAAK;;YACzB,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC;QACzC,CAAC;KAAA;IAEqB,KAAK,CAAC,EAAW;;YACrC,IAAI,CAAC,EAAE;gBAAE,OAAO;YAEhB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;QAC9B,CAAC;KAAA;CACF;AAxBD,oEAwBC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ZoneEffectAccessory"), exports);
|
|
18
|
+
__exportStar(require("./ZoneBrightnessAccessory"), exports);
|
|
19
|
+
__exportStar(require("./ZoneSceneTransitionAccessory"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/accessories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,4DAA0C;AAC1C,iEAA+C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import SimpleLogger from 'simple-node-logger';
|
|
2
|
+
import { SelectionAccessoryMode } from 'helpers-for-homebridge';
|
|
3
|
+
export declare const DEFAULT_PERSISTENCE_FILENAME = "openrgb.json";
|
|
4
|
+
export declare const DEFAULT_OPENRGB_HOST = "localhost";
|
|
5
|
+
export declare const DEFAULT_OPENRGB_PORT = 6742;
|
|
6
|
+
export declare const DEFAULT_LOG_LEVEL: SimpleLogger.STANDARD_LEVELS;
|
|
7
|
+
export declare const DEFAULT_DURATION = 1000;
|
|
8
|
+
export declare const EFFECT_TRANSITION_DURATION = 500;
|
|
9
|
+
export declare const ZONE_EFFECT_SELECTION_ACCESSORY_MODE: SelectionAccessoryMode;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZONE_EFFECT_SELECTION_ACCESSORY_MODE = exports.EFFECT_TRANSITION_DURATION = exports.DEFAULT_DURATION = exports.DEFAULT_LOG_LEVEL = exports.DEFAULT_OPENRGB_PORT = exports.DEFAULT_OPENRGB_HOST = exports.DEFAULT_PERSISTENCE_FILENAME = void 0;
|
|
4
|
+
exports.DEFAULT_PERSISTENCE_FILENAME = 'openrgb.json';
|
|
5
|
+
exports.DEFAULT_OPENRGB_HOST = 'localhost';
|
|
6
|
+
exports.DEFAULT_OPENRGB_PORT = 6742;
|
|
7
|
+
exports.DEFAULT_LOG_LEVEL = 'info';
|
|
8
|
+
exports.DEFAULT_DURATION = 1000;
|
|
9
|
+
exports.EFFECT_TRANSITION_DURATION = 500;
|
|
10
|
+
exports.ZONE_EFFECT_SELECTION_ACCESSORY_MODE = 'outlet';
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,4BAA4B,GAAG,cAAc,CAAC;AAC9C,QAAA,oBAAoB,GAAG,WAAW,CAAC;AACnC,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAC5B,QAAA,iBAAiB,GAAiC,MAAM,CAAC;AACzD,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,0BAA0B,GAAG,GAAG,CAAC;AACjC,QAAA,oCAAoC,GAC/C,QAAQ,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const platformFactory_1 = require("./platformFactory");
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./constants"), exports);
|
|
20
|
+
__exportStar(require("./Zone"), exports);
|
|
21
|
+
__exportStar(require("./Device"), exports);
|
|
22
|
+
exports.default = (homebridge) => {
|
|
23
|
+
const Platform = (0, platformFactory_1.createPlatform)(homebridge);
|
|
24
|
+
homebridge.registerPlatform('homebridge-openrgb-multi', 'OpenRGBMulti', Platform);
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAmD;AAEnD,0CAAwB;AACxB,8CAA4B;AAC5B,yCAAuB;AACvB,2CAAyB;AAEzB,kBAAe,CAAC,UAAe,EAAE,EAAE;IACjC,MAAM,QAAQ,GAAG,IAAA,gCAAc,EAAC,UAAU,CAAC,CAAC;IAE5C,UAAU,CAAC,gBAAgB,CACzB,0BAA0B,EAC1B,cAAc,EACd,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { API, Logging } from 'homebridge';
|
|
2
|
+
import { Context, PlatformConfiguration } from './types';
|
|
3
|
+
import { Zone } from './Zone';
|
|
4
|
+
export declare const createPlatform: (homebridge: API) => {
|
|
5
|
+
new (homebridgeLog: Logging, configuration: PlatformConfiguration): {
|
|
6
|
+
context: Context;
|
|
7
|
+
zones: Map<string, Zone>;
|
|
8
|
+
readonly configuration: PlatformConfiguration;
|
|
9
|
+
accessories(callback: any): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
};
|