@silizia/homebridge-dioder 0.1.1 → 0.1.3

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/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import lg from "lgpio";
2
2
  import { colord } from "colord";
3
3
  //#region src/DioderAccessory.ts
4
- const MIN_PWM = 31.4995 / 8e3;
4
+ const MIN_PWM = .5;
5
+ const PWM_FREQUENCY = 1e4;
5
6
  const GAMMA_COR = 2.8;
6
7
  var DioderAccessory = class {
7
8
  hsv;
@@ -18,7 +19,9 @@ var DioderAccessory = class {
18
19
  this.Characteristic = hap.Characteristic;
19
20
  this.log = platform.log;
20
21
  this.config = accessory.context.config;
21
- this.pwm(0, 0, 0);
22
+ lg.gpioClaimOutput(gpiochip, this.config.rPin);
23
+ lg.gpioClaimOutput(gpiochip, this.config.gPin);
24
+ lg.gpioClaimOutput(gpiochip, this.config.bPin);
22
25
  this.hsv = {
23
26
  h: 0,
24
27
  s: 0,
@@ -47,10 +50,10 @@ var DioderAccessory = class {
47
50
  }, 1e3);
48
51
  this.log.info("Identify!");
49
52
  }
50
- pwm(r, b, g) {
51
- lg.txPwm(this.gpiochip, this.config.rPin, 8e3, r, 0, 0);
52
- lg.txPwm(this.gpiochip, this.config.gPin, 8e3, g, 0, 0);
53
- lg.txPwm(this.gpiochip, this.config.bPin, 8e3, b, 0, 0);
53
+ pwm(r, g, b) {
54
+ lg.txPwm(this.gpiochip, this.config.rPin, PWM_FREQUENCY, r, 0, 0);
55
+ lg.txPwm(this.gpiochip, this.config.gPin, PWM_FREQUENCY, g, 0, 0);
56
+ lg.txPwm(this.gpiochip, this.config.bPin, PWM_FREQUENCY, b, 0, 0);
54
57
  }
55
58
  setOn(on) {
56
59
  this.log.info("setOn", on);
@@ -94,7 +97,7 @@ var DioderAccessory = class {
94
97
  setHSV(c, t) {
95
98
  if (t || this.on && this.getBrightness() > 0) {
96
99
  const { r, g, b } = colord(c).toRgb();
97
- this.pwm(Math.round((r / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM), Math.round((g / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM), Math.round((b / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM));
100
+ this.pwm(Math.round((r / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM), Math.round((g / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM), Math.round((b / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM));
98
101
  if (!t) this.log.info(`set ${this.accessory.displayName} RGB to ${r}, ${g}, ${b}`);
99
102
  } else this.log.warn("Skipping color change while light bulb being off");
100
103
  }
@@ -102,7 +105,7 @@ var DioderAccessory = class {
102
105
  return this.hsv;
103
106
  }
104
107
  setRGB(r, g, b) {
105
- this.pwm(Math.round((r / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM), Math.round((g / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM), Math.round((b / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM));
108
+ this.pwm(Math.round((r / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM), Math.round((g / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM), Math.round((b / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM));
106
109
  }
107
110
  turnOff() {
108
111
  this.pwm(0, 0, 0);
@@ -265,6 +268,7 @@ var RainbowAccessory = class extends AnimatedAccessory {
265
268
  };
266
269
  //#endregion
267
270
  //#region src/DioderPlatform.ts
271
+ const PLUGIN_NAME = "@silizia/homebridge-dioder";
268
272
  var DioderPlatform = class {
269
273
  accessories = [];
270
274
  animationCancel = void 0;
@@ -290,7 +294,7 @@ var DioderPlatform = class {
290
294
  const accessory = new this.api.platformAccessory(c.name, uuid);
291
295
  accessory.context.config = c;
292
296
  dioderAccessories.push(new DioderAccessory(this, accessory, gpiochip));
293
- this.api.registerPlatformAccessories("homebridge-dioder", "Dioder", [accessory]);
297
+ this.api.registerPlatformAccessories(PLUGIN_NAME, "Dioder", [accessory]);
294
298
  }
295
299
  }
296
300
  if (this.config.rainbowAnim?.enabled) {
@@ -304,7 +308,7 @@ var DioderPlatform = class {
304
308
  this.log.info("Adding new accessory: Rainbow Effect");
305
309
  const accessory = new this.api.platformAccessory("Rainbow Effect", uuid);
306
310
  new RainbowAccessory(this, accessory, dioderAccessories);
307
- this.api.registerPlatformAccessories("homebridge-dioder", "Dioder", [accessory]);
311
+ this.api.registerPlatformAccessories(PLUGIN_NAME, "Dioder", [accessory]);
308
312
  }
309
313
  }
310
314
  for (const c of this.config.gradientAnim || []) {
@@ -319,12 +323,12 @@ var DioderPlatform = class {
319
323
  const accessory = new this.api.platformAccessory(c.name, uuid);
320
324
  accessory.context.config = c;
321
325
  new GradientAccessory(this, accessory, dioderAccessories);
322
- this.api.registerPlatformAccessories("homebridge-dioder", "Dioder", [accessory]);
326
+ this.api.registerPlatformAccessories(PLUGIN_NAME, "Dioder", [accessory]);
323
327
  }
324
328
  }
325
329
  if (removedAccessories.length > 0) {
326
330
  this.log.warn("removing unused accessories", removedAccessories.map((a) => a.displayName));
327
- this.api.unregisterPlatformAccessories("homebridge-dioder", "Dioder", removedAccessories);
331
+ this.api.unregisterPlatformAccessories(PLUGIN_NAME, "Dioder", removedAccessories);
328
332
  }
329
333
  });
330
334
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/DioderAccessory.ts","../src/AnimatedAccessory.ts","../src/GradientAccessory.ts","../src/RainbowAccessory.ts","../src/DioderPlatform.ts","../src/index.ts"],"sourcesContent":["import { colord, type HsvColor } from 'colord';\nimport type { CharacteristicValue, PlatformAccessory, Service, Logging } from 'homebridge';\nimport lg from 'lgpio';\n\nimport type DioderPlatform from './DioderPlatform';\nimport type { DioderContext, LedConfig } from './DioderPlatform';\n\nconst MIN_PWM = 31.4995 / 8000; // min pwm to get actually light from dioder, depends on PWM_RANGE\nconst GAMMA_COR = 2.8;\n\nexport default class DioderAccessory {\n private readonly hsv: HsvColor;\n private on: boolean;\n\n private readonly LEDservice: Service;\n private readonly Characteristic;\n private readonly log: Logging;\n private readonly config: LedConfig;\n\n constructor(\n private readonly platform: DioderPlatform,\n private readonly accessory: PlatformAccessory<DioderContext>,\n private readonly gpiochip: number\n ) {\n const { hap } = platform.api;\n this.Characteristic = hap.Characteristic;\n this.log = platform.log;\n\n this.config = accessory.context.config;\n this.pwm(0, 0, 0);\n this.hsv = { h: 0, s: 0, v: 0 };\n this.on = false;\n\n this.accessory\n .getService(hap.Service.AccessoryInformation)\n ?.setCharacteristic(this.Characteristic.Manufacturer, 'Silizia')\n .setCharacteristic(this.Characteristic.Model, 'Fancy LED')\n .setCharacteristic(this.Characteristic.SerialNumber, '42');\n\n this.accessory.on('identify', () => this.identify());\n\n this.LEDservice = this.accessory.getService(hap.Service.Lightbulb) || this.accessory.addService(hap.Service.Lightbulb);\n this.LEDservice.setCharacteristic(this.Characteristic.Name, this.config.name);\n\n this.LEDservice.getCharacteristic(this.Characteristic.On).onGet(this.getOn.bind(this)).onSet(this.setOn.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Brightness).onGet(this.getBrightness.bind(this)).onSet(this.setBrightness.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Hue).onGet(this.getHue.bind(this)).onSet(this.setHue.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Saturation).onGet(this.getSaturation.bind(this)).onSet(this.setSaturation.bind(this));\n }\n\n identify(): void {\n this.pwm(0, 0, 0);\n setTimeout(() => {\n this.pwm(1, 0, 0);\n setTimeout(() => {\n this.pwm(0, 0, 0);\n if (this.getBrightness() > 0) {\n setTimeout(() => {\n this.setHSV(this.hsv);\n }, 1000);\n }\n }, 3000);\n }, 1000);\n this.log.info('Identify!');\n }\n\n pwm(r: number, b: number, g: number): void {\n lg.txPwm(this.gpiochip, this.config.rPin, 8000, r, 0, 0);\n lg.txPwm(this.gpiochip, this.config.gPin, 8000, g, 0, 0);\n lg.txPwm(this.gpiochip, this.config.bPin, 8000, b, 0, 0);\n }\n\n setOn(on: CharacteristicValue): void {\n this.log.info('setOn', on);\n this.on = on as boolean;\n if (on) {\n this.platform.stopAnimation();\n if (this.getBrightness() === 0) {\n this.hsv.v = 100;\n this.LEDservice.setCharacteristic(this.Characteristic.Brightness, 100);\n } else {\n this.setHSV(this.hsv);\n }\n } else {\n this.pwm(0, 0, 0);\n }\n }\n\n getOn(): boolean {\n if (this.platform.isAnimationRunning()) return false;\n return this.getBrightness() > 0;\n }\n\n setBrightness(v: CharacteristicValue): void {\n this.log.info('setBrightness', v);\n this.hsv.v = v as number;\n this.setHSV(this.hsv);\n }\n\n getBrightness(): number {\n return this.hsv.v;\n }\n\n setHue(h: CharacteristicValue): void {\n this.log.info('setHue', h);\n this.hsv.h = h as number;\n this.setHSV(this.hsv);\n }\n\n getHue(): number {\n return this.hsv.h;\n }\n\n setSaturation(s: CharacteristicValue): void {\n this.log.info('setSaturation', s);\n this.hsv.s = s as number;\n this.setHSV(this.hsv);\n }\n\n getSaturation(): number {\n return this.hsv.s;\n }\n\n setHSV(c: HsvColor, t?: boolean): void {\n if (t || (this.on && this.getBrightness() > 0)) {\n const { r, g, b } = colord(c).toRgb();\n this.pwm(\n Math.round((r / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM),\n Math.round((g / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM),\n Math.round((b / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM)\n );\n if (!t) this.log.info(`set ${this.accessory.displayName} RGB to ${r}, ${g}, ${b}`);\n } else {\n this.log.warn('Skipping color change while light bulb being off');\n }\n }\n\n getHSV(): HsvColor {\n return this.hsv;\n }\n\n setRGB(r: number, g: number, b: number): void {\n this.pwm(\n Math.round((r / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM),\n Math.round((g / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM),\n Math.round((b / 255) ** GAMMA_COR * (1 - MIN_PWM) + MIN_PWM)\n );\n }\n\n turnOff(): void {\n this.pwm(0, 0, 0);\n }\n}\n","import type { PlatformAccessory, CharacteristicValue, Service, Logging } from 'homebridge';\n\nimport type DioderAccessory from './DioderAccessory';\nimport type DioderPlatform from './DioderPlatform';\n\nconst INTERVAL = 1000 / 30; // 30 FPS\nconst SPEED = 100; // 1..100 => 0.01..1\nconst OFFSET_CT = 5; // 140..500 => 28..100\n\nexport default class AnimatedAccessory {\n public brightness: number;\n public offset: number;\n public speed: number;\n private on: boolean;\n private onS: boolean;\n private interval: NodeJS.Timeout | undefined;\n\n private readonly LEDservice: Service;\n private readonly FanService: Service;\n private readonly Characteristic;\n public readonly log: Logging;\n\n constructor(\n private readonly platform: DioderPlatform,\n private readonly accessory: PlatformAccessory,\n public readonly leds: DioderAccessory[],\n name: string\n ) {\n const { hap } = this.platform.api;\n this.Characteristic = hap.Characteristic;\n this.log = this.platform.log;\n\n this.on = false;\n this.onS = false;\n this.brightness = 0;\n this.offset = 50;\n this.speed = 0.5;\n this.interval = undefined;\n\n this.accessory\n .getService(hap.Service.AccessoryInformation)\n ?.setCharacteristic(this.Characteristic.Manufacturer, 'Silizia')\n .setCharacteristic(this.Characteristic.Model, 'Fancy LED')\n .setCharacteristic(this.Characteristic.SerialNumber, '42');\n\n this.accessory.on('identify', () => this.identify());\n\n this.LEDservice = this.accessory.getService(hap.Service.Lightbulb) || this.accessory.addService(hap.Service.Lightbulb);\n this.LEDservice.setCharacteristic(this.Characteristic.Name, name);\n this.LEDservice.getCharacteristic(this.Characteristic.On).onGet(this.getOn.bind(this)).onSet(this.setOn.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Brightness).onGet(this.getBrightness.bind(this)).onSet(this.setBrightness.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.ColorTemperature)\n .onGet(this.getColorTemperature.bind(this))\n .onSet(this.setColorTemperature.bind(this));\n\n this.FanService = this.accessory.getService(hap.Service.Fan) || this.accessory.addService(hap.Service.Fan);\n this.FanService.setCharacteristic(this.Characteristic.Name, `${name} Speed`);\n this.FanService.getCharacteristic(this.Characteristic.On).onGet(this.getOnS.bind(this)).onSet(this.setOnS.bind(this));\n this.FanService.getCharacteristic(this.Characteristic.RotationSpeed).onGet(this.getSpeed.bind(this)).onSet(this.setSpeed.bind(this));\n }\n\n identify(): void {\n this.log.info('Identify!');\n }\n\n setOn(on: CharacteristicValue): void {\n this.log.info(`rainbow setOn`, on);\n this.on = on as boolean;\n if (on) {\n if (this.getBrightness() === 0) {\n this.LEDservice.setCharacteristic(this.Characteristic.Brightness, 100);\n }\n this.FanService.updateCharacteristic(this.Characteristic.On, true);\n this.onS = true;\n if (this.getSpeed() === 0) {\n this.FanService.setCharacteristic(this.Characteristic.RotationSpeed, 50);\n }\n this.interval = setInterval(() => this.runAnimation(), INTERVAL);\n this.platform.setAnimationCancel(this.cancelAnimation.bind(this));\n } else {\n this.FanService.updateCharacteristic(this.Characteristic.On, false);\n this.onS = false;\n clearInterval(this.interval);\n this.interval = undefined;\n for (const led of this.leds) led.turnOff();\n }\n }\n\n getOn(): boolean {\n return this.on;\n }\n\n setOnS(on: CharacteristicValue): void {\n this.log.info('rainbow setOnS', on);\n this.onS = on as boolean;\n if (on) {\n if (this.getSpeed() === 0) {\n this.FanService.setCharacteristic(this.Characteristic.RotationSpeed, 50);\n }\n this.interval = setInterval(() => this.runAnimation(), INTERVAL);\n this.LEDservice.updateCharacteristic(this.Characteristic.On, true);\n this.on = true;\n if (this.getBrightness() === 0) {\n this.LEDservice.setCharacteristic(this.Characteristic.Brightness, 100);\n }\n this.platform.setAnimationCancel(this.cancelAnimation.bind(this));\n } else {\n clearInterval(this.interval);\n this.interval = undefined;\n }\n }\n\n getOnS(): boolean {\n return this.onS; // interval running\n }\n\n setBrightness(v: CharacteristicValue): void {\n this.log.info('rainbow setBrightness', v);\n this.brightness = v as number;\n }\n\n getBrightness(): number {\n return this.brightness;\n }\n\n setColorTemperature(v: CharacteristicValue): void {\n this.log.info('rainbow setColorTemperature', v);\n this.offset = (v as number) / OFFSET_CT;\n }\n\n getColorTemperature(): number {\n return this.offset * OFFSET_CT;\n }\n\n setSpeed(v: CharacteristicValue): void {\n this.log.info('rainbow speed', v);\n this.speed = (v as number) / SPEED;\n }\n\n getSpeed(): number {\n return this.speed * SPEED;\n }\n\n // oxlint-disable-next-line class-methods-use-this, no-empty-function\n runAnimation(): void {}\n\n cancelAnimation(): void {\n clearInterval(this.interval);\n this.interval = undefined;\n this.LEDservice.updateCharacteristic(this.Characteristic.On, false);\n this.FanService.updateCharacteristic(this.Characteristic.On, false);\n }\n}\n","import { colord, type RgbColor } from 'colord';\nimport type { PlatformAccessory } from 'homebridge';\n\nimport AnimatedAccessory from './AnimatedAccessory';\nimport type DioderAccessory from './DioderAccessory';\nimport type DioderPlatform from './DioderPlatform';\nimport type { GradiantContext } from './DioderPlatform';\n\nexport default class GradientAccessory extends AnimatedAccessory {\n private currentStep: number;\n private readonly colors: RgbColor[];\n\n constructor(platform: DioderPlatform, accessory: PlatformAccessory<GradiantContext>, leds: DioderAccessory[]) {\n super(platform, accessory, leds, accessory.context.config.name);\n this.currentStep = 0;\n this.colors = accessory.context.config.colors.map((c: string) => colord(c).toRgb());\n }\n\n runAnimation(): void {\n const len = this.leds.length;\n for (let i = 0; i < len; i++) {\n const step = this.currentStep + (i * this.offset) / 50;\n const prevColor = Math.floor(step) % len;\n const nextColor = (prevColor + 1) % len;\n const prog = step % 1;\n const r = this.colors[prevColor].r * (1 - prog) + this.colors[nextColor].r * prog;\n const g = this.colors[prevColor].g * (1 - prog) + this.colors[nextColor].g * prog;\n const b = this.colors[prevColor].b * (1 - prog) + this.colors[nextColor].b * prog;\n this.leds[i].setRGB((r * this.brightness) / 100, (g * this.brightness) / 100, (b * this.brightness) / 100);\n }\n this.currentStep = (this.currentStep + (this.speed * len) / 360) % len;\n }\n}\n","import type { PlatformAccessory } from 'homebridge';\n\nimport AnimatedAccessory from './AnimatedAccessory';\nimport type DioderAccessory from './DioderAccessory';\nimport type DioderPlatform from './DioderPlatform';\n\nconst SATURATION = 100;\n\nexport default class RainbowAccessory extends AnimatedAccessory {\n private currentHue: number;\n\n constructor(platform: DioderPlatform, accessory: PlatformAccessory, leds: DioderAccessory[]) {\n super(platform, accessory, leds, 'Rainbow Effect');\n this.currentHue = 0;\n }\n\n runAnimation(): void {\n //this.log.warn(`currentHue: ${this.currentHue}, offset: ${this.offset}, speed: ${this.speed}`);\n for (let i = 0; i < this.leds.length; i++) {\n this.leds[i].setHSV({ h: (this.currentHue + i * this.offset) % 360, s: SATURATION, v: this.brightness }, true);\n }\n this.currentHue = (this.currentHue + this.speed) % 360;\n }\n}\n","import type { PlatformAccessory, API, Logging, PlatformConfig, DynamicPlatformPlugin } from 'homebridge';\nimport lg from 'lgpio';\n\nimport DioderAccessory from './DioderAccessory';\nimport GradientAccessory from './GradientAccessory';\nimport RainbowAccessory from './RainbowAccessory';\n\nexport interface LedConfig {\n name: string;\n rPin: number;\n gPin: number;\n bPin: number;\n}\n\ninterface GradiantConfig {\n name: string;\n colors: string[];\n}\n\ninterface DioderConfig extends PlatformConfig {\n leds: LedConfig[];\n gradientAnim: GradiantConfig[];\n rainbowAnim: { enabled: boolean };\n}\n\nexport interface DioderContext {\n config: LedConfig;\n}\n\nexport interface GradiantContext {\n config: GradiantConfig;\n}\n\nexport default class DioderPlatform implements DynamicPlatformPlugin {\n public readonly accessories: PlatformAccessory[] = [];\n public animationCancel?: () => void = undefined;\n\n constructor(\n public readonly log: Logging,\n public readonly config: DioderConfig,\n public readonly api: API\n ) {\n this.log.debug('Finished initializing platform: Dioder');\n this.api.on('didFinishLaunching', () => {\n this.log.debug('Executed didFinishLaunching callback');\n let removedAccessories = this.accessories;\n // DioderAccessories\n const dioderAccessories: DioderAccessory[] = [];\n const gpiochip = lg.gpiochipOpen(0);\n for (const c of this.config.leds || []) {\n const uuid = this.api.hap.uuid.generate(JSON.stringify(c));\n const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid) as PlatformAccessory<DioderContext>;\n if (existingAccessory) {\n removedAccessories = removedAccessories.filter(accessory => accessory.UUID !== uuid);\n this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);\n dioderAccessories.push(new DioderAccessory(this, existingAccessory, gpiochip));\n } else {\n this.log.info('Adding new accessory:', c.name);\n const accessory = new this.api.platformAccessory<DioderContext>(c.name, uuid);\n accessory.context.config = c;\n dioderAccessories.push(new DioderAccessory(this, accessory, gpiochip));\n this.api.registerPlatformAccessories('homebridge-dioder', 'Dioder', [accessory]);\n }\n }\n // RainbowAccessory\n if (this.config.rainbowAnim?.enabled) {\n const uuid = this.api.hap.uuid.generate('Rainbow Effect');\n const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);\n if (existingAccessory) {\n removedAccessories = removedAccessories.filter(accessory => accessory.UUID !== uuid);\n this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);\n // oxlint-disable-next-line no-new\n new RainbowAccessory(this, existingAccessory, dioderAccessories);\n } else {\n this.log.info('Adding new accessory: Rainbow Effect');\n const accessory = new this.api.platformAccessory('Rainbow Effect', uuid);\n // oxlint-disable-next-line no-new\n new RainbowAccessory(this, accessory, dioderAccessories);\n this.api.registerPlatformAccessories('homebridge-dioder', 'Dioder', [accessory]);\n }\n }\n // GradientAccessory\n for (const c of this.config.gradientAnim || []) {\n const uuid = this.api.hap.uuid.generate(JSON.stringify(c));\n const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid) as PlatformAccessory<GradiantContext>;\n if (existingAccessory) {\n removedAccessories = removedAccessories.filter(accessory => accessory.UUID !== uuid);\n this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);\n // oxlint-disable-next-line no-new\n new GradientAccessory(this, existingAccessory, dioderAccessories);\n } else {\n this.log.info('Adding new gradient accessory:', c.name);\n const accessory = new this.api.platformAccessory<GradiantContext>(c.name, uuid);\n accessory.context.config = c;\n // oxlint-disable-next-line no-new\n new GradientAccessory(this, accessory, dioderAccessories);\n this.api.registerPlatformAccessories('homebridge-dioder', 'Dioder', [accessory]);\n }\n }\n // removed unused Accessories\n if (removedAccessories.length > 0) {\n this.log.warn(\n 'removing unused accessories',\n removedAccessories.map(a => a.displayName)\n );\n this.api.unregisterPlatformAccessories('homebridge-dioder', 'Dioder', removedAccessories);\n }\n });\n }\n\n configureAccessory(accessory: PlatformAccessory): void {\n this.log.info('Loading accessory from cache:', accessory.displayName);\n this.accessories.push(accessory);\n }\n\n // oxlint-disable-next-line promise/prefer-await-to-callbacks\n setAnimationCancel(callback: () => void): void {\n if (this.animationCancel !== undefined) {\n (this.animationCancel as () => void)();\n }\n this.animationCancel = callback;\n }\n\n isAnimationRunning(): boolean {\n return this.animationCancel !== undefined;\n }\n\n stopAnimation(): void {\n if (this.animationCancel !== undefined) {\n (this.animationCancel as () => void)();\n this.animationCancel = undefined;\n }\n }\n}\n","import type { API } from 'homebridge';\n\nimport DioderPlatform from './DioderPlatform';\n\nexport default function main(api: API): void {\n api.registerPlatform('Dioder', DioderPlatform);\n}\n"],"mappings":";;;AAOA,MAAM,UAAU,UAAU;AAC1B,MAAM,YAAY;AAElB,IAAqB,kBAArB,MAAqC;CACnC;CACA;CAEA;CACA;CACA;CACA;CAEA,YACE,UACA,WACA,UACA;AAHiB,OAAA,WAAA;AACA,OAAA,YAAA;AACA,OAAA,WAAA;EAEjB,MAAM,EAAE,QAAQ,SAAS;AACzB,OAAK,iBAAiB,IAAI;AAC1B,OAAK,MAAM,SAAS;AAEpB,OAAK,SAAS,UAAU,QAAQ;AAChC,OAAK,IAAI,GAAG,GAAG,EAAE;AACjB,OAAK,MAAM;GAAE,GAAG;GAAG,GAAG;GAAG,GAAG;GAAG;AAC/B,OAAK,KAAK;AAEV,OAAK,UACF,WAAW,IAAI,QAAQ,qBAAqB,EAC3C,kBAAkB,KAAK,eAAe,cAAc,UAAU,CAC/D,kBAAkB,KAAK,eAAe,OAA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AE3F;;CAGJ,mBAAmB,WAAoC;AACrD,OAAK,IAAI,KAAK,iCAAiC,UAAU,YAAY;AACrE,OAAK,YAAY,KAAK,UAAU;;CAIlC,mBAAmB,UAA4B;AAC7C,MAAI,KAAK,oBAAoB,KAAA,EAC1B,MAAK,iBAAgC;AAExC,OAAK,kBAAkB;;CAGzB,qBAA8B;AAC5B,SAAO,KAAK,oBAAoB,KAAA;;CAGlC,gBAAsB;AACpB,MAAI,KAAK,oBAAoB,KAAA,GAAW;AACrC,QAAK,iBAAgC;AACtC,QAAK,kBAAkB,KAAA;;;;;;AC9H7B,SAAwB,KAAK,KAAgB;AAC3C,KAAI,iBAAiB,UAAU,eAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/DioderAccessory.ts","../src/AnimatedAccessory.ts","../src/GradientAccessory.ts","../src/RainbowAccessory.ts","../src/DioderPlatform.ts","../src/index.ts"],"sourcesContent":["import { colord, type HsvColor } from 'colord';\nimport type { CharacteristicValue, PlatformAccessory, Service, Logging } from 'homebridge';\nimport lg from 'lgpio';\n\nimport type DioderPlatform from './DioderPlatform';\nimport type { DioderContext, LedConfig } from './DioderPlatform';\n\nconst MIN_PWM = 0.5; // min pwm to get actually light from dioder, depends on PWM_RANGE\nconst PWM_FREQUENCY = 10000;\nconst GAMMA_COR = 2.8;\n\nexport default class DioderAccessory {\n private readonly hsv: HsvColor;\n private on: boolean;\n\n private readonly LEDservice: Service;\n private readonly Characteristic;\n private readonly log: Logging;\n private readonly config: LedConfig;\n\n constructor(\n private readonly platform: DioderPlatform,\n private readonly accessory: PlatformAccessory<DioderContext>,\n private readonly gpiochip: number\n ) {\n const { hap } = platform.api;\n this.Characteristic = hap.Characteristic;\n this.log = platform.log;\n\n this.config = accessory.context.config;\n lg.gpioClaimOutput(gpiochip, this.config.rPin);\n lg.gpioClaimOutput(gpiochip, this.config.gPin);\n lg.gpioClaimOutput(gpiochip, this.config.bPin);\n this.hsv = { h: 0, s: 0, v: 0 };\n this.on = false;\n\n this.accessory\n .getService(hap.Service.AccessoryInformation)\n ?.setCharacteristic(this.Characteristic.Manufacturer, 'Silizia')\n .setCharacteristic(this.Characteristic.Model, 'Fancy LED')\n .setCharacteristic(this.Characteristic.SerialNumber, '42');\n\n this.accessory.on('identify', () => this.identify());\n\n this.LEDservice = this.accessory.getService(hap.Service.Lightbulb) || this.accessory.addService(hap.Service.Lightbulb);\n this.LEDservice.setCharacteristic(this.Characteristic.Name, this.config.name);\n\n this.LEDservice.getCharacteristic(this.Characteristic.On).onGet(this.getOn.bind(this)).onSet(this.setOn.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Brightness).onGet(this.getBrightness.bind(this)).onSet(this.setBrightness.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Hue).onGet(this.getHue.bind(this)).onSet(this.setHue.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Saturation).onGet(this.getSaturation.bind(this)).onSet(this.setSaturation.bind(this));\n }\n\n identify(): void {\n this.pwm(0, 0, 0);\n setTimeout(() => {\n this.pwm(1, 0, 0);\n setTimeout(() => {\n this.pwm(0, 0, 0);\n if (this.getBrightness() > 0) {\n setTimeout(() => {\n this.setHSV(this.hsv);\n }, 1000);\n }\n }, 3000);\n }, 1000);\n this.log.info('Identify!');\n }\n\n pwm(r: number, g: number, b: number): void {\n lg.txPwm(this.gpiochip, this.config.rPin, PWM_FREQUENCY, r, 0, 0);\n lg.txPwm(this.gpiochip, this.config.gPin, PWM_FREQUENCY, g, 0, 0);\n lg.txPwm(this.gpiochip, this.config.bPin, PWM_FREQUENCY, b, 0, 0);\n }\n\n setOn(on: CharacteristicValue): void {\n this.log.info('setOn', on);\n this.on = on as boolean;\n if (on) {\n this.platform.stopAnimation();\n if (this.getBrightness() === 0) {\n this.hsv.v = 100;\n this.LEDservice.setCharacteristic(this.Characteristic.Brightness, 100);\n } else {\n this.setHSV(this.hsv);\n }\n } else {\n this.pwm(0, 0, 0);\n }\n }\n\n getOn(): boolean {\n if (this.platform.isAnimationRunning()) return false;\n return this.getBrightness() > 0;\n }\n\n setBrightness(v: CharacteristicValue): void {\n this.log.info('setBrightness', v);\n this.hsv.v = v as number;\n this.setHSV(this.hsv);\n }\n\n getBrightness(): number {\n return this.hsv.v;\n }\n\n setHue(h: CharacteristicValue): void {\n this.log.info('setHue', h);\n this.hsv.h = h as number;\n this.setHSV(this.hsv);\n }\n\n getHue(): number {\n return this.hsv.h;\n }\n\n setSaturation(s: CharacteristicValue): void {\n this.log.info('setSaturation', s);\n this.hsv.s = s as number;\n this.setHSV(this.hsv);\n }\n\n getSaturation(): number {\n return this.hsv.s;\n }\n\n setHSV(c: HsvColor, t?: boolean): void {\n if (t || (this.on && this.getBrightness() > 0)) {\n const { r, g, b } = colord(c).toRgb();\n this.pwm(\n Math.round((r / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM),\n Math.round((g / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM),\n Math.round((b / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM)\n );\n if (!t) this.log.info(`set ${this.accessory.displayName} RGB to ${r}, ${g}, ${b}`);\n } else {\n this.log.warn('Skipping color change while light bulb being off');\n }\n }\n\n getHSV(): HsvColor {\n return this.hsv;\n }\n\n setRGB(r: number, g: number, b: number): void {\n this.pwm(\n Math.round((r / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM),\n Math.round((g / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM),\n Math.round((b / 255) ** GAMMA_COR * (100 - MIN_PWM) + MIN_PWM)\n );\n }\n\n turnOff(): void {\n this.pwm(0, 0, 0);\n }\n}\n","import type { PlatformAccessory, CharacteristicValue, Service, Logging } from 'homebridge';\n\nimport type DioderAccessory from './DioderAccessory';\nimport type DioderPlatform from './DioderPlatform';\n\nconst INTERVAL = 1000 / 30; // 30 FPS\nconst SPEED = 100; // 1..100 => 0.01..1\nconst OFFSET_CT = 5; // 140..500 => 28..100\n\nexport default class AnimatedAccessory {\n public brightness: number;\n public offset: number;\n public speed: number;\n private on: boolean;\n private onS: boolean;\n private interval: NodeJS.Timeout | undefined;\n\n private readonly LEDservice: Service;\n private readonly FanService: Service;\n private readonly Characteristic;\n public readonly log: Logging;\n\n constructor(\n private readonly platform: DioderPlatform,\n private readonly accessory: PlatformAccessory,\n public readonly leds: DioderAccessory[],\n name: string\n ) {\n const { hap } = this.platform.api;\n this.Characteristic = hap.Characteristic;\n this.log = this.platform.log;\n\n this.on = false;\n this.onS = false;\n this.brightness = 0;\n this.offset = 50;\n this.speed = 0.5;\n this.interval = undefined;\n\n this.accessory\n .getService(hap.Service.AccessoryInformation)\n ?.setCharacteristic(this.Characteristic.Manufacturer, 'Silizia')\n .setCharacteristic(this.Characteristic.Model, 'Fancy LED')\n .setCharacteristic(this.Characteristic.SerialNumber, '42');\n\n this.accessory.on('identify', () => this.identify());\n\n this.LEDservice = this.accessory.getService(hap.Service.Lightbulb) || this.accessory.addService(hap.Service.Lightbulb);\n this.LEDservice.setCharacteristic(this.Characteristic.Name, name);\n this.LEDservice.getCharacteristic(this.Characteristic.On).onGet(this.getOn.bind(this)).onSet(this.setOn.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.Brightness).onGet(this.getBrightness.bind(this)).onSet(this.setBrightness.bind(this));\n this.LEDservice.getCharacteristic(this.Characteristic.ColorTemperature)\n .onGet(this.getColorTemperature.bind(this))\n .onSet(this.setColorTemperature.bind(this));\n\n this.FanService = this.accessory.getService(hap.Service.Fan) || this.accessory.addService(hap.Service.Fan);\n this.FanService.setCharacteristic(this.Characteristic.Name, `${name} Speed`);\n this.FanService.getCharacteristic(this.Characteristic.On).onGet(this.getOnS.bind(this)).onSet(this.setOnS.bind(this));\n this.FanService.getCharacteristic(this.Characteristic.RotationSpeed).onGet(this.getSpeed.bind(this)).onSet(this.setSpeed.bind(this));\n }\n\n identify(): void {\n this.log.info('Identify!');\n }\n\n setOn(on: CharacteristicValue): void {\n this.log.info(`rainbow setOn`, on);\n this.on = on as boolean;\n if (on) {\n if (this.getBrightness() === 0) {\n this.LEDservice.setCharacteristic(this.Characteristic.Brightness, 100);\n }\n this.FanService.updateCharacteristic(this.Characteristic.On, true);\n this.onS = true;\n if (this.getSpeed() === 0) {\n this.FanService.setCharacteristic(this.Characteristic.RotationSpeed, 50);\n }\n this.interval = setInterval(() => this.runAnimation(), INTERVAL);\n this.platform.setAnimationCancel(this.cancelAnimation.bind(this));\n } else {\n this.FanService.updateCharacteristic(this.Characteristic.On, false);\n this.onS = false;\n clearInterval(this.interval);\n this.interval = undefined;\n for (const led of this.leds) led.turnOff();\n }\n }\n\n getOn(): boolean {\n return this.on;\n }\n\n setOnS(on: CharacteristicValue): void {\n this.log.info('rainbow setOnS', on);\n this.onS = on as boolean;\n if (on) {\n if (this.getSpeed() === 0) {\n this.FanService.setCharacteristic(this.Characteristic.RotationSpeed, 50);\n }\n this.interval = setInterval(() => this.runAnimation(), INTERVAL);\n this.LEDservice.updateCharacteristic(this.Characteristic.On, true);\n this.on = true;\n if (this.getBrightness() === 0) {\n this.LEDservice.setCharacteristic(this.Characteristic.Brightness, 100);\n }\n this.platform.setAnimationCancel(this.cancelAnimation.bind(this));\n } else {\n clearInterval(this.interval);\n this.interval = undefined;\n }\n }\n\n getOnS(): boolean {\n return this.onS; // interval running\n }\n\n setBrightness(v: CharacteristicValue): void {\n this.log.info('rainbow setBrightness', v);\n this.brightness = v as number;\n }\n\n getBrightness(): number {\n return this.brightness;\n }\n\n setColorTemperature(v: CharacteristicValue): void {\n this.log.info('rainbow setColorTemperature', v);\n this.offset = (v as number) / OFFSET_CT;\n }\n\n getColorTemperature(): number {\n return this.offset * OFFSET_CT;\n }\n\n setSpeed(v: CharacteristicValue): void {\n this.log.info('rainbow speed', v);\n this.speed = (v as number) / SPEED;\n }\n\n getSpeed(): number {\n return this.speed * SPEED;\n }\n\n // oxlint-disable-next-line class-methods-use-this, no-empty-function\n runAnimation(): void {}\n\n cancelAnimation(): void {\n clearInterval(this.interval);\n this.interval = undefined;\n this.LEDservice.updateCharacteristic(this.Characteristic.On, false);\n this.FanService.updateCharacteristic(this.Characteristic.On, false);\n }\n}\n","import { colord, type RgbColor } from 'colord';\nimport type { PlatformAccessory } from 'homebridge';\n\nimport AnimatedAccessory from './AnimatedAccessory';\nimport type DioderAccessory from './DioderAccessory';\nimport type DioderPlatform from './DioderPlatform';\nimport type { GradiantContext } from './DioderPlatform';\n\nexport default class GradientAccessory extends AnimatedAccessory {\n private currentStep: number;\n private readonly colors: RgbColor[];\n\n constructor(platform: DioderPlatform, accessory: PlatformAccessory<GradiantContext>, leds: DioderAccessory[]) {\n super(platform, accessory, leds, accessory.context.config.name);\n this.currentStep = 0;\n this.colors = accessory.context.config.colors.map((c: string) => colord(c).toRgb());\n }\n\n runAnimation(): void {\n const len = this.leds.length;\n for (let i = 0; i < len; i++) {\n const step = this.currentStep + (i * this.offset) / 50;\n const prevColor = Math.floor(step) % len;\n const nextColor = (prevColor + 1) % len;\n const prog = step % 1;\n const r = this.colors[prevColor].r * (1 - prog) + this.colors[nextColor].r * prog;\n const g = this.colors[prevColor].g * (1 - prog) + this.colors[nextColor].g * prog;\n const b = this.colors[prevColor].b * (1 - prog) + this.colors[nextColor].b * prog;\n this.leds[i].setRGB((r * this.brightness) / 100, (g * this.brightness) / 100, (b * this.brightness) / 100);\n }\n this.currentStep = (this.currentStep + (this.speed * len) / 360) % len;\n }\n}\n","import type { PlatformAccessory } from 'homebridge';\n\nimport AnimatedAccessory from './AnimatedAccessory';\nimport type DioderAccessory from './DioderAccessory';\nimport type DioderPlatform from './DioderPlatform';\n\nconst SATURATION = 100;\n\nexport default class RainbowAccessory extends AnimatedAccessory {\n private currentHue: number;\n\n constructor(platform: DioderPlatform, accessory: PlatformAccessory, leds: DioderAccessory[]) {\n super(platform, accessory, leds, 'Rainbow Effect');\n this.currentHue = 0;\n }\n\n runAnimation(): void {\n //this.log.warn(`currentHue: ${this.currentHue}, offset: ${this.offset}, speed: ${this.speed}`);\n for (let i = 0; i < this.leds.length; i++) {\n this.leds[i].setHSV({ h: (this.currentHue + i * this.offset) % 360, s: SATURATION, v: this.brightness }, true);\n }\n this.currentHue = (this.currentHue + this.speed) % 360;\n }\n}\n","import type { PlatformAccessory, API, Logging, PlatformConfig, DynamicPlatformPlugin } from 'homebridge';\nimport lg from 'lgpio';\n\nimport DioderAccessory from './DioderAccessory';\nimport GradientAccessory from './GradientAccessory';\nimport RainbowAccessory from './RainbowAccessory';\n\nexport interface LedConfig {\n name: string;\n rPin: number;\n gPin: number;\n bPin: number;\n}\n\ninterface GradiantConfig {\n name: string;\n colors: string[];\n}\n\ninterface DioderConfig extends PlatformConfig {\n leds: LedConfig[];\n gradientAnim: GradiantConfig[];\n rainbowAnim: { enabled: boolean };\n}\n\nexport interface DioderContext {\n config: LedConfig;\n}\n\nexport interface GradiantContext {\n config: GradiantConfig;\n}\n\nconst PLUGIN_NAME = '@silizia/homebridge-dioder';\n\nexport default class DioderPlatform implements DynamicPlatformPlugin {\n public readonly accessories: PlatformAccessory[] = [];\n public animationCancel?: () => void = undefined;\n\n constructor(\n public readonly log: Logging,\n public readonly config: DioderConfig,\n public readonly api: API\n ) {\n this.log.debug('Finished initializing platform: Dioder');\n this.api.on('didFinishLaunching', () => {\n this.log.debug('Executed didFinishLaunching callback');\n let removedAccessories = this.accessories;\n // DioderAccessories\n const dioderAccessories: DioderAccessory[] = [];\n const gpiochip = lg.gpiochipOpen(0);\n for (const c of this.config.leds || []) {\n const uuid = this.api.hap.uuid.generate(JSON.stringify(c));\n const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid) as PlatformAccessory<DioderContext>;\n if (existingAccessory) {\n removedAccessories = removedAccessories.filter(accessory => accessory.UUID !== uuid);\n this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);\n dioderAccessories.push(new DioderAccessory(this, existingAccessory, gpiochip));\n } else {\n this.log.info('Adding new accessory:', c.name);\n const accessory = new this.api.platformAccessory<DioderContext>(c.name, uuid);\n accessory.context.config = c;\n dioderAccessories.push(new DioderAccessory(this, accessory, gpiochip));\n this.api.registerPlatformAccessories(PLUGIN_NAME, 'Dioder', [accessory]);\n }\n }\n // RainbowAccessory\n if (this.config.rainbowAnim?.enabled) {\n const uuid = this.api.hap.uuid.generate('Rainbow Effect');\n const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);\n if (existingAccessory) {\n removedAccessories = removedAccessories.filter(accessory => accessory.UUID !== uuid);\n this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);\n // oxlint-disable-next-line no-new\n new RainbowAccessory(this, existingAccessory, dioderAccessories);\n } else {\n this.log.info('Adding new accessory: Rainbow Effect');\n const accessory = new this.api.platformAccessory('Rainbow Effect', uuid);\n // oxlint-disable-next-line no-new\n new RainbowAccessory(this, accessory, dioderAccessories);\n this.api.registerPlatformAccessories(PLUGIN_NAME, 'Dioder', [accessory]);\n }\n }\n // GradientAccessory\n for (const c of this.config.gradientAnim || []) {\n const uuid = this.api.hap.uuid.generate(JSON.stringify(c));\n const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid) as PlatformAccessory<GradiantContext>;\n if (existingAccessory) {\n removedAccessories = removedAccessories.filter(accessory => accessory.UUID !== uuid);\n this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);\n // oxlint-disable-next-line no-new\n new GradientAccessory(this, existingAccessory, dioderAccessories);\n } else {\n this.log.info('Adding new gradient accessory:', c.name);\n const accessory = new this.api.platformAccessory<GradiantContext>(c.name, uuid);\n accessory.context.config = c;\n // oxlint-disable-next-line no-new\n new GradientAccessory(this, accessory, dioderAccessories);\n this.api.registerPlatformAccessories(PLUGIN_NAME, 'Dioder', [accessory]);\n }\n }\n // removed unused Accessories\n if (removedAccessories.length > 0) {\n this.log.warn(\n 'removing unused accessories',\n removedAccessories.map(a => a.displayName)\n );\n this.api.unregisterPlatformAccessories(PLUGIN_NAME, 'Dioder', removedAccessories);\n }\n });\n }\n\n configureAccessory(accessory: PlatformAccessory): void {\n this.log.info('Loading accessory from cache:', accessory.displayName);\n this.accessories.push(accessory);\n }\n\n // oxlint-disable-next-line promise/prefer-await-to-callbacks\n setAnimationCancel(callback: () => void): void {\n if (this.animationCancel !== undefined) {\n (this.animationCancel as () => void)();\n }\n this.animationCancel = callback;\n }\n\n isAnimationRunning(): boolean {\n return this.animationCancel !== undefined;\n }\n\n stopAnimation(): void {\n if (this.animationCancel !== undefined) {\n (this.animationCancel as () => void)();\n this.animationCancel = undefined;\n }\n }\n}\n","import type { API } from 'homebridge';\n\nimport DioderPlatform from './DioderPlatform';\n\nexport default function main(api: API): void {\n api.registerPlatform('Dioder', DioderPlatform);\n}\n"],"mappings":";;;AAOA,MAAM,UAAU;AAChB,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAElB,IAAqB,kBAArB,MAAqC;CACnC;CACA;CAEA;CACA;CACA;CACA;CAEA,YACE,UACA,WACA,UACA;AAHiB,OAAA,WAAA;AACA,OAAA,YAAA;AACA,OAAA,WAAA;EAEjB,MAAM,EAAE,QAAQ,SAAS;AACzB,OAAK,iBAAiB,IAAI;AAC1B,OAAK,MAAM,SAAS;AAEpB,OAAK,SAAS,UAAU,QAAQ;AAChC,KAAG,gBAAgB,UAAU,KAAK,OAAO,KAAK;AAC9C,KAAG,gBAAgB,UAAU,KAAK,OAAO,KAAK;AAC9C,KAAG,gBAAgB,UAAU,KAAK,OAAO,KAAK;AAC9C,OAAK,MAAM;GAAE,GAAG;GAAG,GAAG;GAAG,GAAG;GAAG;AAC/B,OAAK,KAAK;AAEV,OAAK,UACF,WAAW,IAAI,QAAQ,qBAAqB,EAC3C,kBAAkB,KAAK,eAAe,cAAc,UAAU,CAC/D,kBAAkB,KAAK,eAAe,OAAO,YAAY,CACzD,kBAAkB,KAAK,eAAe,cAAc,KAAK;AAE5D,OAAK,UAAU,GAAG,kBAAkB,KAAK,UAAU,CAAC;AAEpD,OAAK,aAAa,KAAK,UAAU,WAAW,IAAI,QAAQ,UAAU,IAAI,KA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B,KAAA,EAC1B,MAAK,iBAAgC;AAExC,OAAK,kBAAkB;;CAGzB,qBAA8B;AAC5B,SAAO,KAAK,oBAAoB,KAAA;;CAGlC,gBAAsB;AACpB,MAAI,KAAK,oBAAoB,KAAA,GAAW;AACrC,QAAK,iBAAgC;AACtC,QAAK,kBAAkB,KAAA;;;;;;AChI7B,SAAwB,KAAK,KAAgB;AAC3C,KAAI,iBAAiB,UAAU,eAAe"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silizia/homebridge-dioder",
3
3
  "displayName": "Homebridge Dioder",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "description": "Homebridge plugin to control Dioder LED strips over pigpio pins",
6
6
  "keywords": [
7
7
  "homebridge-plugin"