iobroker.autodarts 0.5.0 → 0.5.1

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/README.md CHANGED
@@ -85,6 +85,9 @@ When configured, changes to either the adapter states or external states are syn
85
85
  <!--
86
86
  ### **WORK IN PROGRESS**
87
87
  -->
88
+ ### 0.5.1 (2025-12-28)
89
+ - (skvarel) Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.
90
+
88
91
  ### 0.5.0 (2025-12-28)
89
92
  - (skvarel) Added: Bidirectional hardware control states `system.hardware.light` and `system.hardware.power`
90
93
  - (skvarel) Added: Configuration options to map light/power states to external ioBroker states (e.g., 0_userdata)
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "autodarts",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "news": {
6
+ "0.5.1": {
7
+ "en": "Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.",
8
+ "de": "Behoben: Hardware-Licht/Strom-Mapping respektiert nun konfigurierte Ziel-IDs und arbeitet an allen Systemen.",
9
+ "ru": "Фиксированный: аппаратное отображение света/мощности теперь учитывает настроенные идентификаторы цели и работает на всех системах.",
10
+ "pt": "Fixo: O mapeamento de luz/potência de hardware agora respeita IDs de destino configurados e funciona em todos os sistemas.",
11
+ "nl": "Vast: Hardware licht/kracht mapping respecteert nu geconfigureerde doel ID's en werkt op alle systemen.",
12
+ "fr": "Correction : La cartographie matérielle de la lumière/puissance respecte désormais les identifiants de cible configurés et fonctionne sur tous les systèmes.",
13
+ "it": "Risolto: la mappatura della luce/potenza hardware ora rispetta gli ID di destinazione configurati e funziona su tutti i sistemi.",
14
+ "es": "Fijo: Hardware light/power mapping respeta ahora los IDs de destino configurados y funciona en todos los sistemas.",
15
+ "pl": "Naprawiono: Hardware light / Power mapowanie teraz szanuje skonfigurowane identyfikatory docelowe i działa na wszystkich systemach.",
16
+ "uk": "Виправлено: Апаратне освітлення / живлення тепер поважає налаштовувати цільові ідентифікатори і працює на всіх системах.",
17
+ "zh-cn": "固定:硬件光电映射现在尊重已配置的目标ID,并在所有系统中工作."
18
+ },
6
19
  "0.5.0": {
7
20
  "en": "Added: Bidirectional hardware control states `system.hardware.light` and `system.hardware.power`\nAdded: Configuration options to map light/power states to external ioBroker states (e.g., 0_userdata)\nChanged: Hardware states now support read/write operations for full automation integration",
8
21
  "de": "Hinzugefügt: Bidirektionale Hardware-Steuerzustände `system.hardware.light` und `system.hardware.power `\nHinzugefügt: Konfigurationsoptionen zur Abbildung von Licht/Leistungszuständen zu externen ioBroker Zuständen (z.B. 0_userdata)\nGeändert: Hardware-Staaten unterstützen nun Lese- und Schreibvorgänge für die vollständige Automatisierungsintegration",
@@ -80,19 +93,6 @@
80
93
  "pl": "Dodano punkty danych świateł drogowych (\"status.traffic LightColor\", \"status.traffic LightState\"), które zostały odwzorowane ze statusu zarządu (\"Throw\" / \"Takeout\" / błędy połączeń).\nZmieniony kod: obsługa odwiedzin, obsługa rzutów (potrójny / byk) i logika światła drogowego przeniesiona do oddzielnych modułów.",
81
94
  "uk": "Додано точки світла трафіку (`status.trafficLightColor`, `status.trafficLightState`) на карті Board Manager (`Throw` / `Takeout` / помилки підключення).\nРефакторний код: візитна обробка, кидання (стриптиз / бик) і логіка трафіку переходить на окремі модулі.",
82
95
  "zh-cn": "增加从董事会管理者身份绘制的交通灯数据点(`Status.trafficLightColor ' ,`Status.trafficLight Station ' ) (`扔'/`Takeout ' /连接错误).\n重构代码:访问处理,投掷处理(三重/公牛)和交通灯逻辑移动到单独的模块."
83
- },
84
- "0.2.2": {
85
- "en": "bugfix",
86
- "de": "fehlerbehebung",
87
- "ru": "исправление ошибок",
88
- "pt": "correção de erros",
89
- "nl": "bugfix",
90
- "fr": "correction du bug",
91
- "it": "bugfix",
92
- "es": "bugfix",
93
- "pl": "bugfix",
94
- "uk": "панчохи",
95
- "zh-cn": "错误修正"
96
96
  }
97
97
  },
98
98
  "titleLang": {
package/main.js CHANGED
@@ -424,13 +424,17 @@ class Autodarts extends utils.Adapter {
424
424
  this.subscribeStates("config.tripleMaxScore");
425
425
  this.subscribeStates("config.triggerResetSec");
426
426
 
427
- // Auf Hardware-Schalter hören
427
+ // Auf Hardware-Schalter hören (eigene States)
428
428
  this.subscribeStates("system.hardware.light");
429
429
  this.subscribeStates("system.hardware.power");
430
430
 
431
- // Ziel-States (0_userdata) ebenfalls beobachten
432
- this.subscribeForeignStates("0_userdata.0.LICHT");
433
- this.subscribeForeignStates("0_userdata.0.STROM");
431
+ // Ziel-States (0_userdata o.ä.) nur abonnieren, wenn konfiguriert
432
+ if (this.config.lightTargetId) {
433
+ this.subscribeForeignStates(this.config.lightTargetId);
434
+ }
435
+ if (this.config.powerTargetId) {
436
+ this.subscribeForeignStates(this.config.powerTargetId);
437
+ }
434
438
 
435
439
  // Zustand zurücksetzen
436
440
  this.lastThrowsCount = 0;
@@ -479,12 +483,22 @@ class Autodarts extends utils.Adapter {
479
483
  return;
480
484
  }
481
485
 
482
- // Nur auf Schreibaktionen reagieren (ack === false)
483
- if (state.ack) {
486
+ const idShort = id.replace(`${this.namespace}.`, "");
487
+
488
+ // 1) Rückrichtung: Foreign-States -> eigene Schalter (immer reagieren)
489
+ if (this.config.lightTargetId && id === this.config.lightTargetId) {
490
+ await this.setStateAsync("system.hardware.light", { val: state.val, ack: true });
491
+ return;
492
+ }
493
+ if (this.config.powerTargetId && id === this.config.powerTargetId) {
494
+ await this.setStateAsync("system.hardware.power", { val: state.val, ack: true });
484
495
  return;
485
496
  }
486
497
 
487
- const idShort = id.replace(`${this.namespace}.`, "");
498
+ // 2) Ab hier nur noch eigene States: nur bei ack === false reagieren
499
+ if (state.ack) {
500
+ return;
501
+ }
488
502
 
489
503
  if (idShort === "config.tripleMinScore") {
490
504
  const val = Number(state.val);
@@ -495,8 +509,6 @@ class Autodarts extends utils.Adapter {
495
509
 
496
510
  this.tripleMinScoreRuntime = val;
497
511
  this.log.info(`Runtime tripleMinScore updated to ${val}`);
498
-
499
- // Wert mit ack bestätigen
500
512
  await this.setStateAsync("config.tripleMinScore", { val, ack: true });
501
513
  } else if (idShort === "config.tripleMaxScore") {
502
514
  const val = Number(state.val);
@@ -507,7 +519,6 @@ class Autodarts extends utils.Adapter {
507
519
 
508
520
  this.tripleMaxScoreRuntime = val;
509
521
  this.log.info(`Runtime tripleMaxScore updated to ${val}`);
510
-
511
522
  await this.setStateAsync("config.tripleMaxScore", { val, ack: true });
512
523
  } else if (idShort === "config.triggerResetSec") {
513
524
  const val = Number(state.val);
@@ -518,10 +529,7 @@ class Autodarts extends utils.Adapter {
518
529
 
519
530
  this.triggerResetSecRuntime = val;
520
531
  this.log.info(`Runtime triggerResetSec updated to ${val} s`);
521
-
522
532
  await this.setStateAsync("config.triggerResetSec", { val, ack: true });
523
-
524
- // Weiterleitung für Licht und Power
525
533
  } else if (idShort === "system.hardware.light") {
526
534
  if (this.config.lightTargetId) {
527
535
  await this.setForeignStateAsync(this.config.lightTargetId, state.val, false);
@@ -534,12 +542,6 @@ class Autodarts extends utils.Adapter {
534
542
  } else {
535
543
  this.log.warn("Power state changed, but no powerTargetId configured");
536
544
  }
537
-
538
- // Rückrichtung: 0_userdata -> eigene Schalter
539
- } else if (id === "0_userdata.0.LICHT") {
540
- await this.setStateAsync("system.hardware.light", { val: state.val, ack: true });
541
- } else if (id === "0_userdata.0.STROM") {
542
- await this.setStateAsync("system.hardware.power", { val: state.val, ack: true });
543
545
  }
544
546
  }
545
547
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.autodarts",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Autodarts Autoscoring",
5
5
  "author": "skvarel <skvarel@inventwo.com>",
6
6
  "contributors": [