iobroker.autodarts 0.2.0 → 0.2.2
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 +2 -0
- package/admin/i18n/en.json +3 -1
- package/admin/i18n/es.json +2 -0
- package/admin/i18n/fr.json +2 -0
- package/admin/i18n/it.json +2 -0
- package/admin/i18n/nl.json +2 -0
- package/admin/i18n/pl.json +2 -0
- package/admin/i18n/pt.json +2 -0
- package/admin/i18n/ru.json +2 -0
- package/admin/i18n/uk.json +2 -0
- package/admin/i18n/zh-cn.json +2 -0
- package/admin/jsonConfig.json +17 -0
- package/io-package.json +27 -27
- package/main.js +87 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,12 @@ In the adapter settings, enter:
|
|
|
56
56
|
<!--
|
|
57
57
|
### **WORK IN PROGRESS**
|
|
58
58
|
-->
|
|
59
|
+
### 0.2.2 (2025-12-25)
|
|
60
|
+
- bugfix
|
|
61
|
+
|
|
62
|
+
### 0.2.1 (2025-12-25)
|
|
63
|
+
- Reset for triple and bullseye trigger added
|
|
64
|
+
|
|
59
65
|
### 0.2.0 (2025-12-25)
|
|
60
66
|
- Added datapoint for bulls-hit
|
|
61
67
|
- Added maximun triple-hit flag score
|
package/admin/i18n/de.json
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Konfiguration des Autodarts-Adapters.",
|
|
7
7
|
"polling": "Abfrageintervall (ms)",
|
|
8
8
|
"polling_help": "Abfrageintervall in Millisekunden zum Abrufen von Daten vom Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Trigger-Reset (ms)",
|
|
10
|
+
"reset_help": "Setzt den Triple- und Bullseye-Trigger nach x ms zurück (0 = kein Reset).",
|
|
9
11
|
"triple_flag": "Minimales Feld für den Triple-Trigger",
|
|
10
12
|
"triple_flag2": "Maximales Feld für den Triple-Trigger",
|
|
11
13
|
"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
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
"triple_flag": "Minimum field for the triple trigger",
|
|
10
10
|
"triple_flag2": "Maximum field for the triple trigger",
|
|
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
|
-
"triple_flag_help": "Minimum score field for the triple trigger. Darts with a score below this value will not trigger the Triple-Trigger datapoint."
|
|
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
|
+
"reset": "Trigger-Reset (ms)",
|
|
14
|
+
"reset_help": "Reset the triple and bullseye trigger after x ms (0 = no reset)."
|
|
13
15
|
}
|
package/admin/i18n/es.json
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Configuración del adaptador Autodarts.",
|
|
7
7
|
"polling": "Intervalo de sondeo (ms)",
|
|
8
8
|
"polling_help": "Intervalo de sondeo en milisegundos para recuperar datos del Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Restablecimiento del disparador (ms)",
|
|
10
|
+
"reset_help": "Restablezca el disparador triple y de diana después de x ms (0 = sin reinicio).",
|
|
9
11
|
"triple_flag": "Campo mínimo para el triple disparador",
|
|
10
12
|
"triple_flag2": "Campo máximo para el triple disparador",
|
|
11
13
|
"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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Configuration de l'adaptateur Autodarts.",
|
|
7
7
|
"polling": "Intervalle d'interrogation (ms)",
|
|
8
8
|
"polling_help": "Intervalle d'interrogation en millisecondes pour récupérer les données d'Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Déclencheur-réinitialisation (ms)",
|
|
10
|
+
"reset_help": "Réinitialisez le déclencheur triple et bullseye après x ms (0 = pas de réinitialisation).",
|
|
9
11
|
"triple_flag": "Champ minimum pour le triple déclencheur",
|
|
10
12
|
"triple_flag2": "Champ maximum pour le triple déclencheur",
|
|
11
13
|
"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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Configurazione dell'adattatore Autodarts.",
|
|
7
7
|
"polling": "Intervallo di polling (ms)",
|
|
8
8
|
"polling_help": "Intervallo di polling in millisecondi per recuperare i dati da Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Ripristino trigger (ms)",
|
|
10
|
+
"reset_help": "Ripristina il trigger triplo e bullseye dopo x ms (0 = nessun ripristino).",
|
|
9
11
|
"triple_flag": "Campo minimo per il triplo trigger",
|
|
10
12
|
"triple_flag2": "Campo massimo per il triplo trigger",
|
|
11
13
|
"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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Autodarts-adapterconfiguratie.",
|
|
7
7
|
"polling": "Polling-interval (ms)",
|
|
8
8
|
"polling_help": "Polling-interval in milliseconden om gegevens uit de Autodarts Boardmanager op te halen.",
|
|
9
|
+
"reset": "Trigger-reset (ms)",
|
|
10
|
+
"reset_help": "Reset de drievoudige en bullseye-trigger na x ms (0 = geen reset).",
|
|
9
11
|
"triple_flag": "Minimumveld voor de drievoudige trigger",
|
|
10
12
|
"triple_flag2": "Maximaal veld voor de drievoudige trigger",
|
|
11
13
|
"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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Konfiguracja adaptera Autodarts.",
|
|
7
7
|
"polling": "Interwał odpytywania (ms)",
|
|
8
8
|
"polling_help": "Interwał odpytywania w milisekundach w celu pobrania danych z menedżera Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Reset wyzwalacza (ms)",
|
|
10
|
+
"reset_help": "Zresetuj wyzwalacz potrójny i tarczy po x ms (0 = brak resetu).",
|
|
9
11
|
"triple_flag": "Minimalne pole dla potrójnego wyzwalacza",
|
|
10
12
|
"triple_flag2": "Maksymalne pole dla potrójnego wyzwalacza",
|
|
11
13
|
"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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Configuração do adaptador Autodarts.",
|
|
7
7
|
"polling": "Intervalo de pesquisa (ms)",
|
|
8
8
|
"polling_help": "Intervalo de pesquisa em milissegundos para recuperar dados do Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Reinicialização do gatilho (ms)",
|
|
10
|
+
"reset_help": "Redefina o gatilho triplo e alvo após x ms (0 = sem reinicialização).",
|
|
9
11
|
"triple_flag": "Campo mínimo para o disparo triplo",
|
|
10
12
|
"triple_flag2": "Campo máximo para o disparo triplo",
|
|
11
13
|
"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
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Конфигурация адаптера Autodarts.",
|
|
7
7
|
"polling": "Интервал опроса (мс)",
|
|
8
8
|
"polling_help": "Интервал опроса в миллисекундах для получения данных из Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Триггер-сброс (мс)",
|
|
10
|
+
"reset_help": "Сбросьте триггер и триггер «яблочко» через x мс (0 = сброса нет).",
|
|
9
11
|
"triple_flag": "Минимальное поле для тройного триггера",
|
|
10
12
|
"triple_flag2": "Максимальное поле для тройного триггера",
|
|
11
13
|
"triple_flag2_help": "Поле максимального результата для тройного триггера. Дартс с результатом выше этого значения не будет активировать точку данных тройного триггера.",
|
package/admin/i18n/uk.json
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Конфігурація адаптера Autodarts.",
|
|
7
7
|
"polling": "Інтервал опитування (мс)",
|
|
8
8
|
"polling_help": "Інтервал опитування в мілісекундах для отримання даних із Autodarts Boardmanager.",
|
|
9
|
+
"reset": "Скидання тригера (мс)",
|
|
10
|
+
"reset_help": "Скинути потрійний тригер і тригер «яблучко» через x мс (0 = без скидання).",
|
|
9
11
|
"triple_flag": "Мінімальне поле для потрійного тригера",
|
|
10
12
|
"triple_flag2": "Максимальне поле для потрійного тригера",
|
|
11
13
|
"triple_flag2_help": "Поле максимального балу для потрійного тригера. Дартс із результатом вище цього значення не активує точку даних Triple-Trigger.",
|
package/admin/i18n/zh-cn.json
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
"intro_txt": "Autodarts 适配器配置。",
|
|
7
7
|
"polling": "轮询间隔(毫秒)",
|
|
8
8
|
"polling_help": "从 Autodarts Boardmanager 检索数据的轮询间隔(以毫秒为单位)。",
|
|
9
|
+
"reset": "触发-复位(毫秒)",
|
|
10
|
+
"reset_help": "x 毫秒后重置三重触发器和牛眼触发器(0 = 不重置)。",
|
|
9
11
|
"triple_flag": "三重触发器的最小字段",
|
|
10
12
|
"triple_flag2": "三重触发器的最大字段",
|
|
11
13
|
"triple_flag2_help": "三重触发器的最大分数字段。分数高于此值的飞镖将不会触发三重触发数据点。",
|
package/admin/jsonConfig.json
CHANGED
|
@@ -126,10 +126,27 @@
|
|
|
126
126
|
"marginBottom": "10px"
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
|
+
"triggerResetMs": {
|
|
130
|
+
"type": "number",
|
|
131
|
+
"label": "reset",
|
|
132
|
+
"help": "reset_help",
|
|
133
|
+
"default": 0,
|
|
134
|
+
"newLine": true,
|
|
135
|
+
"sm": 12,
|
|
136
|
+
"xs": 12,
|
|
137
|
+
"md": 12,
|
|
138
|
+
"lg": 12,
|
|
139
|
+
"xl": 12,
|
|
140
|
+
"style": {
|
|
141
|
+
"marginTop": "10px",
|
|
142
|
+
"marginBottom": "10px"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
129
145
|
"interval": {
|
|
130
146
|
"type": "number",
|
|
131
147
|
"label": "polling",
|
|
132
148
|
"help": "polling_help",
|
|
149
|
+
"default": 1000,
|
|
133
150
|
"newLine": true,
|
|
134
151
|
"sm": 12,
|
|
135
152
|
"xs": 12,
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "autodarts",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.2.2": {
|
|
7
|
+
"en": "bugfix",
|
|
8
|
+
"de": "fehlerbehebung",
|
|
9
|
+
"ru": "исправление ошибок",
|
|
10
|
+
"pt": "correção de erros",
|
|
11
|
+
"nl": "bugfix",
|
|
12
|
+
"fr": "correction du bug",
|
|
13
|
+
"it": "bugfix",
|
|
14
|
+
"es": "bugfix",
|
|
15
|
+
"pl": "bugfix",
|
|
16
|
+
"uk": "панчохи",
|
|
17
|
+
"zh-cn": "错误修正"
|
|
18
|
+
},
|
|
19
|
+
"0.2.1": {
|
|
20
|
+
"en": "Reset for triple and bullseye trigger added",
|
|
21
|
+
"de": "Zurücksetzen für Triple und Bullseye Trigger hinzugefügt",
|
|
22
|
+
"ru": "Сброс тройного и бычьего триггера добавлен",
|
|
23
|
+
"pt": "Reiniciar para gatilho triplo e bullseye adicionado",
|
|
24
|
+
"nl": "Reset voor drievoudige en bullseye trigger toegevoegd",
|
|
25
|
+
"fr": "Réinitialiser pour triple et bullseye déclencheur ajouté",
|
|
26
|
+
"it": "Reset per trigger triple e bullseye aggiunto",
|
|
27
|
+
"es": "Reiniciar para triple y disparador de toros",
|
|
28
|
+
"pl": "Reset dla triple i bulseye wyzwalacz dodany",
|
|
29
|
+
"uk": "Зміщено переадресацію для тридцятого і буклесу",
|
|
30
|
+
"zh-cn": "重置三重和牛眼触发器"
|
|
31
|
+
},
|
|
6
32
|
"0.2.0": {
|
|
7
33
|
"en": "Added datapoint for bulls-hit\nAdded maximun triple-hit flag score\nUpdate config\nWarning in log cleared",
|
|
8
34
|
"de": "Datenpunkt für Bullen-Hit hinzugefügt\nZusätzlich maximun triple-hit flag score\nUpdate config\nWarnung im Protokoll gelöscht",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "fix",
|
|
68
94
|
"uk": "фіксація",
|
|
69
95
|
"zh-cn": "固定"
|
|
70
|
-
},
|
|
71
|
-
"0.0.9": {
|
|
72
|
-
"en": "fix",
|
|
73
|
-
"de": "fixieren",
|
|
74
|
-
"ru": "исправлять",
|
|
75
|
-
"pt": "corrigir",
|
|
76
|
-
"nl": "fix",
|
|
77
|
-
"fr": "correction",
|
|
78
|
-
"it": "correzione",
|
|
79
|
-
"es": "arregle",
|
|
80
|
-
"pl": "fix",
|
|
81
|
-
"uk": "фіксація",
|
|
82
|
-
"zh-cn": "固定"
|
|
83
|
-
},
|
|
84
|
-
"0.0.8": {
|
|
85
|
-
"en": "fix - Adapter Checker",
|
|
86
|
-
"de": "fix - Adapter Checker",
|
|
87
|
-
"ru": "обсуждение Adapter Checker",
|
|
88
|
-
"pt": "correção - Adapter Checker",
|
|
89
|
-
"nl": "fix - Adapterchecker",
|
|
90
|
-
"fr": "correction - Vérificateur d'adaptateur",
|
|
91
|
-
"it": "correzione - Adattatore Checker",
|
|
92
|
-
"es": "fijado - Adaptador Checker",
|
|
93
|
-
"pl": "fix - Kontrola adaptera",
|
|
94
|
-
"uk": "виправити - Перевірювач адаптера",
|
|
95
|
-
"zh-cn": "修补 - 适配器检查器"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/main.js
CHANGED
|
@@ -22,6 +22,11 @@ class Autodarts extends utils.Adapter {
|
|
|
22
22
|
|
|
23
23
|
this.tripleMinScoreRuntime = null; // Laufzeitwert für Triple-Minschwelle
|
|
24
24
|
this.tripleMaxScoreRuntime = null; // Laufzeitwert für Triple-Maxschwelle
|
|
25
|
+
|
|
26
|
+
// NEU: Reset-Timeout + Timer für isTriple/isBulleye
|
|
27
|
+
this.triggerResetMsRuntime = null;
|
|
28
|
+
this.tripleResetTimer = null;
|
|
29
|
+
this.bullResetTimer = null;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
async onReady() {
|
|
@@ -37,6 +42,9 @@ class Autodarts extends utils.Adapter {
|
|
|
37
42
|
// eslint-disable-next-line jsdoc/check-tag-names
|
|
38
43
|
/** @ts-expect-error tripleMaxScore is defined in io-package.json but not in AdapterConfig */
|
|
39
44
|
this.config.tripleMaxScore ??= 20; // Maximalpunktzahl für Triple-Flag
|
|
45
|
+
// eslint-disable-next-line jsdoc/check-tag-names
|
|
46
|
+
/** @ts-expect-error triggerResetMs is defined in io-package.json/jsonConfig but not in AdapterConfig */
|
|
47
|
+
this.config.triggerResetMs ??= 0; // 0 = kein Auto-Reset
|
|
40
48
|
|
|
41
49
|
// Visit-Struktur anlegen
|
|
42
50
|
await this.setObjectNotExistsAsync("visit", {
|
|
@@ -247,7 +255,7 @@ class Autodarts extends utils.Adapter {
|
|
|
247
255
|
native: {},
|
|
248
256
|
});
|
|
249
257
|
|
|
250
|
-
// Config-Channel und States für tripleMinScore / tripleMaxScore (zur Laufzeit änderbar)
|
|
258
|
+
// Config-Channel und States für tripleMinScore / tripleMaxScore / triggerResetMs (zur Laufzeit änderbar)
|
|
251
259
|
await this.setObjectNotExistsAsync("config", {
|
|
252
260
|
type: "channel",
|
|
253
261
|
common: {
|
|
@@ -297,6 +305,25 @@ class Autodarts extends utils.Adapter {
|
|
|
297
305
|
native: {},
|
|
298
306
|
});
|
|
299
307
|
|
|
308
|
+
await this.setObjectNotExistsAsync("config.triggerResetMs", {
|
|
309
|
+
type: "state",
|
|
310
|
+
common: {
|
|
311
|
+
name: {
|
|
312
|
+
en: "Triple/Bull reset (ms)",
|
|
313
|
+
de: "Triple/Bull Reset (ms)",
|
|
314
|
+
},
|
|
315
|
+
type: "number",
|
|
316
|
+
role: "value",
|
|
317
|
+
read: true,
|
|
318
|
+
write: true,
|
|
319
|
+
desc: {
|
|
320
|
+
en: "Time in ms after which isTriple and isBulleye are reset to false",
|
|
321
|
+
de: "Zeit in ms, nach der isTriple und isBulleye wieder auf false gesetzt werden",
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
native: {},
|
|
325
|
+
});
|
|
326
|
+
|
|
300
327
|
// Laufzeitwerte initial aus Adapter-Config setzen
|
|
301
328
|
// eslint-disable-next-line jsdoc/check-tag-names
|
|
302
329
|
/** @ts-expect-error tripleMinScore is defined in io-package.json but not in AdapterConfig */
|
|
@@ -304,6 +331,9 @@ class Autodarts extends utils.Adapter {
|
|
|
304
331
|
// eslint-disable-next-line jsdoc/check-tag-names
|
|
305
332
|
/** @ts-expect-error tripleMaxScore is defined in io-package.json but not in AdapterConfig */
|
|
306
333
|
this.tripleMaxScoreRuntime = Number(this.config.tripleMaxScore) || 20;
|
|
334
|
+
// eslint-disable-next-line jsdoc/check-tag-names
|
|
335
|
+
/** @ts-expect-error triggerResetMs is defined in io-package.json/jsonConfig but not in AdapterConfig */
|
|
336
|
+
this.triggerResetMsRuntime = Number(this.config.triggerResetMs) || 0; // 0 = kein Auto-Reset
|
|
307
337
|
|
|
308
338
|
await this.setStateAsync("config.tripleMinScore", {
|
|
309
339
|
val: this.tripleMinScoreRuntime,
|
|
@@ -313,10 +343,15 @@ class Autodarts extends utils.Adapter {
|
|
|
313
343
|
val: this.tripleMaxScoreRuntime,
|
|
314
344
|
ack: true,
|
|
315
345
|
});
|
|
346
|
+
await this.setStateAsync("config.triggerResetMs", {
|
|
347
|
+
val: this.triggerResetMsRuntime,
|
|
348
|
+
ack: true,
|
|
349
|
+
});
|
|
316
350
|
|
|
317
351
|
// Auf Änderungen am Config-State hören
|
|
318
352
|
this.subscribeStates("config.tripleMinScore");
|
|
319
353
|
this.subscribeStates("config.tripleMaxScore");
|
|
354
|
+
this.subscribeStates("config.triggerResetMs");
|
|
320
355
|
|
|
321
356
|
// Zustand zurücksetzen
|
|
322
357
|
this.lastThrowsCount = 0;
|
|
@@ -352,7 +387,7 @@ class Autodarts extends utils.Adapter {
|
|
|
352
387
|
}
|
|
353
388
|
|
|
354
389
|
/**
|
|
355
|
-
* Reaktion auf State-Änderungen (z. B. config.tripleMinScore / config.tripleMaxScore)
|
|
390
|
+
* Reaktion auf State-Änderungen (z. B. config.tripleMinScore / config.tripleMaxScore / config.triggerResetMs)
|
|
356
391
|
*
|
|
357
392
|
* @param {string} id Full state id
|
|
358
393
|
* @param {ioBroker.State | null | undefined} state New state value (ack=false on user write)
|
|
@@ -393,6 +428,18 @@ class Autodarts extends utils.Adapter {
|
|
|
393
428
|
|
|
394
429
|
// Wert mit ack bestätigen
|
|
395
430
|
this.setState("config.tripleMaxScore", { val, ack: true });
|
|
431
|
+
} else if (idShort === "config.triggerResetMs") {
|
|
432
|
+
const val = Number(state.val);
|
|
433
|
+
if (!Number.isFinite(val) || val < 0) {
|
|
434
|
+
this.log.warn(`Invalid triggerResetMs value: ${state.val}`);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
this.triggerResetMsRuntime = val;
|
|
439
|
+
this.log.info(`Runtime triggerResetMs updated to ${val} ms`);
|
|
440
|
+
|
|
441
|
+
// Wert mit ack bestätigen
|
|
442
|
+
this.setState("config.triggerResetMs", { val, ack: true });
|
|
396
443
|
}
|
|
397
444
|
}
|
|
398
445
|
|
|
@@ -443,6 +490,7 @@ class Autodarts extends utils.Adapter {
|
|
|
443
490
|
// letzten Dart in States schreiben
|
|
444
491
|
const lastDart = currentThrows[currentThrows.length - 1];
|
|
445
492
|
const score = this.calcScore(lastDart);
|
|
493
|
+
const segment = lastDart?.segment?.number || 0;
|
|
446
494
|
|
|
447
495
|
// Konfigurierte Score-Range für Triple-Flag:
|
|
448
496
|
// zuerst Laufzeitwerte, Fallback auf Adapter-Config
|
|
@@ -473,8 +521,8 @@ class Autodarts extends utils.Adapter {
|
|
|
473
521
|
const isTriple =
|
|
474
522
|
!!lastDart?.segment &&
|
|
475
523
|
lastDart.segment.multiplier === 3 &&
|
|
476
|
-
|
|
477
|
-
|
|
524
|
+
segment >= minScore &&
|
|
525
|
+
segment <= maxScore;
|
|
478
526
|
|
|
479
527
|
// Bulleye-Erkennung:
|
|
480
528
|
// je nach Autodarts-API typischerweise über segment.name ("BULL", "DBULL", "SBULL")
|
|
@@ -482,9 +530,38 @@ class Autodarts extends utils.Adapter {
|
|
|
482
530
|
const isBulleye = segName.includes("BULL") || lastDart?.segment?.number === 25; // Fallback
|
|
483
531
|
|
|
484
532
|
this.setState("throw.current", { val: score, ack: true });
|
|
533
|
+
|
|
534
|
+
// vorhandene Timer abbrechen, damit der Reset immer ab letztem Treffer zählt
|
|
535
|
+
if (this.tripleResetTimer) {
|
|
536
|
+
clearTimeout(this.tripleResetTimer);
|
|
537
|
+
this.tripleResetTimer = null;
|
|
538
|
+
}
|
|
539
|
+
if (this.bullResetTimer) {
|
|
540
|
+
clearTimeout(this.bullResetTimer);
|
|
541
|
+
this.bullResetTimer = null;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Flags setzen
|
|
485
545
|
this.setState("throw.isTriple", { val: isTriple, ack: true });
|
|
486
546
|
this.setState("throw.isBulleye", { val: isBulleye, ack: true });
|
|
487
547
|
|
|
548
|
+
// Auto-Reset nach triggerResetMs (0 = kein Auto-Reset)
|
|
549
|
+
const timeoutMs = Number(this.triggerResetMsRuntime) || 0;
|
|
550
|
+
if (timeoutMs > 0) {
|
|
551
|
+
if (isTriple) {
|
|
552
|
+
this.tripleResetTimer = setTimeout(() => {
|
|
553
|
+
this.setState("throw.isTriple", { val: false, ack: true });
|
|
554
|
+
this.tripleResetTimer = null;
|
|
555
|
+
}, timeoutMs);
|
|
556
|
+
}
|
|
557
|
+
if (isBulleye) {
|
|
558
|
+
this.bullResetTimer = setTimeout(() => {
|
|
559
|
+
this.setState("throw.isBulleye", { val: false, ack: true });
|
|
560
|
+
this.bullResetTimer = null;
|
|
561
|
+
}, timeoutMs);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
488
565
|
// Nur schreiben, wenn:
|
|
489
566
|
// - genau 3 Darts geworfen wurden
|
|
490
567
|
// - vorher weniger als 3 waren (Visit gerade abgeschlossen)
|
|
@@ -622,6 +699,12 @@ class Autodarts extends utils.Adapter {
|
|
|
622
699
|
if (this.versionTimer) {
|
|
623
700
|
clearInterval(this.versionTimer);
|
|
624
701
|
}
|
|
702
|
+
if (this.tripleResetTimer) {
|
|
703
|
+
clearTimeout(this.tripleResetTimer);
|
|
704
|
+
}
|
|
705
|
+
if (this.bullResetTimer) {
|
|
706
|
+
clearTimeout(this.bullResetTimer);
|
|
707
|
+
}
|
|
625
708
|
callback();
|
|
626
709
|
} catch {
|
|
627
710
|
callback();
|