iobroker.autodarts 0.5.1 → 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 +6 -0
- package/admin/i18n/de.json +1 -1
- package/admin/i18n/en.json +1 -1
- package/admin/i18n/es.json +1 -1
- package/admin/i18n/fr.json +1 -1
- package/admin/i18n/it.json +1 -1
- package/admin/i18n/nl.json +1 -1
- package/admin/i18n/pl.json +1 -1
- package/admin/i18n/pt.json +1 -1
- package/admin/i18n/ru.json +1 -1
- package/admin/i18n/uk.json +1 -1
- package/admin/i18n/zh-cn.json +1 -1
- package/io-package.json +14 -14
- package/lib/throw.js +59 -27
- package/main.js +5 -8
- package/package.json +1 -1
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,10 @@ 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
|
+
|
|
88
94
|
### 0.5.1 (2025-12-28)
|
|
89
95
|
- (skvarel) Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.
|
|
90
96
|
|
package/admin/i18n/de.json
CHANGED
|
@@ -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
|
|
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.",
|
package/admin/i18n/en.json
CHANGED
|
@@ -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
|
|
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",
|
package/admin/i18n/es.json
CHANGED
|
@@ -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
|
|
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.",
|
package/admin/i18n/fr.json
CHANGED
|
@@ -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
|
|
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.",
|
package/admin/i18n/it.json
CHANGED
|
@@ -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": "
|
|
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.",
|
package/admin/i18n/nl.json
CHANGED
|
@@ -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
|
|
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.",
|
package/admin/i18n/pl.json
CHANGED
|
@@ -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
|
|
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.",
|
package/admin/i18n/pt.json
CHANGED
|
@@ -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
|
|
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.",
|
package/admin/i18n/ru.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"power_target": "Идентификатор цели по мощности",
|
|
12
12
|
"power_target_help": "Идентификатор цели мощности для управления мощностью через Autodarts (например, «switch.darts_socket»). Оставьте пустым, чтобы отключить управление питанием.",
|
|
13
13
|
"reset": "Триггер-Сброс (ы)",
|
|
14
|
-
"reset_help": "Сбросьте триггер и
|
|
14
|
+
"reset_help": "Сбросьте триггер тройного, двойного, яблочко и промаха через x секунд (0 = сброса нет).",
|
|
15
15
|
"triple_flag": "Минимальное поле для тройного триггера",
|
|
16
16
|
"triple_flag2": "Максимальное поле для тройного триггера",
|
|
17
17
|
"triple_flag2_help": "Поле максимального результата для тройного триггера. Дартс с результатом выше этого значения не будет активировать точку данных тройного триггера.",
|
package/admin/i18n/uk.json
CHANGED
|
@@ -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": "Скинути
|
|
14
|
+
"reset_help": "Скинути потрійний, подвійний, яблучний і промах через x секунд (0 = без скидання).",
|
|
15
15
|
"triple_flag": "Мінімальне поле для потрійного тригера",
|
|
16
16
|
"triple_flag2": "Максимальне поле для потрійного тригера",
|
|
17
17
|
"triple_flag2_help": "Поле максимального балу для потрійного тригера. Дартс із результатом вище цього значення не активує точку даних Triple-Trigger.",
|
package/admin/i18n/zh-cn.json
CHANGED
|
@@ -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
|
|
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,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "autodarts",
|
|
4
|
-
"version": "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
|
+
},
|
|
6
19
|
"0.5.1": {
|
|
7
20
|
"en": "Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.",
|
|
8
21
|
"de": "Behoben: Hardware-Licht/Strom-Mapping respektiert nun konfigurierte Ziel-IDs und arbeitet an allen Systemen.",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "Zmieniono: Tworzenie obiektu wykorzystuje teraz extendObjectAsync z odpowiednimi rolami i typami zamiast zestawu ObjectNotExistsAsync.",
|
|
81
94
|
"uk": "Змінено: Створення об'єктів тепер використовує розширенняObjectAsync з відповідними ролями та типами замість набору Об'єктNotExistsAsync.",
|
|
82
95
|
"zh-cn": "已更改 : 对象创建现在使用扩展对象Async , 并配有合适的角色和类型而不是设定 Object NotExists Async. (原始内容存档于2018-09-31)."
|
|
83
|
-
},
|
|
84
|
-
"0.3.0": {
|
|
85
|
-
"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.",
|
|
86
|
-
"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.",
|
|
87
|
-
"ru": "Добавлены точки данных светофора («status.trafficLightColor», «status.trafficLightState»), отображаемые из статуса менеджера совета директоров («Бросить» / «Выбрать» / ошибки подключения).\nРефакторированный код: обработка посещений, обработка бросков (тройной / бычий) и логика светофора перемещаются в отдельные модули.",
|
|
88
|
-
"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.",
|
|
89
|
-
"nl": "Toegevoegd verkeerslicht datapoints (.\nRefactored code: bezoeken handling, gooien handling (triple / stier) en verkeerslicht logica verplaatst naar aparte modules.",
|
|
90
|
-
"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.",
|
|
91
|
-
"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.",
|
|
92
|
-
"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.",
|
|
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.",
|
|
94
|
-
"uk": "Додано точки світла трафіку (`status.trafficLightColor`, `status.trafficLightState`) на карті Board Manager (`Throw` / `Takeout` / помилки підключення).\nРефакторний код: візитна обробка, кидання (стриптиз / бик) і логіка трафіку переходить на окремі модулі.",
|
|
95
|
-
"zh-cn": "增加从董事会管理者身份绘制的交通灯数据点(`Status.trafficLightColor ' ,`Status.trafficLight Station ' ) (`扔'/`Takeout ' /连接错误).\n重构代码:访问处理,投掷处理(三重/公牛)和交通灯逻辑移动到单独的模块."
|
|
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 -
|
|
119
|
-
if (adapter.
|
|
120
|
-
// @ts-expect-error -
|
|
121
|
-
clearTimeout(adapter.
|
|
122
|
-
// @ts-expect-error -
|
|
123
|
-
adapter.
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
adapter.tripleResetTimer = setTimeout(() => {
|
|
172
|
+
adapter.resetTimer = setTimeout(() => {
|
|
173
|
+
if (isTriple) {
|
|
142
174
|
adapter.setState("throw.isTriple", { val: false, ack: true });
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
//
|
|
30
|
+
// Reset-Timeout + Timer für isTriple/isBullseye/isDouble/isMiss
|
|
30
31
|
this.triggerResetSecRuntime = null;
|
|
31
|
-
this.
|
|
32
|
-
this.bullResetTimer = null;
|
|
32
|
+
this.resetTimer = null;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
async onReady() {
|
|
@@ -706,11 +706,8 @@ class Autodarts extends utils.Adapter {
|
|
|
706
706
|
if (this.versionTimer) {
|
|
707
707
|
clearInterval(this.versionTimer);
|
|
708
708
|
}
|
|
709
|
-
if (this.
|
|
710
|
-
clearTimeout(this.
|
|
711
|
-
}
|
|
712
|
-
if (this.bullResetTimer) {
|
|
713
|
-
clearTimeout(this.bullResetTimer);
|
|
709
|
+
if (this.resetTimer) {
|
|
710
|
+
clearTimeout(this.resetTimer);
|
|
714
711
|
}
|
|
715
712
|
callback();
|
|
716
713
|
} catch {
|