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
|
@@ -0,0 +1,87 @@
|
|
|
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.createPlatform = void 0;
|
|
13
|
+
const simple_node_logger_1 = require("simple-node-logger");
|
|
14
|
+
const openrgb_sdk_1 = require("openrgb-sdk");
|
|
15
|
+
const helpers_for_homebridge_1 = require("helpers-for-homebridge");
|
|
16
|
+
const palette_kit_core_1 = require("@manganese/palette-kit-core");
|
|
17
|
+
const palette_kit_client_1 = require("@manganese/palette-kit-client");
|
|
18
|
+
const services_1 = require("./services");
|
|
19
|
+
const accessories_1 = require("./accessories");
|
|
20
|
+
const Zone_1 = require("./Zone");
|
|
21
|
+
const constants_1 = require("./constants");
|
|
22
|
+
const createPlatform = (homebridge) => {
|
|
23
|
+
class Platform {
|
|
24
|
+
constructor(homebridgeLog, configuration) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
this.configuration = configuration;
|
|
27
|
+
this.zones = new Map();
|
|
28
|
+
const log = new simple_node_logger_1.Logger({
|
|
29
|
+
level: 'debug',
|
|
30
|
+
appenders: [new helpers_for_homebridge_1.HomebridgeLogAppender(homebridgeLog)],
|
|
31
|
+
});
|
|
32
|
+
const persistence = new services_1.PersistenceService({
|
|
33
|
+
homebridge,
|
|
34
|
+
log,
|
|
35
|
+
});
|
|
36
|
+
const openRgbClient = new openrgb_sdk_1.Client('default', (_a = configuration.openRgbPort) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_OPENRGB_PORT, (_b = configuration.openRgbHost) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_OPENRGB_HOST);
|
|
37
|
+
const palette = new palette_kit_core_1.Palette({}, { log });
|
|
38
|
+
const paletteClient = configuration.paletteClient
|
|
39
|
+
? new palette_kit_client_1.PaletteClient(configuration.paletteClient, {
|
|
40
|
+
log,
|
|
41
|
+
}, palette)
|
|
42
|
+
: null;
|
|
43
|
+
this.context = {
|
|
44
|
+
homebridge,
|
|
45
|
+
openRgbClient,
|
|
46
|
+
palette,
|
|
47
|
+
paletteClient,
|
|
48
|
+
log,
|
|
49
|
+
persistence,
|
|
50
|
+
};
|
|
51
|
+
configuration.zones.forEach((zoneConfiguration) => {
|
|
52
|
+
const zone = new Zone_1.Zone(zoneConfiguration, this.context);
|
|
53
|
+
this.zones.set(zone.id, zone);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
accessories(callback) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
yield this.context.openRgbClient.connect();
|
|
59
|
+
yield this.context.paletteClient.connect();
|
|
60
|
+
yield Promise.all(Array.from(this.zones.values()).map((zone) => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield zone.initialize();
|
|
62
|
+
})));
|
|
63
|
+
const zoneAccessories = Array.from(this.zones.values()).flatMap((zone) => {
|
|
64
|
+
const zoneEffectAccessory = new accessories_1.ZoneEffectAccessory(zone, this.context);
|
|
65
|
+
const zoneBrightnessAccessory = new accessories_1.ZoneBrightnessAccessory(zone, this.context);
|
|
66
|
+
const zoneSceneTransitionAccessory = new accessories_1.ZoneSceneTransitionAccessory(zone, this.context);
|
|
67
|
+
zone.on('updateBrightness', (brightness) => {
|
|
68
|
+
zoneBrightnessAccessory.updateBrightness(brightness);
|
|
69
|
+
});
|
|
70
|
+
zone.on('updateSceneTransitionActive', (sceneTransitionActive) => {
|
|
71
|
+
zoneSceneTransitionAccessory.update(sceneTransitionActive);
|
|
72
|
+
});
|
|
73
|
+
return [
|
|
74
|
+
zoneEffectAccessory,
|
|
75
|
+
zoneBrightnessAccessory,
|
|
76
|
+
zoneSceneTransitionAccessory,
|
|
77
|
+
];
|
|
78
|
+
});
|
|
79
|
+
const accessories = [...zoneAccessories];
|
|
80
|
+
callback(accessories);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return Platform;
|
|
85
|
+
};
|
|
86
|
+
exports.createPlatform = createPlatform;
|
|
87
|
+
//# sourceMappingURL=platformFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platformFactory.js","sourceRoot":"","sources":["../src/platformFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAA4C;AAC5C,6CAAsD;AAEtD,mEAA+D;AAC/D,kEAAsD;AACtD,sEAA8D;AAG9D,yCAAgD;AAChD,+CAIuB;AACvB,iCAA8B;AAC9B,2CAAyE;AAElE,MAAM,cAAc,GAAG,CAAC,UAAe,EAAE,EAAE;IAChD,MAAM,QAAQ;QAIZ,YACE,aAAsB,EACb,aAAoC;;YAApC,kBAAa,GAAb,aAAa,CAAuB;YAJ/C,UAAK,GAAG,IAAI,GAAG,EAA8B,CAAC;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icPersistenceService, Context } from 'helpers-for-homebridge';
|
|
2
|
+
import { PlatformPersistence, ZonePersistence } from '../types';
|
|
3
|
+
export declare class PersistenceService extends BasicPersistenceService<PlatformPersistence> {
|
|
4
|
+
constructor(context: Context);
|
|
5
|
+
getZonePersistence(zoneId: string): Promise<ZonePersistence | null>;
|
|
6
|
+
getZoneActive(zoneId: string): Promise<boolean>;
|
|
7
|
+
getZoneBrightness(zoneId: string): Promise<number>;
|
|
8
|
+
getZoneEffectId(zoneId: string): Promise<string | null>;
|
|
9
|
+
mergeZonePersistence(zoneId: string, zonePersistence: Partial<ZonePersistence>): Promise<void>;
|
|
10
|
+
setZoneActive(zoneId: string, active: boolean): Promise<void>;
|
|
11
|
+
setZoneBrightness(zoneId: string, brightness: number): Promise<void>;
|
|
12
|
+
setZoneEffectId(zoneId: string, effectId: string): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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.PersistenceService = void 0;
|
|
13
|
+
const helpers_for_homebridge_1 = require("helpers-for-homebridge");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
class PersistenceService extends helpers_for_homebridge_1.BasicPersistenceService {
|
|
16
|
+
constructor(context) {
|
|
17
|
+
super({
|
|
18
|
+
fileName: constants_1.DEFAULT_PERSISTENCE_FILENAME,
|
|
19
|
+
defaultValue: {
|
|
20
|
+
zones: {},
|
|
21
|
+
},
|
|
22
|
+
}, context);
|
|
23
|
+
}
|
|
24
|
+
getZonePersistence(zoneId) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const persistence = yield this.readPersistence();
|
|
28
|
+
return (_b = (_a = persistence.zones) === null || _a === void 0 ? void 0 : _a[zoneId]) !== null && _b !== void 0 ? _b : null;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getZoneActive(zoneId) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const zonePersistence = yield this.getZonePersistence(zoneId);
|
|
34
|
+
return (zonePersistence === null || zonePersistence === void 0 ? void 0 : zonePersistence.active) || false;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getZoneBrightness(zoneId) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
var _a;
|
|
40
|
+
const zonePersistence = yield this.getZonePersistence(zoneId);
|
|
41
|
+
return (_a = zonePersistence === null || zonePersistence === void 0 ? void 0 : zonePersistence.brightness) !== null && _a !== void 0 ? _a : 1;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getZoneEffectId(zoneId) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
var _a;
|
|
47
|
+
const zonePersistence = yield this.getZonePersistence(zoneId);
|
|
48
|
+
return (_a = zonePersistence === null || zonePersistence === void 0 ? void 0 : zonePersistence.effectId) !== null && _a !== void 0 ? _a : null;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
mergeZonePersistence(zoneId, zonePersistence) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
yield this.mergePersistence({
|
|
54
|
+
zones: {
|
|
55
|
+
[zoneId]: zonePersistence,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
setZoneActive(zoneId, active) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
yield this.mergeZonePersistence(zoneId, {
|
|
63
|
+
active,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
setZoneBrightness(zoneId, brightness) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
yield this.mergeZonePersistence(zoneId, {
|
|
70
|
+
brightness,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
setZoneEffectId(zoneId, effectId) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
yield this.mergeZonePersistence(zoneId, {
|
|
77
|
+
effectId,
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.PersistenceService = PersistenceService;
|
|
83
|
+
//# sourceMappingURL=PersistenceService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PersistenceService.js","sourceRoot":"","sources":["../../src/services/PersistenceService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAIgC;AAEhC,4CAA4D;AAE5D,MAAa,kBAAmB,SAAQ,gDAA4C;IAClF,YAAY,OAAgB;QAC1B,KAAK,CACH;YACE,QAAQ,EAAE,wCAA4B;YACtC,YAAY,EAAE;gBACZ,KAAK,EAAE,EAAE;aACV;SACF,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAEK,kBAAkB,CAAC,MAAc;;;YACrC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;YAEjD,OAAO,MAAA,MAAA,WAAW,CAAC,KAAK,0CAAG,MAAM,CAAC,mCAAI,IAAI,CAAC;QAC7C,CAAC;KAAA;IAEK,aAAa,CAAC,MAAc;;YAChC,MAAM,eAAe,GAA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,0 +1,18 @@
|
|
|
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("./PersistenceService"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
const openrgb_sdk_1 = require("openrgb-sdk");
|
|
13
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const openRgbClient = new openrgb_sdk_1.Client('default', 6742, 'living-room-node.local.mangane.se');
|
|
15
|
+
yield openRgbClient.connect();
|
|
16
|
+
const openRgbDevices = yield openRgbClient.getAllControllerData();
|
|
17
|
+
console.log(openRgbDevices);
|
|
18
|
+
const openRgbDevice = openRgbDevices.find((openRgbDevice) => openRgbDevice.serial.replace(/\s+$/g, '') === '282039U09401607');
|
|
19
|
+
console.log(JSON.stringify(openRgbDevices[0].serial));
|
|
20
|
+
console.log(JSON.stringify(openRgbDevices[0].serial.replace(/\s/g, '')));
|
|
21
|
+
console.log(openRgbDevice);
|
|
22
|
+
// openRgbClient.updateLeds(
|
|
23
|
+
// openRgbDevice.deviceId,
|
|
24
|
+
// openRgbDevice.colors.map((color, index) => {
|
|
25
|
+
// if (index !== 8) return color;
|
|
26
|
+
// return {
|
|
27
|
+
// red: 255,
|
|
28
|
+
// green: 0,
|
|
29
|
+
// blue: 255,
|
|
30
|
+
// };
|
|
31
|
+
// })
|
|
32
|
+
// );
|
|
33
|
+
// // const openRgbDevices = await Promise.all(
|
|
34
|
+
// // openRgbClient.getAllControllerData()
|
|
35
|
+
// // );
|
|
36
|
+
// // console.log(openRgbDevices);
|
|
37
|
+
}))();
|
|
38
|
+
//# sourceMappingURL=test.js.map
|
package/dist/test.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6CAAsD;AAEtD,CAAC,GAAS,EAAE;IACV,MAAM,aAAa,GAAG,IAAI,oBAAa,CACrC,SAAS,EACT,IAAI,EACJ,mCAAmC,CACpC,CAAC;IAEF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;IAE9B,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,oBAAoB,EAAE,CAAC;IAElE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC5B,MAAM,aAAa,GAAI,cAAsB,CAAC,IAAI,CAChD,CAAC,aAAa,EAAE,EAAE,CACf,aAAqB,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,iBAAiB,CAC3E,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAE,cAAc,CAAC,CAAC,CAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAE,cAAc,CAAC,CAAC,CAAS,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CACrE,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAE3B,4BAA4B;IAC5B,4BAA4B;IAC5B,iDAAiD;IACjD,qCAAqC;IAErC,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,SAAS;IACT,OAAO;IACP,KAAK;IAEL,+CAA+C;IAC/C,4CAA4C;IAC5C,QAAQ;IAER,kCAAkC;AACpC,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { API } from 'homebridge';
|
|
2
|
+
import { Logger } from 'simple-node-logger';
|
|
3
|
+
import OpenRGBClient from 'openrgb-sdk/types/client';
|
|
4
|
+
import { PaletteClient } from '@manganese/palette-kit-client';
|
|
5
|
+
import { Palette } from '@manganese/palette-kit-core';
|
|
6
|
+
import { PersistenceService } from '../services';
|
|
7
|
+
export interface Context {
|
|
8
|
+
homebridge: API;
|
|
9
|
+
openRgbClient: OpenRGBClient;
|
|
10
|
+
palette: Palette;
|
|
11
|
+
paletteClient: PaletteClient | null;
|
|
12
|
+
log: Logger;
|
|
13
|
+
persistence: PersistenceService;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurationVector2.js","sourceRoot":"","sources":["../../../src/types/configuration/ConfigurationVector2.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceConfiguration.js","sourceRoot":"","sources":["../../../src/types/configuration/DeviceConfiguration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ClientConfiguration } from '@manganese/palette-kit-client';
|
|
2
|
+
import { ZoneConfiguration } from '.';
|
|
3
|
+
export interface PlatformConfiguration {
|
|
4
|
+
discoveryInterval?: number;
|
|
5
|
+
networkInterfaces?: string[];
|
|
6
|
+
openRgbHost: string;
|
|
7
|
+
openRgbPort: number;
|
|
8
|
+
paletteClient?: ClientConfiguration;
|
|
9
|
+
zones: ZoneConfiguration[];
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../src/types/configuration/PlatformConfiguration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentConfiguration.js","sourceRoot":"","sources":["../../../src/types/configuration/SegmentConfiguration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ZoneConfiguration as EffectKitZoneConfiguration } from '@manganese/effect-kit';
|
|
2
|
+
import { DeviceConfiguration } from './DeviceConfiguration';
|
|
3
|
+
export interface ZoneConfiguration extends EffectKitZoneConfiguration {
|
|
4
|
+
trueOff?: boolean;
|
|
5
|
+
devices: DeviceConfiguration[];
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoneConfiguration.js","sourceRoot":"","sources":["../../../src/types/configuration/ZoneConfiguration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
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("./ConfigurationVector2"), exports);
|
|
18
|
+
__exportStar(require("./PlatformConfiguration"), exports);
|
|
19
|
+
__exportStar(require("./ZoneConfiguration"), exports);
|
|
20
|
+
__exportStar(require("./DeviceConfiguration"), exports);
|
|
21
|
+
__exportStar(require("./SegmentConfiguration"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/configuration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,0DAAwC;AACxC,sDAAoC;AACpC,wDAAsC;AACtC,yDAAuC"}
|
|
@@ -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("./configuration"), exports);
|
|
18
|
+
__exportStar(require("./persistence"), exports);
|
|
19
|
+
__exportStar(require("./Context"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,gDAA8B;AAC9B,4CAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformPersistence.js","sourceRoot":"","sources":["../../../src/types/persistence/PlatformPersistence.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZonePersistence.js","sourceRoot":"","sources":["../../../src/types/persistence/ZonePersistence.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./ZonePersistence"), exports);
|
|
18
|
+
__exportStar(require("./PlatformPersistence"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/persistence/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,wDAAsC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "homebridge-openrgb-multi",
|
|
3
|
+
"displayName": "Homebridge OpenRGB Multi",
|
|
4
|
+
"description": "Homebridge plugin for multi-color dynamic effects for OpenRGB",
|
|
5
|
+
"version": "6.4.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"homebridge-plugin"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://gitlab.com/5131/homebridge-openrgb-multi#readme",
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "Samuel Goodell"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://gitlab.com/5131/homebridge-openrgb-multi/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+ssh://git@gitlab.com/5131/homebridge-openrgb-multi.git"
|
|
19
|
+
},
|
|
20
|
+
"deprecated": false,
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": "^18.17.0 || ^20 || ^22",
|
|
23
|
+
"homebridge": "^1.6.0"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"clean": "rm -rf dist node_modules package-lock.json",
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"build:development": "NODE_ENV=development tsc",
|
|
29
|
+
"build:production": "NODE_ENV=production tsc"
|
|
30
|
+
},
|
|
31
|
+
"main": "dist/index.js",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@manganese/core-kit-node": "^3.0",
|
|
34
|
+
"@manganese/effect-kit": "^2.0.0",
|
|
35
|
+
"@manganese/palette-kit-client": "^4.2.1",
|
|
36
|
+
"@manganese/palette-kit-core": "^4.2.1",
|
|
37
|
+
"helpers-for-homebridge": "^4.4.0",
|
|
38
|
+
"lodash": "^4.17.21",
|
|
39
|
+
"openrgb-sdk": "^0.5.2",
|
|
40
|
+
"rwlock": "^5.0.0",
|
|
41
|
+
"simple-node-logger": "^21",
|
|
42
|
+
"three": "^0.167.1"
|
|
43
|
+
},
|
|
44
|
+
"prettier": "@manganese/prettier-configuration",
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@manganese/prettier-configuration": "^1.0.5",
|
|
47
|
+
"@types/node": "^18.17.0",
|
|
48
|
+
"@types/rwlock": "^5.0.3",
|
|
49
|
+
"homebridge": "^1.6.0",
|
|
50
|
+
"prettier": "^3.1.1",
|
|
51
|
+
"typescript": "^5.3.3"
|
|
52
|
+
}
|
|
53
|
+
}
|