iobroker.autodarts 0.5.0 → 0.6.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/README.md CHANGED
@@ -26,7 +26,9 @@ Connects to your local Autodarts Board Manager (via IP and port, e.g. `192.168.x
26
26
  - **`visit.score`**: Total score of the last complete visit (3 darts)
27
27
  - **`throw.current`**: Numeric score of the last thrown dart
28
28
  - **`throw.isTriple`**: Boolean flag for triple hits within configurable segment range (default: 1–20)
29
+ - **`throw.isDouble`**: Boolean flag for double hits only (all segments)
29
30
  - **`throw.isBullseye`**: Boolean flag for bullseye hits only
31
+ - **`throw.isMiss`**: Boolean flag that is true when the dart does not hit any valid scoring segment (no score / miss only)
30
32
 
31
33
  ### Board Status
32
34
  - **`status.trafficLightColor`**: HEX color of current board status
@@ -85,6 +87,13 @@ When configured, changes to either the adapter states or external states are syn
85
87
  <!--
86
88
  ### **WORK IN PROGRESS**
87
89
  -->
90
+ ### 0.6.0 (2025-12-28)
91
+ - (skvarel) Added: New throw.isMiss state to detect and trigger automations on missed darts (including auto-reset via triggerResetSec).
92
+ - (skvarel) Added: New throw.isDouble state to detect and trigger automations on double segments (including auto-reset via triggerResetSec).
93
+
94
+ ### 0.5.1 (2025-12-28)
95
+ - (skvarel) Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.
96
+
88
97
  ### 0.5.0 (2025-12-28)
89
98
  - (skvarel) Added: Bidirectional hardware control states `system.hardware.light` and `system.hardware.power`
90
99
  - (skvarel) Added: Configuration options to map light/power states to external ioBroker states (e.g., 0_userdata)
@@ -11,7 +11,7 @@
11
11
  "power_target": "Power-Datenpunkt",
12
12
  "power_target_help": "Datenpunkt der Server- oder Bildschirm-Steckdose zur Steuerung innerhalb des Autodarts-Adapters. Lasse das Feld leer, um die Leistungssteuerung zu deaktivieren.",
13
13
  "reset": "Trigger-Reset (s)",
14
- "reset_help": "Setzt den Triple- und Bullseye-Trigger nach x Sekunden zurück (0 = kein Reset).",
14
+ "reset_help": "Setzt den Triple-, Doppel-, Bullseye und Miss-Trigger nach x Sekunden zurück (0 = kein Reset).",
15
15
  "triple_flag": "Minimales Feld für den Triple-Trigger",
16
16
  "triple_flag2": "Maximales Feld für den Triple-Trigger",
17
17
  "triple_flag2_help": "Feld „Maximale Punktzahl“ für den Triple-Trigger. Darts mit einer Punktzahl über diesem Wert lösen den Triple-Trigger-Datenpunkt nicht aus.",
@@ -11,7 +11,7 @@
11
11
  "triple_flag2_help": "Maximum score field for the triple trigger. Darts with a score above this value will not trigger the Triple-Trigger datapoint.",
12
12
  "triple_flag_help": "Minimum score field for the triple trigger. Darts with a score below this value will not trigger the Triple-Trigger datapoint.",
13
13
  "reset": "Trigger-Reset (s)",
14
- "reset_help": "Reset the triple and bullseye trigger after x seconds (0 = no reset).",
14
+ "reset_help": "Reset the triple, double, bullseye and miss trigger after x seconds (0 = no reset).",
15
15
  "light_target": "Light Target ID",
16
16
  "light_target_help": "ID of the light target to control lights via Autodarts (e.g., 'light.living_room'). Leave empty to disable light control.",
17
17
  "power_target": "Power Target ID",
@@ -11,7 +11,7 @@
11
11
  "power_target": "ID de objetivo de potencia",
12
12
  "power_target_help": "ID del objetivo de energía para controlar la energía a través de Autodarts (por ejemplo, 'switch.darts_socket'). Déjelo vacío para desactivar el control de energía.",
13
13
  "reset": "Restablecimiento de disparador (s)",
14
- "reset_help": "Restablezca el disparador triple y de diana después de x segundos (0 = sin reinicio).",
14
+ "reset_help": "Restablezca el disparador triple, doble, diana y fallido después de x segundos (0 = sin reinicio).",
15
15
  "triple_flag": "Campo mínimo para el triple disparador",
16
16
  "triple_flag2": "Campo máximo para el triple disparador",
17
17
  "triple_flag2_help": "Campo de puntuación máxima para el triple disparador. Los dardos con una puntuación superior a este valor no activarán el punto de datos Triple-Trigger.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "ID de cible de puissance",
12
12
  "power_target_help": "ID de la cible d'alimentation pour contrôler l'alimentation via Autodarts (par exemple, « switch.darts_socket »). Laissez vide pour désactiver le contrôle de l’alimentation.",
13
13
  "reset": "Déclencheur-Réinitialisation(s)",
14
- "reset_help": "Réinitialisez le déclencheur triple et bullseye après x secondes (0 = pas de réinitialisation).",
14
+ "reset_help": "Réinitialisez les déclencheurs triple, double, bullseye et miss après x secondes (0 = pas de réinitialisation).",
15
15
  "triple_flag": "Champ minimum pour le triple déclencheur",
16
16
  "triple_flag2": "Champ maximum pour le triple déclencheur",
17
17
  "triple_flag2_help": "Champ de score maximum pour le triple déclencheur. Les fléchettes avec un score supérieur à cette valeur ne déclencheront pas le point de données Triple-Trigger.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "ID del target di potenza",
12
12
  "power_target_help": "ID del target di potenza per controllare l'energia tramite Autodarts (ad esempio, \"switch.darts_socket\"). Lasciare vuoto per disabilitare il controllo dell'alimentazione.",
13
13
  "reset": "Trigger-Reset(s)",
14
- "reset_help": "Ripristina il grilletto triplo e bullseye dopo x secondi (0 = nessun ripristino).",
14
+ "reset_help": "Resetta il trigger triplo, doppio, bullseye e mancato dopo x secondi (0 = nessun reset).",
15
15
  "triple_flag": "Campo minimo per il triplo trigger",
16
16
  "triple_flag2": "Campo massimo per il triplo trigger",
17
17
  "triple_flag2_help": "Campo del punteggio massimo per il triplo trigger. Le freccette con un punteggio superiore a questo valore non attiveranno il punto dati Triple-Trigger.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "Power Target-ID",
12
12
  "power_target_help": "ID van het powertarget om de power te regelen via Autodarts (bijvoorbeeld 'switch.darts_socket'). Laat dit leeg om de stroomregeling uit te schakelen.",
13
13
  "reset": "Trigger-reset (s)",
14
- "reset_help": "Reset de drievoudige en bullseye-trigger na x seconden (0 = geen reset).",
14
+ "reset_help": "Reset de drievoudige, dubbele, bullseye- en miss-trigger na x seconden (0 = geen reset).",
15
15
  "triple_flag": "Minimumveld voor de drievoudige trigger",
16
16
  "triple_flag2": "Maximaal veld voor de drievoudige trigger",
17
17
  "triple_flag2_help": "Maximaal scoreveld voor de drievoudige trigger. Darten met een score boven deze waarde activeren het Triple-Trigger-datapunt niet.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "Identyfikator celu mocy",
12
12
  "power_target_help": "Identyfikator celu mocy do kontrolowania mocy za pomocą Autodarts (np. „switch.darts_socket”). Pozostaw puste, aby wyłączyć kontrolę mocy.",
13
13
  "reset": "Reset wyzwalacza (s)",
14
- "reset_help": "Zresetuj wyzwalacz potrójny i tarczy po x sekundach (0 = brak resetu).",
14
+ "reset_help": "Zresetuj wyzwalacz potrójny, podwójny, strzał w dziesiątkę i spudłowanie po x sekundach (0 = brak resetu).",
15
15
  "triple_flag": "Minimalne pole dla potrójnego wyzwalacza",
16
16
  "triple_flag2": "Maksymalne pole dla potrójnego wyzwalacza",
17
17
  "triple_flag2_help": "Pole maksymalnego wyniku dla potrójnego wyzwalacza. Rzutki z wynikiem powyżej tej wartości nie uruchomią punktu danych Triple-Trigger.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "ID do alvo avançado",
12
12
  "power_target_help": "ID do alvo de potência para controlar a potência por meio de Autodarts (por exemplo, 'switch.darts_socket'). Deixe em branco para desativar o controle de energia.",
13
13
  "reset": "Redefinição(ões) de gatilho",
14
- "reset_help": "Redefina o gatilho triplo e alvo após x segundos (0 = sem reinicialização).",
14
+ "reset_help": "Redefina o disparo triplo, duplo, alvo e erro após x segundos (0 = sem reinicialização).",
15
15
  "triple_flag": "Campo mínimo para o disparo triplo",
16
16
  "triple_flag2": "Campo máximo para o disparo triplo",
17
17
  "triple_flag2_help": "Campo de pontuação máxima para o disparo triplo. Dardos com pontuação acima deste valor não acionarão o ponto de dados Triple-Trigger.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "Идентификатор цели по мощности",
12
12
  "power_target_help": "Идентификатор цели мощности для управления мощностью через Autodarts (например, «switch.darts_socket»). Оставьте пустым, чтобы отключить управление питанием.",
13
13
  "reset": "Триггер-Сброс (ы)",
14
- "reset_help": "Сбросьте триггер и триггер «яблочко» через x секунд (0 = сброса нет).",
14
+ "reset_help": "Сбросьте триггер тройного, двойного, яблочко и промаха через x секунд (0 = сброса нет).",
15
15
  "triple_flag": "Минимальное поле для тройного триггера",
16
16
  "triple_flag2": "Максимальное поле для тройного триггера",
17
17
  "triple_flag2_help": "Поле максимального результата для тройного триггера. Дартс с результатом выше этого значения не будет активировать точку данных тройного триггера.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "Power Target ID",
12
12
  "power_target_help": "Ідентифікатор цільової потужності для керування живленням через Autodarts (наприклад, 'switch.darts_socket'). Залиште пустим, щоб вимкнути керування живленням.",
13
13
  "reset": "Тригер-Скидання (s)",
14
- "reset_help": "Скинути потрійний тригер і тригер «яблочко» через x секунд (0 = без скидання).",
14
+ "reset_help": "Скинути потрійний, подвійний, яблучний і промах через x секунд (0 = без скидання).",
15
15
  "triple_flag": "Мінімальне поле для потрійного тригера",
16
16
  "triple_flag2": "Максимальне поле для потрійного тригера",
17
17
  "triple_flag2_help": "Поле максимального балу для потрійного тригера. Дартс із результатом вище цього значення не активує точку даних Triple-Trigger.",
@@ -11,7 +11,7 @@
11
11
  "power_target": "功率目标 ID",
12
12
  "power_target_help": "通过 Autodarts 控制电源的电源目标的 ID(例如“switch.darts_socket”)。留空以禁用电源控制。",
13
13
  "reset": "触发-复位",
14
- "reset_help": "x 秒后重置三重触发器和靶心触发器(0 = 不重置)。",
14
+ "reset_help": "x 秒后重置三重、双重、靶心和错过触发(0 = 不重置)。",
15
15
  "triple_flag": "三重触发器的最小字段",
16
16
  "triple_flag2": "三重触发器的最大字段",
17
17
  "triple_flag2_help": "三重触发器的最大分数字段。分数高于此值的飞镖将不会触发三重触发数据点。",
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "autodarts",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "news": {
6
+ "0.6.0": {
7
+ "en": "Added: New throw.isMiss state to detect and trigger automations on missed darts (including auto-reset via triggerResetSec).\nAdded: New throw.isDouble state to detect and trigger automations on double segments (including auto-reset via triggerResetSec).",
8
+ "de": "Hinzugefügt: Neue Wurf. isMiss-Zustand zu erkennen und Automatisierungen auf verpassten Darts auszulösen (einschließlich Auto-Reset über triggerResetSec).\nHinzugefügt: Neue Wurf. ist doppelter Zustand, um Automatisierungen auf Doppelsegmenten zu erkennen und auszulösen (einschließlich Auto-Reset über triggerResetSec).",
9
+ "ru": "Добавлено: Новый бросок. состояние Мисс для обнаружения и запуска автоматизации на пропущенных дротиках (включая автоматическое сброс через триггерResetSec).\nДобавлено: Новый бросок. Двойное состояние для обнаружения и запуска автоматизации в двойных сегментах (включая автоперезагрузку через триггерResetSec).",
10
+ "pt": "Adicionado: Novo lançamento. isMiss estado para detectar e ativar automações em dardos perdidos (incluindo auto-reset via triggerResetSec).\nAdicionado: Novo lançamento. isDouble state to detect and active automations in double segments (incluindo auto-reset via triggerResetSec).",
11
+ "nl": "Toegevoegd: Nieuwe worp. isMiss staat te detecteren en te triggeren automatisering op gemiste darts (inclusief auto-reset via triggerResetSec).\nToegevoegd: Nieuwe worp. isDubbele toestand te detecteren en te triggeren automatiseringen op dubbele segmenten (inclusief auto-reset via triggerResetSec).",
12
+ "fr": "Ajouté : Nouveau lancer. isMiss state pour détecter et déclencher les automatismes sur les fléchettes oubliées (y compris auto-reset via triggerResetSec).\nAjouté : Nouveau lancer. est l'état double pour détecter et déclencher les automatismes sur les doubles segments (y compris auto-reset via triggerResetSec).",
13
+ "it": "Aggiunto: Nuovo tiro. isMiss stato per rilevare e attivare le automazioni sulle freccette mancate (compreso il ripristino automatico tramite triggerResetSec).\nAggiunto: Nuovo tiro. isDouble state per rilevare e attivare le automazioni su due segmenti (compreso il ripristino automatico tramite triggerResetSec).",
14
+ "es": "Añadido: Nuevo lanzamiento. isMiss state para detectar y desencadenar automatizaciones en dardos perdidos (incluyendo el ajuste automático a través de triggerResetSec).\nAñadido: Nuevo lanzamiento. isDoble estado para detectar y desencadenar automatizaciones en segmentos dobles (incluyendo el ajuste automático a través de triggerResetSec).",
15
+ "pl": "Dodano: nowy rzut. isMiss stan do wykrywania i uruchamiania automatyzacji na nieodebranych rzutki (w tym auto- reset poprzez triggerResetSec).\nDodano: nowy rzut. isDouble state do wykrywania i uruchamiania automatyzacji na podwójnych segmentach (w tym auto- reset poprzez triggerResetSec).",
16
+ "uk": "Доданий: Новий кицька. isMiss держава для виявлення та запуску автоматизації на пропущених darts (включаючи автозавантаження через тригерResetSec).\nДоданий: Новий кицька. єподвійним станом для виявлення та запуску автоматизації на подвійних сегментах (включаючи автозавантаження через тригерResetSec).",
17
+ "zh-cn": "添加:新掷. 是Miss State,用于检测和触发对丢失的飞镖的自动化(包括通过触发器ResetSec自动重置).\n添加:新掷. isDouble状态在双片段上检测和触发自动化(包括通过触发ResetSec自动重置)."
18
+ },
19
+ "0.5.1": {
20
+ "en": "Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.",
21
+ "de": "Behoben: Hardware-Licht/Strom-Mapping respektiert nun konfigurierte Ziel-IDs und arbeitet an allen Systemen.",
22
+ "ru": "Фиксированный: аппаратное отображение света/мощности теперь учитывает настроенные идентификаторы цели и работает на всех системах.",
23
+ "pt": "Fixo: O mapeamento de luz/potência de hardware agora respeita IDs de destino configurados e funciona em todos os sistemas.",
24
+ "nl": "Vast: Hardware licht/kracht mapping respecteert nu geconfigureerde doel ID's en werkt op alle systemen.",
25
+ "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.",
26
+ "it": "Risolto: la mappatura della luce/potenza hardware ora rispetta gli ID di destinazione configurati e funziona su tutti i sistemi.",
27
+ "es": "Fijo: Hardware light/power mapping respeta ahora los IDs de destino configurados y funciona en todos los sistemas.",
28
+ "pl": "Naprawiono: Hardware light / Power mapowanie teraz szanuje skonfigurowane identyfikatory docelowe i działa na wszystkich systemach.",
29
+ "uk": "Виправлено: Апаратне освітлення / живлення тепер поважає налаштовувати цільові ідентифікатори і працює на всіх системах.",
30
+ "zh-cn": "固定:硬件光电映射现在尊重已配置的目标ID,并在所有系统中工作."
31
+ },
6
32
  "0.5.0": {
7
33
  "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
34
  "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",
@@ -67,32 +93,6 @@
67
93
  "pl": "Zmieniono: Tworzenie obiektu wykorzystuje teraz extendObjectAsync z odpowiednimi rolami i typami zamiast zestawu ObjectNotExistsAsync.",
68
94
  "uk": "Змінено: Створення об'єктів тепер використовує розширенняObjectAsync з відповідними ролями та типами замість набору Об'єктNotExistsAsync.",
69
95
  "zh-cn": "已更改 : 对象创建现在使用扩展对象Async , 并配有合适的角色和类型而不是设定 Object NotExists Async. (原始内容存档于2018-09-31)."
70
- },
71
- "0.3.0": {
72
- "en": "Added traffic light datapoints (`status.trafficLightColor`, `status.trafficLightState`) mapped from Board Manager status (`Throw` / `Takeout` / connection errors).\nRefactored code: visit handling, throw handling (triple / bull) and traffic light logic moved to separate modules.",
73
- "de": "Es wurden Verkehrslichtdatenpunkte (`status.trafficLightColor`, `status.trafficLightState`) aus dem Status Board Manager (`Throw` / `Takeout` / Verbindungsfehler) abgebildet.\nRefactored Code: Besuchen Sie Handling, Wurf Handling (Triple / Bull) und Ampellogik in separate Module bewegt.",
74
- "ru": "Добавлены точки данных светофора («status.trafficLightColor», «status.trafficLightState»), отображаемые из статуса менеджера совета директоров («Бросить» / «Выбрать» / ошибки подключения).\nРефакторированный код: обработка посещений, обработка бросков (тройной / бычий) и логика светофора перемещаются в отдельные модули.",
75
- "pt": "Pontos de dados de semáforo adicionados (`status.trafficLightColor`, `status.trafficLightState`) mapeados a partir do status do Board Manager (`Throw` / `Takeout` / erros de conexão).\nCódigo refatorizado: manipulação de visita, manuseio de arremesso (triplo / touro) e lógica de semáforo movido para módulos separados.",
76
- "nl": "Toegevoegd verkeerslicht datapoints (.\nRefactored code: bezoeken handling, gooien handling (triple / stier) en verkeerslicht logica verplaatst naar aparte modules.",
77
- "fr": "Ajout de points de données de feux de circulation (`status.trafficLightColor`, `status.trafficLightState`) cartographié à partir de l'état du gestionnaire du conseil d'administration (`Throw` / `Takeout` / erreurs de connexion).\nCode refactoré: visite de la manipulation, la manipulation de lancer (triple / taureau) et la logique du feu de circulation déplacé vers des modules séparés.",
78
- "it": "Aggiunti i datapoint del semaforo (`status.trafficLightColor`, `status.trafficLightState`) mappati dallo stato del Board Manager (`Throw` / `Takeout` / errori di connessione).\nCodice Refactored: visit handling, pitch handling (triple / bull) e logica del semaforo spostato a moduli separati.",
79
- "es": "Los puntos de datos de la luz de tráfico ( \"status.trafficLightColor \" , \"status.trafficLightState \" ) se mapearon con el estado de administrador de la Junta ( \" THrow \" / \" Takeout \" / errores de conexión).\nCódigo refactorizado: manejo de visitas, manejo de tiro (triple / toro) y lógica de tráfico se movió a módulos separados.",
80
- "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
- "uk": "Додано точки світла трафіку (`status.trafficLightColor`, `status.trafficLightState`) на карті Board Manager (`Throw` / `Takeout` / помилки підключення).\nРефакторний код: візитна обробка, кидання (стриптиз / бик) і логіка трафіку переходить на окремі модулі.",
82
- "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/lib/throw.js CHANGED
@@ -74,6 +74,42 @@ async function init(adapter) {
74
74
  },
75
75
  native: {},
76
76
  });
77
+ await adapter.extendObjectAsync("throw.isMiss", {
78
+ type: "state",
79
+ common: {
80
+ name: {
81
+ en: "Miss",
82
+ de: "Kein Treffer",
83
+ },
84
+ type: "boolean",
85
+ role: "indicator",
86
+ read: true,
87
+ write: false,
88
+ desc: {
89
+ en: "true if the dart did not hit a valid scoring segment",
90
+ de: "true, wenn der Dart kein gültiges Punktesegment getroffen hat",
91
+ },
92
+ },
93
+ native: {},
94
+ });
95
+ await adapter.extendObjectAsync("throw.isDouble", {
96
+ type: "state",
97
+ common: {
98
+ name: {
99
+ en: "Double hit",
100
+ de: "Doppel getroffen",
101
+ },
102
+ type: "boolean",
103
+ role: "indicator",
104
+ read: true,
105
+ write: false,
106
+ desc: {
107
+ en: "true if the dart hit a double segment",
108
+ de: "true, wenn ein Dart ein Doppel-Segment getroffen hat",
109
+ },
110
+ },
111
+ native: {},
112
+ });
77
113
  }
78
114
 
79
115
  /**
@@ -108,50 +144,46 @@ async function updateThrow(adapter, lastDart) {
108
144
 
109
145
  const isTriple =
110
146
  !!lastDart?.segment && lastDart.segment.multiplier === 3 && segment >= minScore && segment <= maxScore;
147
+ const isDouble = !!lastDart?.segment && lastDart.segment.multiplier === 2;
111
148
 
112
149
  const segName = (lastDart?.segment?.name || "").toUpperCase();
113
150
  const isBullseye = segName.includes("BULL") || lastDart?.segment?.number === 25;
151
+ const isMiss = !lastDart?.segment || score === 0;
114
152
 
115
153
  await adapter.setStateAsync("throw.current", { val: score, ack: true });
116
154
 
117
155
  // Timer für Auto-Reset abbrechen
118
- // @ts-expect-error - tripleResetTimer is a custom property in the Autodarts adapter class
119
- if (adapter.tripleResetTimer) {
120
- // @ts-expect-error - tripleResetTimer is a custom property in the Autodarts adapter class
121
- clearTimeout(adapter.tripleResetTimer);
122
- // @ts-expect-error - tripleResetTimer is a custom property in the Autodarts adapter class
123
- adapter.tripleResetTimer = null;
124
- }
125
- // @ts-expect-error - bullResetTimer is a custom property in the Autodarts adapter class
126
- if (adapter.bullResetTimer) {
127
- // @ts-expect-error - bullResetTimer is a custom property in the Autodarts adapter class
128
- clearTimeout(adapter.bullResetTimer);
129
- // @ts-expect-error - bullResetTimer is a custom property in the Autodarts adapter class
130
- adapter.bullResetTimer = null;
156
+ // @ts-expect-error - resetTimer is a custom property in the Autodarts adapter class
157
+ if (adapter.resetTimer) {
158
+ // @ts-expect-error - resetTimer is a custom property in the Autodarts adapter class
159
+ clearTimeout(adapter.resetTimer);
160
+ // @ts-expect-error - resetTimer is a custom property in the Autodarts adapter class
161
+ adapter.resetTimer = null;
131
162
  }
132
163
 
133
164
  await adapter.setStateAsync("throw.isTriple", { val: isTriple, ack: true });
165
+ await adapter.setStateAsync("throw.isDouble", { val: isDouble, ack: true });
134
166
  await adapter.setStateAsync("throw.isBullseye", { val: isBullseye, ack: true });
167
+ await adapter.setStateAsync("throw.isMiss", { val: isMiss, ack: true });
135
168
 
136
169
  // @ts-expect-error - triggerResetSecRuntime is a custom property in the Autodarts adapter class
137
170
  const timeoutMs = (Number(adapter.triggerResetSecRuntime) || 0) * 1000;
138
171
  if (timeoutMs > 0) {
139
- if (isTriple) {
140
- // @ts-expect-error - tripleResetTimer is a custom property in the Autodarts adapter class
141
- adapter.tripleResetTimer = setTimeout(() => {
172
+ adapter.resetTimer = setTimeout(() => {
173
+ if (isTriple) {
142
174
  adapter.setState("throw.isTriple", { val: false, ack: true });
143
- // @ts-expect-error - tripleResetTimer is a custom property in the Autodarts adapter class
144
- adapter.tripleResetTimer = null;
145
- }, timeoutMs);
146
- }
147
- if (isBullseye) {
148
- // @ts-expect-error - bullResetTimer is a custom property in the Autodarts adapter class
149
- adapter.bullResetTimer = setTimeout(() => {
175
+ }
176
+ if (isDouble) {
177
+ adapter.setState("throw.isDouble", { val: false, ack: true });
178
+ }
179
+ if (isBullseye) {
150
180
  adapter.setState("throw.isBullseye", { val: false, ack: true });
151
- // @ts-expect-error - bullResetTimer is a custom property in the Autodarts adapter class
152
- adapter.bullResetTimer = null;
153
- }, timeoutMs);
154
- }
181
+ }
182
+ if (isMiss) {
183
+ adapter.setState("throw.isMiss", { val: false, ack: true });
184
+ }
185
+ adapter.resetTimer = null;
186
+ }, timeoutMs);
155
187
  }
156
188
  }
157
189
 
package/main.js CHANGED
@@ -1,3 +1,4 @@
1
+ // main.js
1
2
  "use strict";
2
3
 
3
4
  const utils = require("@iobroker/adapter-core");
@@ -26,10 +27,9 @@ class Autodarts extends utils.Adapter {
26
27
  this.tripleMinScoreRuntime = null; // Laufzeitwert für Triple-Minschwelle
27
28
  this.tripleMaxScoreRuntime = null; // Laufzeitwert für Triple-Maxschwelle
28
29
 
29
- // NEU: Reset-Timeout + Timer für isTriple/isBullseye
30
+ // Reset-Timeout + Timer für isTriple/isBullseye/isDouble/isMiss
30
31
  this.triggerResetSecRuntime = null;
31
- this.tripleResetTimer = null;
32
- this.bullResetTimer = null;
32
+ this.resetTimer = null;
33
33
  }
34
34
 
35
35
  async onReady() {
@@ -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
 
@@ -704,11 +706,8 @@ class Autodarts extends utils.Adapter {
704
706
  if (this.versionTimer) {
705
707
  clearInterval(this.versionTimer);
706
708
  }
707
- if (this.tripleResetTimer) {
708
- clearTimeout(this.tripleResetTimer);
709
- }
710
- if (this.bullResetTimer) {
711
- clearTimeout(this.bullResetTimer);
709
+ if (this.resetTimer) {
710
+ clearTimeout(this.resetTimer);
712
711
  }
713
712
  callback();
714
713
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.autodarts",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Autodarts Autoscoring",
5
5
  "author": "skvarel <skvarel@inventwo.com>",
6
6
  "contributors": [