iobroker.autodarts 0.0.12 → 0.1.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 +19 -0
- package/admin/i18n/de.json +2 -7
- package/admin/i18n/en.json +1 -6
- package/admin/i18n/es.json +1 -6
- package/admin/i18n/fr.json +1 -6
- package/admin/i18n/it.json +1 -6
- package/admin/i18n/nl.json +1 -6
- package/admin/i18n/pl.json +1 -6
- package/admin/i18n/pt.json +1 -6
- package/admin/i18n/ru.json +1 -6
- package/admin/i18n/uk.json +1 -6
- package/admin/i18n/zh-cn.json +1 -6
- package/admin/jsonConfig.json +11 -0
- package/io-package.json +27 -27
- package/main.js +222 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
- Announce the current player via TTS.
|
|
20
20
|
- Trigger other automations in ioBroker.
|
|
21
21
|
|
|
22
|
+
It also provides:
|
|
23
|
+
|
|
24
|
+
- `visit.score`: Total score of the last complete visit (3 darts).
|
|
25
|
+
- `throw.current`: Numeric score of the last thrown dart.
|
|
26
|
+
- `throw.isTriple`: Boolean flag that only turns true for triple hits above a configurable score threshold.
|
|
27
|
+
- `system.boardVersion`: Reported Board Manager version.
|
|
28
|
+
- `system.cam0/1/2`: JSON with camera settings (width, height, fps).
|
|
29
|
+
|
|
22
30
|
## What this adapter does NOT do
|
|
23
31
|
|
|
24
32
|
- ❌ No data is sent to the internet or to third-party servers.
|
|
@@ -47,6 +55,17 @@ In the adapter settings, enter:
|
|
|
47
55
|
<!--
|
|
48
56
|
### **WORK IN PROGRESS**
|
|
49
57
|
-->
|
|
58
|
+
### 0.1.0 (2025-12-23)
|
|
59
|
+
- Added datapoints for visit score, current dart score, triple-hit flag with configurable minimum score, and camera configuration (cam0–cam2).
|
|
60
|
+
- Cleaned up adapter logic and internal polling/timing.
|
|
61
|
+
- Updated translations.
|
|
62
|
+
|
|
63
|
+
### 0.0.14 (2025-12-22)
|
|
64
|
+
- fix
|
|
65
|
+
|
|
66
|
+
### 0.0.13 (2025-12-22)
|
|
67
|
+
- translate
|
|
68
|
+
|
|
50
69
|
### 0.0.12 (2025-12-22)
|
|
51
70
|
- fix
|
|
52
71
|
|
package/admin/i18n/de.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Autodarts-Board online",
|
|
3
|
-
"board_online_desc": "true = Board erreichbar, false = nicht erreichbar",
|
|
4
2
|
"host_ip": "Autodarts (Boardmanager) Host / IP",
|
|
5
3
|
"host_port": "Autodarts (Boardmanager) Port",
|
|
6
|
-
"intro_txt": "Autodarts-Adapterkonfiguration.<br>Bitte
|
|
4
|
+
"intro_txt": "Autodarts-Adapterkonfiguration.<br>Bitte gebe IP und Port vom Boardmanager sowie den Abfrageintervall ein.",
|
|
7
5
|
"outro_txt": "Team inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Abfrageintervall (ms)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Version des Boardmanager",
|
|
11
|
-
"visit_score": "Aufnahme (insgesamt 3 Darts)",
|
|
12
|
-
"visit_score_dec": "Gesamtsumme der letzten vollständigen Aufnahme"
|
|
7
|
+
"triple_flag": "Mindestpunktzahl für den Triple-Datenpunkt"
|
|
13
8
|
}
|
package/admin/i18n/en.json
CHANGED
|
@@ -4,10 +4,5 @@
|
|
|
4
4
|
"host_ip": "Autodarts (Boardmanager) Host / IP",
|
|
5
5
|
"host_port": "Autodarts (Boardmanager) Port",
|
|
6
6
|
"polling": "Polling interval (ms)",
|
|
7
|
-
"
|
|
8
|
-
"visit_score_dec": "Total of the last complete visit",
|
|
9
|
-
"board_online": "Autodarts Board online",
|
|
10
|
-
"board_online_desc": "true = Board reachable, false = not reachable",
|
|
11
|
-
"software_version": "Board manager version",
|
|
12
|
-
"software_version_desc": "Version of the board manager"
|
|
7
|
+
"triple_flag": "Minimum score for Triple Flag"
|
|
13
8
|
}
|
package/admin/i18n/es.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Tablero de dardos en línea",
|
|
3
|
-
"board_online_desc": "verdadero = Tablero accesible, falso = no accesible",
|
|
4
2
|
"host_ip": "Autodarts (Boardmanager) Host/IP",
|
|
5
3
|
"host_port": "Puerto Autodarts (Boardmanager)",
|
|
6
4
|
"intro_txt": "Configuración del adaptador Autodarts.<br>Ingrese el host y el puerto de Boardmanager, así como el intervalo de sondeo.",
|
|
7
5
|
"outro_txt": "Equipo inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Intervalo de sondeo (ms)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Versión del administrador de la junta",
|
|
11
|
-
"visit_score": "Puntuación de visita (Total de 3 dardos)",
|
|
12
|
-
"visit_score_dec": "Total de la última visita completa"
|
|
7
|
+
"triple_flag": "Puntuación mínima para Triple Bandera"
|
|
13
8
|
}
|
package/admin/i18n/fr.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Tableau d'Autodarts en ligne",
|
|
3
|
-
"board_online_desc": "true = Tableau accessible, false = non accessible",
|
|
4
2
|
"host_ip": "Hôte / IP Autodarts (Boardmanager)",
|
|
5
3
|
"host_port": "Port Autodarts (Boardmanager)",
|
|
6
4
|
"intro_txt": "Configuration de l'adaptateur Autodarts.<br>Veuillez saisir l'hôte et le port de Boardmanager ainsi que l'intervalle d'interrogation.",
|
|
7
5
|
"outro_txt": "Équipe inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Intervalle d'interrogation (ms)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Version du gestionnaire du conseil d'administration",
|
|
11
|
-
"visit_score": "Score de visite (Total de 3 fléchettes)",
|
|
12
|
-
"visit_score_dec": "Total de la dernière visite complète"
|
|
7
|
+
"triple_flag": "Score minimum pour le triple drapeau"
|
|
13
8
|
}
|
package/admin/i18n/it.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Gioco di freccette automatiche online",
|
|
3
|
-
"board_online_desc": "true = scheda raggiungibile, false = non raggiungibile",
|
|
4
2
|
"host_ip": "Host/IP Autodarts (Boardmanager).",
|
|
5
3
|
"host_port": "Porta Autodarts (Boardmanager).",
|
|
6
4
|
"intro_txt": "Configurazione dell'adattatore Autodarts.<br>Inserisci host e porta da Boardmanager nonché l'intervallo di polling.",
|
|
7
5
|
"outro_txt": "Team inventtwo • <a href=\"https://github.com/inventtwo\">https://github.com/inventtwo</a>",
|
|
8
6
|
"polling": "Intervallo di polling (ms)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Versione del consiglio di amministrazione",
|
|
11
|
-
"visit_score": "Punteggio della visita (totale di 3 freccette)",
|
|
12
|
-
"visit_score_dec": "Totale dell'ultima visita completa"
|
|
7
|
+
"triple_flag": "Punteggio minimo per Triple Flag"
|
|
13
8
|
}
|
package/admin/i18n/nl.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Autodartsbord online",
|
|
3
|
-
"board_online_desc": "true = Board bereikbaar, false = niet bereikbaar",
|
|
4
2
|
"host_ip": "Autodarts (Boardmanager) Host / IP",
|
|
5
3
|
"host_port": "Autodarts (Bestuursmanager) Port",
|
|
6
4
|
"intro_txt": "Autodarts-adapterconfiguratie.<br>Voer de host en poort van Boardmanager in, evenals het polling-interval.",
|
|
7
5
|
"outro_txt": "Team inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Polling-interval (ms)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Versie van de bestuursmanager",
|
|
11
|
-
"visit_score": "Bezoekscore (totaal 3 darts)",
|
|
12
|
-
"visit_score_dec": "Totaal van het laatste volledige bezoek"
|
|
7
|
+
"triple_flag": "Minimumscore voor Triple Flag"
|
|
13
8
|
}
|
package/admin/i18n/pl.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Tablica Autodarts online",
|
|
3
|
-
"board_online_desc": "true = tablica osiągalna, false = nieosiągalna",
|
|
4
2
|
"host_ip": "Autodarts (Boardmanager) Host / IP",
|
|
5
3
|
"host_port": "Port Autodarts (Boardmanager).",
|
|
6
4
|
"intro_txt": "Konfiguracja adaptera Autodarts.<br>Wprowadź host i port z Boardmanager oraz interwał odpytywania.",
|
|
7
5
|
"outro_txt": "Zespół inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Interwał odpytywania (ms)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Wersja menadżera zarządu",
|
|
11
|
-
"visit_score": "Wynik wizyty (łącznie 3 rzutki)",
|
|
12
|
-
"visit_score_dec": "Suma ostatniej pełnej wizyty"
|
|
7
|
+
"triple_flag": "Minimalny wynik dla Potrójnej Flagi"
|
|
13
8
|
}
|
package/admin/i18n/pt.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Placa Autodarts on-line",
|
|
3
|
-
"board_online_desc": "verdadeiro = placa acessível, falso = não acessível",
|
|
4
2
|
"host_ip": "Host/IP do Autodarts (Boardmanager)",
|
|
5
3
|
"host_port": "Porto Autodarts (Boardmanager)",
|
|
6
4
|
"intro_txt": "Configuração do adaptador Autodarts.<br>Insira o host e a porta do Boardmanager, bem como o intervalo de pesquisa.",
|
|
7
5
|
"outro_txt": "Equipe inventtwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Intervalo de pesquisa (ms)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Versão do gerenciador do conselho",
|
|
11
|
-
"visit_score": "Pontuação da visita (Total de 3 dardos)",
|
|
12
|
-
"visit_score_dec": "Total da última visita completa"
|
|
7
|
+
"triple_flag": "Pontuação mínima para Tripla Bandeira"
|
|
13
8
|
}
|
package/admin/i18n/ru.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Доска автодартс онлайн",
|
|
3
|
-
"board_online_desc": "true = доска доступна, false = недоступна",
|
|
4
2
|
"host_ip": "Autodarts (Boardmanager) Хост/IP",
|
|
5
3
|
"host_port": "Порт Autodarts (Boardmanager)",
|
|
6
4
|
"intro_txt": "Конфигурация адаптера Autodarts.<br>Укажите хост и порт из Boardmanager, а также интервал опроса.",
|
|
7
5
|
"outro_txt": "Команда inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Интервал опроса (мс)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Версия менеджера форума",
|
|
11
|
-
"visit_score": "Оценка посещения (всего 3 дротика)",
|
|
12
|
-
"visit_score_dec": "Всего за последнее полное посещение"
|
|
7
|
+
"triple_flag": "Минимальный балл для тройного флага"
|
|
13
8
|
}
|
package/admin/i18n/uk.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "Autodarts Board онлайн",
|
|
3
|
-
"board_online_desc": "true = дошка доступна, false = недоступна",
|
|
4
2
|
"host_ip": "Autodarts (Boardmanager) Хост / IP",
|
|
5
3
|
"host_port": "Autodarts (Boardmanager) Порт",
|
|
6
4
|
"intro_txt": "Конфігурація адаптера Autodarts.<br>Введіть хост і порт із Boardmanager, а також інтервал опитування.",
|
|
7
5
|
"outro_txt": "Команда inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "Інтервал опитування (мс)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "Версія керуючої дошки",
|
|
11
|
-
"visit_score": "Рахунок за відвідування (всього 3 дротики)",
|
|
12
|
-
"visit_score_dec": "Загальна кількість останнього повного відвідування"
|
|
7
|
+
"triple_flag": "Мінімальний бал для потрійного прапора"
|
|
13
8
|
}
|
package/admin/i18n/zh-cn.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"board_online": "在线自动飞镖板",
|
|
3
|
-
"board_online_desc": "true = 董事会可访问,false = 不可访问",
|
|
4
2
|
"host_ip": "Autodarts (Boardmanager) 主机/IP",
|
|
5
3
|
"host_port": "Autodarts(Boardmanager)端口",
|
|
6
4
|
"intro_txt": "Autodarts 适配器配置。<br>请输入 Boardmanager 中的主机和端口以及轮询间隔。",
|
|
7
5
|
"outro_txt": "团队 inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a>",
|
|
8
6
|
"polling": "轮询间隔(毫秒)",
|
|
9
|
-
"
|
|
10
|
-
"software_version_desc": "董事会经理版本",
|
|
11
|
-
"visit_score": "访问分数(共 3 飞镖)",
|
|
12
|
-
"visit_score_dec": "上次完整访问的总计"
|
|
7
|
+
"triple_flag": "三旗最低分数"
|
|
13
8
|
}
|
package/admin/jsonConfig.json
CHANGED
|
@@ -50,6 +50,17 @@
|
|
|
50
50
|
"lg": 6,
|
|
51
51
|
"xl": 4
|
|
52
52
|
},
|
|
53
|
+
"tripleMinScore": {
|
|
54
|
+
"type": "number",
|
|
55
|
+
"label": "triple_flag",
|
|
56
|
+
"default": 1,
|
|
57
|
+
"newLine": true,
|
|
58
|
+
"sm": 12,
|
|
59
|
+
"xs": 12,
|
|
60
|
+
"md": 8,
|
|
61
|
+
"lg": 6,
|
|
62
|
+
"xl": 4
|
|
63
|
+
},
|
|
53
64
|
"outro": {
|
|
54
65
|
"type": "staticText",
|
|
55
66
|
"text": "outro_txt",
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "autodarts",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.1.0": {
|
|
7
|
+
"en": "Added datapoints for visit score, current dart score, triple-hit flag with configurable minimum score, and camera configuration (cam0–cam2).\nCleaned up adapter logic and internal polling/timing.\nUpdated translations.",
|
|
8
|
+
"de": "Weitere Datenpunkte für Besuchscore, aktuelle Dart-Score, Tripel-hit-Flag mit konfigurierbaren minimalen Punktzahl und Kamerakonfiguration (cam0–cam2).\nAufgereinigte Adapterlogik und interne Abfrage/timing.\nAktualisierte Übersetzungen.",
|
|
9
|
+
"ru": "Добавлены точки данных для оценки посещений, текущая оценка дарта, флаг тройного удара с настраиваемым минимальным баллом и конфигурация камеры (cam0-cam2).\nОчищена адаптерная логика и внутренний опрос/настройка.\nОбновленные переводы.",
|
|
10
|
+
"pt": "Adicionados pontos de dados para a pontuação de visita, pontuação de dardo atual, bandeira de triplo hit com pontuação mínima configurável, e configuração da câmera (cam0–cam2).\nLimpei a lógica do adaptador e as pesquisas internas.\nTradução atualizada.",
|
|
11
|
+
"nl": "Toegevoegd datapoints voor bezoek score, huidige dart score, triple-hit vlag met configureerbare minimum score, en camera configuratie (cam0.\nOpgeruimd adapter logica en interne peiling / timing.\nBijgewerkte vertalingen.",
|
|
12
|
+
"fr": "Ajout de points de données pour le score de visite, le score de fléchette actuel, le drapeau triple-hit avec le score minimum configurable et la configuration de la caméra (cam0–cam2).\nNettoyer la logique de l'adaptateur et effectuer des sondages internes/timing.\nTraductions actualisées.",
|
|
13
|
+
"it": "Aggiunti i datapoint per il punteggio di visita, il punteggio di freccette corrente, la bandiera a triplo punto con il punteggio minimo configurabile e la configurazione della fotocamera (cam0–cam2).\nPulito logica adattatore e polling/timing interno.\nTraduzione aggiornata.",
|
|
14
|
+
"es": "Puntos de datos añadidos para la puntuación de la visita, puntaje del dardo actual, bandera triple con puntaje mínimo configurable, y configuración de la cámara (cam0–cam2).\nLógica del adaptador limpiado y polinización interna / estimulación.\nTraducciones actualizadas.",
|
|
15
|
+
"pl": "Dodano punkty datapointowe dla wyniku odwiedzin, aktualny wynik dart, flagę trójuderzeniową z konfigurowalnym minimalnym wynikiem oraz konfigurację kamery (cam0- cam2).\nOczyszczona logika adaptera i wewnętrzny sondaż / czas.\nAktualizacja tłumaczeń.",
|
|
16
|
+
"uk": "Додано точки даних для облікового запису, поточний запис dart, потрійний прапор з налаштуванням мінімального балу та конфігурації камери (cam0–cam2).\nЗнімання логіки адаптера та внутрішнього опитування / термінів.\nОновлені переклади.",
|
|
17
|
+
"zh-cn": "添加了访问分数的数据点,当前飞镖分数,三重击旗可配置最小分数,以及相机配置(cam0–cam2).\n清理适配器逻辑和内部投票/计时.\n最新译名."
|
|
18
|
+
},
|
|
19
|
+
"0.0.14": {
|
|
20
|
+
"en": "fix",
|
|
21
|
+
"de": "fixieren",
|
|
22
|
+
"ru": "исправлять",
|
|
23
|
+
"pt": "corrigir",
|
|
24
|
+
"nl": "fix",
|
|
25
|
+
"fr": "correction",
|
|
26
|
+
"it": "correzione",
|
|
27
|
+
"es": "arregle",
|
|
28
|
+
"pl": "fix",
|
|
29
|
+
"uk": "фіксація",
|
|
30
|
+
"zh-cn": "固定"
|
|
31
|
+
},
|
|
6
32
|
"0.0.12": {
|
|
7
33
|
"en": "fix",
|
|
8
34
|
"de": "fixieren",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "fix - Kontrola adaptera",
|
|
68
94
|
"uk": "виправити - Перевірювач адаптера",
|
|
69
95
|
"zh-cn": "修补 - 适配器检查器"
|
|
70
|
-
},
|
|
71
|
-
"0.0.6": {
|
|
72
|
-
"en": "fix - Adapter Checker",
|
|
73
|
-
"de": "fix - Adapter Checker",
|
|
74
|
-
"ru": "обсуждение Adapter Checker",
|
|
75
|
-
"pt": "correção - Adapter Checker",
|
|
76
|
-
"nl": "fix - Adapterchecker",
|
|
77
|
-
"fr": "correction - Vérificateur d'adaptateur",
|
|
78
|
-
"it": "correzione - Adattatore Checker",
|
|
79
|
-
"es": "fijado - Adaptador Checker",
|
|
80
|
-
"pl": "fix - Kontrola adaptera",
|
|
81
|
-
"uk": "виправити - Перевірювач адаптера",
|
|
82
|
-
"zh-cn": "修补 - 适配器检查器"
|
|
83
|
-
},
|
|
84
|
-
"0.0.5": {
|
|
85
|
-
"en": "Update Description",
|
|
86
|
-
"de": "Update Beschreibung",
|
|
87
|
-
"ru": "Обновленное описание",
|
|
88
|
-
"pt": "Atualizar Descrição",
|
|
89
|
-
"nl": "Beschrijving bijwerken",
|
|
90
|
-
"fr": "Mettre à jour la description",
|
|
91
|
-
"it": "Descrizione dell'aggiornamento",
|
|
92
|
-
"es": "Actualización",
|
|
93
|
-
"pl": "Aktualizacja opisu",
|
|
94
|
-
"uk": "Опис оновлення",
|
|
95
|
-
"zh-cn": "更新描述"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/main.js
CHANGED
|
@@ -17,7 +17,7 @@ class Autodarts extends utils.Adapter {
|
|
|
17
17
|
this.lastThrowsCount = 0; // Anzahl Darts im aktuellen Visit
|
|
18
18
|
this.lastSignature = ""; // Verhindert doppelte Verarbeitung gleicher Würfe
|
|
19
19
|
this.offline = false;
|
|
20
|
-
this.versionTimer = null; // Timer für
|
|
20
|
+
this.versionTimer = null; // Timer für Versions- und Config-Abfrage
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
async onReady() {
|
|
@@ -27,23 +27,87 @@ class Autodarts extends utils.Adapter {
|
|
|
27
27
|
this.config.host ??= "127.0.0.1";
|
|
28
28
|
this.config.port ??= 3180;
|
|
29
29
|
this.config.interval ??= 1000;
|
|
30
|
+
// eslint-disable-next-line jsdoc/check-tag-names
|
|
31
|
+
/** @ts-expect-error tripleMinScore is defined in io-package.json but not in AdapterConfig */
|
|
32
|
+
this.config.tripleMinScore ??= 1; // Mindestpunktzahl für Triple-Flag
|
|
30
33
|
|
|
31
34
|
// Visit-Struktur anlegen
|
|
32
35
|
await this.setObjectNotExistsAsync("visit", {
|
|
33
36
|
type: "channel",
|
|
34
|
-
common: {
|
|
37
|
+
common: {
|
|
38
|
+
name: {
|
|
39
|
+
en: "Current visit",
|
|
40
|
+
de: "Aktuelle Aufnahme",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
35
43
|
native: {},
|
|
36
44
|
});
|
|
37
45
|
|
|
38
46
|
await this.setObjectNotExistsAsync("visit.score", {
|
|
39
47
|
type: "state",
|
|
40
48
|
common: {
|
|
41
|
-
name:
|
|
49
|
+
name: {
|
|
50
|
+
en: "Visit score (Total of 3 darts)",
|
|
51
|
+
de: "Aufnahme (Summe dreier Darts)",
|
|
52
|
+
},
|
|
53
|
+
type: "number",
|
|
54
|
+
role: "value",
|
|
55
|
+
read: true,
|
|
56
|
+
write: false,
|
|
57
|
+
desc: {
|
|
58
|
+
en: "Total of the last complete visit",
|
|
59
|
+
de: "Summe der letzten vollständigen Aufnahme",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
native: {},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Throw-Channel und States
|
|
66
|
+
await this.setObjectNotExistsAsync("throw", {
|
|
67
|
+
type: "channel",
|
|
68
|
+
common: {
|
|
69
|
+
name: {
|
|
70
|
+
en: "Current throw",
|
|
71
|
+
de: "Aktueller Wurf",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
native: {},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
await this.setObjectNotExistsAsync("throw.current", {
|
|
78
|
+
type: "state",
|
|
79
|
+
common: {
|
|
80
|
+
name: {
|
|
81
|
+
en: "Current dart score",
|
|
82
|
+
de: "Punkte aktueller Pfeil",
|
|
83
|
+
},
|
|
42
84
|
type: "number",
|
|
43
85
|
role: "value",
|
|
44
86
|
read: true,
|
|
45
87
|
write: false,
|
|
46
|
-
desc:
|
|
88
|
+
desc: {
|
|
89
|
+
en: "Score of the last dart",
|
|
90
|
+
de: "Punktzahl des letzten Pfeils",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
native: {},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
await this.setObjectNotExistsAsync("throw.isTriple", {
|
|
97
|
+
type: "state",
|
|
98
|
+
common: {
|
|
99
|
+
name: {
|
|
100
|
+
en: "Triple hit",
|
|
101
|
+
de: "Triple getroffen",
|
|
102
|
+
},
|
|
103
|
+
type: "boolean",
|
|
104
|
+
role: "indicator",
|
|
105
|
+
read: true,
|
|
106
|
+
write: false,
|
|
107
|
+
desc: {
|
|
108
|
+
en: "true if the last dart hit a triple segment (and passes score threshold)",
|
|
109
|
+
de: "true, wenn der letzte Pfeil ein Triple-Segment getroffen hat (und die Punktschwelle erfüllt)",
|
|
110
|
+
},
|
|
47
111
|
},
|
|
48
112
|
native: {},
|
|
49
113
|
});
|
|
@@ -52,12 +116,18 @@ class Autodarts extends utils.Adapter {
|
|
|
52
116
|
await this.setObjectNotExistsAsync("online", {
|
|
53
117
|
type: "state",
|
|
54
118
|
common: {
|
|
55
|
-
name:
|
|
119
|
+
name: {
|
|
120
|
+
en: "Autodarts board online",
|
|
121
|
+
de: "Autodarts Board online",
|
|
122
|
+
},
|
|
56
123
|
type: "boolean",
|
|
57
124
|
role: "indicator.reachable",
|
|
58
125
|
read: true,
|
|
59
126
|
write: false,
|
|
60
|
-
desc:
|
|
127
|
+
desc: {
|
|
128
|
+
en: "true = Board reachable, false = Board not reachable",
|
|
129
|
+
de: "true = Board erreichbar, false = Board nicht erreichbar",
|
|
130
|
+
},
|
|
61
131
|
},
|
|
62
132
|
native: {},
|
|
63
133
|
});
|
|
@@ -65,19 +135,88 @@ class Autodarts extends utils.Adapter {
|
|
|
65
135
|
// System-Channel und BoardVersion-Datenpunkt anlegen
|
|
66
136
|
await this.setObjectNotExistsAsync("system", {
|
|
67
137
|
type: "channel",
|
|
68
|
-
common: {
|
|
138
|
+
common: {
|
|
139
|
+
name: {
|
|
140
|
+
en: "Information about the system",
|
|
141
|
+
de: "Informationen zum System",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
69
144
|
native: {},
|
|
70
145
|
});
|
|
71
146
|
|
|
72
147
|
await this.setObjectNotExistsAsync("system.boardVersion", {
|
|
73
148
|
type: "state",
|
|
74
149
|
common: {
|
|
75
|
-
name:
|
|
150
|
+
name: {
|
|
151
|
+
en: "Board manager version",
|
|
152
|
+
de: "Version des Board-Manager",
|
|
153
|
+
},
|
|
76
154
|
type: "string",
|
|
77
155
|
role: "info.version",
|
|
78
156
|
read: true,
|
|
79
157
|
write: false,
|
|
80
|
-
desc:
|
|
158
|
+
desc: {
|
|
159
|
+
en: "Version of the board manager",
|
|
160
|
+
de: "Version des Board-Manager",
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
native: {},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Kamera-Infos als JSON-States
|
|
167
|
+
await this.setObjectNotExistsAsync("system.cam0", {
|
|
168
|
+
type: "state",
|
|
169
|
+
common: {
|
|
170
|
+
name: {
|
|
171
|
+
en: "Camera 0 config",
|
|
172
|
+
de: "Kamera 0 Konfiguration",
|
|
173
|
+
},
|
|
174
|
+
type: "string",
|
|
175
|
+
role: "json",
|
|
176
|
+
read: true,
|
|
177
|
+
write: false,
|
|
178
|
+
desc: {
|
|
179
|
+
en: "JSON with camera 0 parameters (width, height, fps)",
|
|
180
|
+
de: "JSON mit Kamera-0-Parametern (width, height, fps)",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
native: {},
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
await this.setObjectNotExistsAsync("system.cam1", {
|
|
187
|
+
type: "state",
|
|
188
|
+
common: {
|
|
189
|
+
name: {
|
|
190
|
+
en: "Camera 1 config",
|
|
191
|
+
de: "Kamera 1 Konfiguration",
|
|
192
|
+
},
|
|
193
|
+
type: "string",
|
|
194
|
+
role: "json",
|
|
195
|
+
read: true,
|
|
196
|
+
write: false,
|
|
197
|
+
desc: {
|
|
198
|
+
en: "JSON with camera 1 parameters (width, height, fps)",
|
|
199
|
+
de: "JSON mit Kamera-1-Parametern (width, height, fps)",
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
native: {},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
await this.setObjectNotExistsAsync("system.cam2", {
|
|
206
|
+
type: "state",
|
|
207
|
+
common: {
|
|
208
|
+
name: {
|
|
209
|
+
en: "Camera 2 config",
|
|
210
|
+
de: "Kamera 2 Konfiguration",
|
|
211
|
+
},
|
|
212
|
+
type: "string",
|
|
213
|
+
role: "json",
|
|
214
|
+
read: true,
|
|
215
|
+
write: false,
|
|
216
|
+
desc: {
|
|
217
|
+
en: "JSON with camera 2 parameters (width, height, fps)",
|
|
218
|
+
de: "JSON mit Kamera-2-Parametern (width, height, fps)",
|
|
219
|
+
},
|
|
81
220
|
},
|
|
82
221
|
native: {},
|
|
83
222
|
});
|
|
@@ -90,9 +229,16 @@ class Autodarts extends utils.Adapter {
|
|
|
90
229
|
this.pollTimer = setInterval(() => this.fetchState(), this.config.interval);
|
|
91
230
|
this.fetchState();
|
|
92
231
|
|
|
93
|
-
// Boardmanager-Version abfragen und alle 5 Minuten aktualisieren
|
|
232
|
+
// Boardmanager-Version und Kameras abfragen und alle 5 Minuten aktualisieren
|
|
94
233
|
this.fetchVersion();
|
|
95
|
-
this.
|
|
234
|
+
this.fetchConfig();
|
|
235
|
+
this.versionTimer = setInterval(
|
|
236
|
+
() => {
|
|
237
|
+
this.fetchVersion();
|
|
238
|
+
this.fetchConfig();
|
|
239
|
+
},
|
|
240
|
+
5 * 60 * 1000,
|
|
241
|
+
);
|
|
96
242
|
}
|
|
97
243
|
|
|
98
244
|
/**
|
|
@@ -152,6 +298,21 @@ class Autodarts extends utils.Adapter {
|
|
|
152
298
|
}
|
|
153
299
|
this.lastSignature = signature;
|
|
154
300
|
|
|
301
|
+
// letzten Dart in States schreiben
|
|
302
|
+
const lastDart = currentThrows[currentThrows.length - 1];
|
|
303
|
+
const score = this.calcScore(lastDart);
|
|
304
|
+
|
|
305
|
+
// Konfigurierter Mindestwert für Triple-Flag
|
|
306
|
+
// eslint-disable-next-line jsdoc/check-tag-names
|
|
307
|
+
/** @ts-expect-error tripleMinScore is defined in io-package.json but not in AdapterConfig */
|
|
308
|
+
const minScore = Number(this.config.tripleMinScore) || 0;
|
|
309
|
+
|
|
310
|
+
// Triple nur, wenn multiplier === 3 UND score >= minScore
|
|
311
|
+
const isTriple = !!lastDart?.segment && lastDart.segment.multiplier === 3 && score >= minScore;
|
|
312
|
+
|
|
313
|
+
this.setState("throw.current", { val: score, ack: true });
|
|
314
|
+
this.setState("throw.isTriple", { val: isTriple, ack: true });
|
|
315
|
+
|
|
155
316
|
// Nur schreiben, wenn:
|
|
156
317
|
// - genau 3 Darts geworfen wurden
|
|
157
318
|
// - vorher weniger als 3 waren (Visit gerade abgeschlossen)
|
|
@@ -227,6 +388,55 @@ class Autodarts extends utils.Adapter {
|
|
|
227
388
|
req.end();
|
|
228
389
|
}
|
|
229
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Board-Konfiguration abfragen (Kameras)
|
|
393
|
+
*/
|
|
394
|
+
fetchConfig() {
|
|
395
|
+
const options = {
|
|
396
|
+
host: this.config.host,
|
|
397
|
+
port: this.config.port,
|
|
398
|
+
path: "/api/config",
|
|
399
|
+
method: "GET",
|
|
400
|
+
timeout: 1500,
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const req = http.request(options, res => {
|
|
404
|
+
let data = "";
|
|
405
|
+
res.on("data", chunk => (data += chunk));
|
|
406
|
+
res.on("end", () => {
|
|
407
|
+
try {
|
|
408
|
+
const cfg = JSON.parse(data);
|
|
409
|
+
|
|
410
|
+
const cam = cfg.cam || {};
|
|
411
|
+
const camInfo = {
|
|
412
|
+
width: cam.width ?? 1280,
|
|
413
|
+
height: cam.height ?? 720,
|
|
414
|
+
fps: cam.fps ?? 20,
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
const json = JSON.stringify(camInfo);
|
|
418
|
+
|
|
419
|
+
this.setState("system.cam0", { val: json, ack: true });
|
|
420
|
+
this.setState("system.cam1", { val: json, ack: true });
|
|
421
|
+
this.setState("system.cam2", { val: json, ack: true });
|
|
422
|
+
} catch (e) {
|
|
423
|
+
this.log.warn(`Fehler beim Lesen der Config: ${e.message} | Daten: ${data.substring(0, 200)}...`);
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
req.on("error", () => {
|
|
429
|
+
this.log.warn("Config-API nicht erreichbar");
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
req.on("timeout", () => {
|
|
433
|
+
req.destroy();
|
|
434
|
+
this.log.warn("Config-API Timeout");
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
req.end();
|
|
438
|
+
}
|
|
439
|
+
|
|
230
440
|
onUnload(callback) {
|
|
231
441
|
try {
|
|
232
442
|
if (this.pollTimer) {
|
|
@@ -236,8 +446,7 @@ class Autodarts extends utils.Adapter {
|
|
|
236
446
|
clearInterval(this.versionTimer);
|
|
237
447
|
}
|
|
238
448
|
callback();
|
|
239
|
-
|
|
240
|
-
} catch (e) {
|
|
449
|
+
} catch {
|
|
241
450
|
callback();
|
|
242
451
|
}
|
|
243
452
|
}
|