iobroker.autodarts 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,42 +11,68 @@
11
11
 
12
12
 
13
13
  ## What this adapter does
14
- <!-- - Reads current game state, active player, and dart throws (e.g. `T20`, `D1`, `S19`). -->
15
- - Connects to your local Autodarts Board Manager (via IP and port, e.g. `192.168.x.x:3180`).
16
- - Exposes ioBroker states and events so you can:
17
- - Turn on lights when a game starts.
18
- - Play a sound on a bullseye.
19
- - The next throw will be announced via text-to-speech (TTS).
20
- - Trigger other automations in ioBroker.
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 turns true for triple hits within a configurable segment range (e.g. 1–20)
27
- - `throw.isBullseye`: Boolean flag that only turns true for bullseye hits.
28
- - `system.cams.cam0/1/2`: JSON with camera settings (width, height, fps).
29
- - `status.trafficLightColor`: HEX color of the current board status.
30
- - `status.trafficLightState`: `green` (player may throw), `yellow` (remove darts), `red` (board error).
31
- - `system.software.*`: OS and Autodarts host details (incl. boardVersion & desktopVersion).
32
- - `system.hardware.*`: CPU, architecture and hostname information.
14
+
15
+ Connects to your local Autodarts Board Manager (via IP and port, e.g. `192.168.x.x:3180`) and exposes ioBroker states for home automation:
16
+
17
+ - Turn on lights when a game starts
18
+ - Play a sound on a bullseye
19
+ - Announce the next throw via text-to-speech (TTS)
20
+ - Control board hardware (lighting, power)
21
+ - Trigger any other ioBroker automation based on dart events
22
+
23
+ ## Features
24
+
25
+ ### Game State & Throws
26
+ - **`visit.score`**: Total score of the last complete visit (3 darts)
27
+ - **`throw.current`**: Numeric score of the last thrown dart
28
+ - **`throw.isTriple`**: Boolean flag for triple hits within configurable segment range (default: 1–20)
29
+ - **`throw.isBullseye`**: Boolean flag for bullseye hits only
30
+
31
+ ### Board Status
32
+ - **`status.trafficLightColor`**: HEX color of current board status
33
+ - **`status.trafficLightState`**: Status indicator
34
+ - `green` = Player may throw
35
+ - `yellow` = Remove darts
36
+ - `red` = Board offline/error
37
+
38
+ ### System Information
39
+ - **`system.software.*`**: Autodarts versions (boardVersion, desktopVersion), OS and platform details
40
+ - **`system.hardware.*`**: CPU model, kernel architecture, hostname
41
+ - **`system.cams.cam0/1/2`**: Camera configuration (width, height, fps) as JSON
42
+
43
+ ### Hardware Control
44
+ - **`system.hardware.light`**: Control board lighting (bidirectional with external states)
45
+ - **`system.hardware.power`**: Control board power (bidirectional with external states)
46
+
47
+ ### Runtime Configuration
48
+ - **`config.tripleMinScore/tripleMaxScore`**: Adjust triple trigger thresholds during runtime
49
+ - **`config.triggerResetSec`**: Auto-reset time for triple/bullseye flags
33
50
 
34
51
  ## What this adapter does NOT do
35
52
 
36
- - ❌ No data is sent to the internet or to third-party servers.
37
- - ❌ No history, statistics, or personal data is stored or shared.
38
- - ❌ No access to other peoples boards or remote boards over the internet.
39
- - ❌ No cloud features or analytics.
53
+ - ❌ No data is sent to the internet or to third-party servers
54
+ - ❌ No history, statistics, or personal data is stored or shared
55
+ - ❌ No access to other people's boards or remote boards over the internet
56
+ - ❌ No cloud features or analytics
40
57
 
41
58
  All data stays local on your ioBroker system.
42
59
 
43
60
  ## Configuration
44
61
 
62
+ ![Configuration Screenshot](docs/config-screenshot.png)
63
+
45
64
  In the adapter settings, enter:
46
65
 
47
- - **Board Manager IP**: IP address of your Autodarts Board Manager (e.g. `192.168.178.50`).
48
- - **Port**: Usually `3180` (default for Board Manager).
49
- - **Polling interval (s)**: (default for 1s)
66
+ - **Board Manager IP**: IP address of your Autodarts Board Manager (e.g. `192.168.178.50`)
67
+ - **Port**: Usually `3180` (default for Board Manager)
68
+ - **Polling interval (s)**: How often to check for new throws (default: 1s)
69
+
70
+ ### Optional: Hardware Control Mapping
71
+ - **Light Target ID**: ioBroker state ID to sync with `system.hardware.light` (e.g., `0_userdata.0.LIGHT`)
72
+ - **Power Target ID**: ioBroker state ID to sync with `system.hardware.power` (e.g., `0_userdata.0.POWER`)
73
+
74
+ When configured, changes to either the adapter states or external states are synchronized bidirectionally.
75
+
50
76
 
51
77
  ## Privacy & Data Handling
52
78
 
@@ -59,15 +85,23 @@ In the adapter settings, enter:
59
85
  <!--
60
86
  ### **WORK IN PROGRESS**
61
87
  -->
88
+ ### 0.5.1 (2025-12-28)
89
+ - (skvarel) Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.
90
+
91
+ ### 0.5.0 (2025-12-28)
92
+ - (skvarel) Added: Bidirectional hardware control states `system.hardware.light` and `system.hardware.power`
93
+ - (skvarel) Added: Configuration options to map light/power states to external ioBroker states (e.g., 0_userdata)
94
+ - (skvarel) Changed: Hardware states now support read/write operations for full automation integration
95
+
62
96
  ### 0.4.0 (2025-12-28)
63
- - Changed: Restructured system information into dedicated `system.hardware`, `system.software` and `system.cams` channels.
64
- - Added: New software info states (`desktopVersion`, `boardVersion`, `platform`, `os`) and hardware info states (`kernelArch`, `cpuModel`, `hostname`).
65
- - Added: Camera configuration states `system.cams.cam0/1/2` containing JSON with width, height and fps.
66
- - Changed: Adapter configuration for polling interval and triple trigger thresholds is now fully driven via jsonConfig (dropdowns and number fields).
67
- - Removed: Experimental light/power alias mapping from internal logic (no user-visible feature was released).
97
+ - (skvarel) Changed: Restructured system information into dedicated `system.hardware`, `system.software` and `system.cams` channels.
98
+ - (skvarel) Added: New software info states (`desktopVersion`, `boardVersion`, `platform`, `os`) and hardware info states (`kernelArch`, `cpuModel`, `hostname`).
99
+ - (skvarel) Added: Camera configuration states `system.cams.cam0/1/2` containing JSON with width, height and fps.
100
+ - (skvarel) Changed: Adapter configuration for polling interval and triple trigger thresholds is now fully driven via jsonConfig (dropdowns and number fields).
101
+ - (skvarel) Removed: Experimental light/power alias mapping from internal logic (no user-visible feature was released).
68
102
 
69
103
  ### 0.3.3 (2025-12-27)
70
- - Changed: Configuration fields interval and triggerReset now use seconds instead of milliseconds in the admin UI.
104
+ - (skvarel) Changed: Configuration fields interval and triggerReset now use seconds instead of milliseconds in the admin UI.
71
105
 
72
106
  ### 0.3.2 (2025-12-27)
73
107
  - (DrozmotiX) **ENHANCED**: Fixed all TypeScript type errors by adding proper type definitions for config properties
@@ -80,67 +114,32 @@ In the adapter settings, enter:
80
114
  - (DrozmotiX) **TESTING**: Added comprehensive unit tests for httpHelper module covering success, timeout, and error scenarios
81
115
 
82
116
  ### 0.3.1 (2025-12-27)
83
- - Changed: Object creation now uses extendObjectAsync with proper roles and types instead of setObjectNotExistsAsync.
117
+ - (skvarel) Changed: Object creation now uses extendObjectAsync with proper roles and types instead of setObjectNotExistsAsync.
84
118
 
85
119
  ### 0.3.0 (2025-12-26)
86
- - Added traffic light datapoints (`status.trafficLightColor`, `status.trafficLightState`) mapped from Board Manager status (`Throw` / `Takeout` / connection errors).
87
- - Refactored code: visit handling, throw handling (triple / bull) and traffic light logic moved to separate modules.
120
+ - (skvarel) Added traffic light datapoints (`status.trafficLightColor`, `status.trafficLightState`) mapped from Board Manager status (`Throw` / `Takeout` / connection errors).
121
+ - (skvarel) Refactored code: visit handling, throw handling (triple / bull) and traffic light logic moved to separate modules.
88
122
 
89
123
  ### 0.2.2 (2025-12-25)
90
- - bugfix
124
+ - (skvarel) bugfix
91
125
 
92
126
  ### 0.2.1 (2025-12-25)
93
- - Reset for triple and bullseye trigger added
127
+ - (skvarel) Reset for triple and bullseye trigger added
94
128
 
95
129
  ### 0.2.0 (2025-12-25)
96
- - Added datapoint for bulls-hit
97
- - Added maximun triple-hit flag score
98
- - Update config
99
- - Warning in log cleared
130
+ - (skvarel) Added datapoint for bulls-hit
131
+ - (skvarel) Added maximun triple-hit flag score
132
+ - (skvarel) Update config
133
+ - (skvarel) Warning in log cleared
100
134
 
101
135
  ### 0.1.0 (2025-12-23)
102
- - Added datapoints for visit score, current dart score, triple-hit flag with configurable minimum score, and camera configuration (cam0–cam2).
103
- - Cleaned up adapter logic and internal polling/timing.
104
- - Updated translations.
105
-
106
- ### 0.0.14 (2025-12-22)
107
- - fix
108
-
109
- ### 0.0.13 (2025-12-22)
110
- - translate
111
-
112
- ### 0.0.12 (2025-12-22)
113
- - fix
114
-
115
- ### 0.0.11 (2025-12-22)
116
- - fix
117
-
118
- ### 0.0.10 (2025-12-22)
119
- - fix
120
-
121
- ### 0.0.9 (2025-12-22)
122
- - fix
123
-
124
- ### 0.0.8 (2025-12-21)
125
- - fix - Adapter Checker
126
-
127
- ### 0.0.7 (2025-12-21)
128
- - fix - Adapter Checker
129
-
130
- ### 0.0.6 (2025-12-21)
131
- - fix - Adapter Checker
132
-
133
- ### 0.0.5 (2025-12-21)
134
- - Update Description
135
-
136
- ### 0.0.4 (2025-12-21)
137
- - Privacy & Data Handling
138
-
139
- ### 0.0.3 (2025-12-21)
140
- - init
136
+ - (skvarel) Added: Datapoints for visit score, current dart score, triple-hit flag with configurable minimum score
137
+ - (skvarel) Added: Camera configuration states (cam0–cam2)
138
+ - (skvarel) Changed: Cleaned up adapter logic and internal polling/timing
139
+ - (skvarel) Changed: Updated translations
141
140
 
142
- ### 0.0.2 (2025-12-21)
143
- - initial release
141
+ ### 0.0.14 - 0.0.2 (2025-12-21 - 2025-12-22)
142
+ - (skvarel) Initial release with multiple fixes for adapter checker compliance and documentation improvements
144
143
 
145
144
  ## License
146
145
  MIT License
@@ -4,8 +4,12 @@
4
4
  "host_port": "Autodarts (Boardmanager) Port",
5
5
  "host_port_help": "Portnummer des lokalen Autodarts Boardmanagers.",
6
6
  "intro_txt": "Konfiguration des Autodarts-Adapters.",
7
+ "light_target": "LED-Ring Datenpunkt",
8
+ "light_target_help": "Datenpunkt des LED-Ring zur Steuerung innerhalb des Autodarts-Adapters. Lasse das Feld leer, um die Lichtsteuerung zu deaktivieren.",
7
9
  "polling": "Abfrageintervall (s)",
8
10
  "polling_help": "Abfrageintervall in Sekunden zum Abrufen von Daten vom Autodarts Boardmanager.",
11
+ "power_target": "Power-Datenpunkt",
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.",
9
13
  "reset": "Trigger-Reset (s)",
10
14
  "reset_help": "Setzt den Triple- und Bullseye-Trigger nach x Sekunden zurück (0 = kein Reset).",
11
15
  "triple_flag": "Minimales Feld für den Triple-Trigger",
@@ -11,5 +11,9 @@
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 and bullseye trigger after x seconds (0 = no reset).",
15
+ "light_target": "Light Target ID",
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
+ "power_target": "Power Target ID",
18
+ "power_target_help": "ID of the power target to control power via Autodarts (e.g., 'switch.darts_socket'). Leave empty to disable power control."
15
19
  }
@@ -4,8 +4,12 @@
4
4
  "host_port": "Puerto Autodarts (Boardmanager)",
5
5
  "host_port_help": "Número de puerto del administrador local de Autodarts Boardmanager.",
6
6
  "intro_txt": "Configuración del adaptador Autodarts.",
7
+ "light_target": "ID de objetivo ligero",
8
+ "light_target_help": "ID del objetivo de luz para controlar las luces a través de Autodarts (por ejemplo, 'light.living_room'). Déjelo vacío para desactivar el control de luces.",
7
9
  "polling": "Intervalo(s) de sondeo",
8
10
  "polling_help": "Intervalo de sondeo en segundos para recuperar datos del Autodarts Boardmanager.",
11
+ "power_target": "ID de objetivo de potencia",
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.",
9
13
  "reset": "Restablecimiento de disparador (s)",
10
14
  "reset_help": "Restablezca el disparador triple y de diana después de x segundos (0 = sin reinicio).",
11
15
  "triple_flag": "Campo mínimo para el triple disparador",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Port Autodarts (Boardmanager)",
5
5
  "host_port_help": "Numéro de port du Boardmanager Autodarts local.",
6
6
  "intro_txt": "Configuration de l'adaptateur Autodarts.",
7
+ "light_target": "ID de cible lumineuse",
8
+ "light_target_help": "ID de la cible lumineuse pour contrôler les lumières via Autodarts (par exemple, « light.living_room »). Laissez vide pour désactiver le contrôle de la lumière.",
7
9
  "polling": "Intervalle(s) d'interrogation",
8
10
  "polling_help": "Intervalle d'interrogation en secondes pour récupérer les données de l'Autodarts Boardmanager.",
11
+ "power_target": "ID de cible de puissance",
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.",
9
13
  "reset": "Déclencheur-Réinitialisation(s)",
10
14
  "reset_help": "Réinitialisez le déclencheur triple et bullseye après x secondes (0 = pas de réinitialisation).",
11
15
  "triple_flag": "Champ minimum pour le triple déclencheur",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Porta Autodarts (Boardmanager).",
5
5
  "host_port_help": "Numero di porta del Boardmanager Autodarts locale.",
6
6
  "intro_txt": "Configurazione dell'adattatore Autodarts.",
7
+ "light_target": "ID del bersaglio luminoso",
8
+ "light_target_help": "ID del target luminoso per controllare le luci tramite Autodarts (ad esempio, \"light.living_room\"). Lasciare vuoto per disabilitare il controllo della luce.",
7
9
  "polling": "Intervallo di polling (s)",
8
10
  "polling_help": "Intervallo di polling in secondi per recuperare i dati da Autodarts Boardmanager.",
11
+ "power_target": "ID del target di potenza",
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.",
9
13
  "reset": "Trigger-Reset(s)",
10
14
  "reset_help": "Ripristina il grilletto triplo e bullseye dopo x secondi (0 = nessun ripristino).",
11
15
  "triple_flag": "Campo minimo per il triplo trigger",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Autodarts (Bestuursmanager) Port",
5
5
  "host_port_help": "Poortnummer van de lokale Autodarts Boardmanager.",
6
6
  "intro_txt": "Autodarts-adapterconfiguratie.",
7
+ "light_target": "Lichtdoel-ID",
8
+ "light_target_help": "ID van het lichtdoel om lampen te bedienen via Autodarts (bijvoorbeeld 'light.living_room'). Laat dit leeg om de lichtregeling uit te schakelen.",
7
9
  "polling": "Polling-interval (s)",
8
10
  "polling_help": "Polling-interval in seconden om gegevens uit de Autodarts Boardmanager op te halen.",
11
+ "power_target": "Power Target-ID",
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.",
9
13
  "reset": "Trigger-reset (s)",
10
14
  "reset_help": "Reset de drievoudige en bullseye-trigger na x seconden (0 = geen reset).",
11
15
  "triple_flag": "Minimumveld voor de drievoudige trigger",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Port Autodarts (Boardmanager).",
5
5
  "host_port_help": "Numer portu lokalnego zarządcy Autodarts.",
6
6
  "intro_txt": "Konfiguracja adaptera Autodarts.",
7
+ "light_target": "Identyfikator lekkiego celu",
8
+ "light_target_help": "Identyfikator celu świetlnego do sterowania światłami za pomocą Autodarts (np. „light.living_room”). Pozostaw puste, aby wyłączyć kontrolę oświetlenia.",
7
9
  "polling": "Interwał odpytywania (s)",
8
10
  "polling_help": "Interwał odpytywania w sekundach w celu pobrania danych z menedżera Autodarts Boardmanager.",
11
+ "power_target": "Identyfikator celu mocy",
12
+ "power_target_help": "Identyfikator celu mocy do kontrolowania mocy za pomocą Autodarts (np. „switch.darts_socket”). Pozostaw puste, aby wyłączyć kontrolę mocy.",
9
13
  "reset": "Reset wyzwalacza (s)",
10
14
  "reset_help": "Zresetuj wyzwalacz potrójny i tarczy po x sekundach (0 = brak resetu).",
11
15
  "triple_flag": "Minimalne pole dla potrójnego wyzwalacza",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Porto Autodarts (Boardmanager)",
5
5
  "host_port_help": "Número da porta do Autodarts Boardmanager local.",
6
6
  "intro_txt": "Configuração do adaptador Autodarts.",
7
+ "light_target": "ID do alvo claro",
8
+ "light_target_help": "ID do alvo de luz para controlar luzes via Autodarts (por exemplo, 'light.living_room'). Deixe em branco para desativar o controle de luz.",
7
9
  "polling": "Intervalo(s) de pesquisa",
8
10
  "polling_help": "Intervalo de pesquisa em segundos para recuperar dados do Autodarts Boardmanager.",
11
+ "power_target": "ID do alvo avançado",
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.",
9
13
  "reset": "Redefinição(ões) de gatilho",
10
14
  "reset_help": "Redefina o gatilho triplo e alvo após x segundos (0 = sem reinicialização).",
11
15
  "triple_flag": "Campo mínimo para o disparo triplo",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Порт Autodarts (Boardmanager)",
5
5
  "host_port_help": "Номер порта местного Autodarts Boardmanager.",
6
6
  "intro_txt": "Конфигурация адаптера Autodarts.",
7
+ "light_target": "Идентификатор легкой цели",
8
+ "light_target_help": "Идентификатор световой цели для управления освещением через Autodarts (например, «light.living_room»). Оставьте пустым, чтобы отключить управление освещением.",
7
9
  "polling": "Интервал опроса (с)",
8
10
  "polling_help": "Интервал опроса в секундах для получения данных из Autodarts Boardmanager.",
11
+ "power_target": "Идентификатор цели по мощности",
12
+ "power_target_help": "Идентификатор цели мощности для управления мощностью через Autodarts (например, «switch.darts_socket»). Оставьте пустым, чтобы отключить управление питанием.",
9
13
  "reset": "Триггер-Сброс (ы)",
10
14
  "reset_help": "Сбросьте триггер и триггер «яблочко» через x секунд (0 = сброса нет).",
11
15
  "triple_flag": "Минимальное поле для тройного триггера",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Autodarts (Boardmanager) Порт",
5
5
  "host_port_help": "Номер порту місцевого менеджера Autodarts Board.",
6
6
  "intro_txt": "Конфігурація адаптера Autodarts.",
7
+ "light_target": "Ідентифікатор легкої цілі",
8
+ "light_target_help": "Ідентифікатор цільового освітлення для керування освітленням через Autodarts (наприклад, \"light.living_room\"). Залиште пустим, щоб вимкнути керування світлом.",
7
9
  "polling": "Інтервал опитування (с)",
8
10
  "polling_help": "Інтервал опитування в секундах для отримання даних із Autodarts Boardmanager.",
11
+ "power_target": "Power Target ID",
12
+ "power_target_help": "Ідентифікатор цільової потужності для керування живленням через Autodarts (наприклад, 'switch.darts_socket'). Залиште пустим, щоб вимкнути керування живленням.",
9
13
  "reset": "Тригер-Скидання (s)",
10
14
  "reset_help": "Скинути потрійний тригер і тригер «яблочко» через x секунд (0 = без скидання).",
11
15
  "triple_flag": "Мінімальне поле для потрійного тригера",
@@ -4,8 +4,12 @@
4
4
  "host_port": "Autodarts(Boardmanager)端口",
5
5
  "host_port_help": "本地 Autodarts Boardmanager 的端口号。",
6
6
  "intro_txt": "Autodarts 适配器配置。",
7
+ "light_target": "光目标ID",
8
+ "light_target_help": "通过 Autodarts 控制灯光的灯光目标的 ID(例如“light.living_room”)。留空以禁用灯光控制。",
7
9
  "polling": "轮询间隔(秒)",
8
10
  "polling_help": "从 Autodarts Boardmanager 检索数据的轮询间隔(以秒为单位)。",
11
+ "power_target": "功率目标 ID",
12
+ "power_target_help": "通过 Autodarts 控制电源的电源目标的 ID(例如“switch.darts_socket”)。留空以禁用电源控制。",
9
13
  "reset": "触发-复位",
10
14
  "reset_help": "x 秒后重置三重触发器和靶心触发器(0 = 不重置)。",
11
15
  "triple_flag": "三重触发器的最小字段",
@@ -12,13 +12,12 @@
12
12
  "lg": 12,
13
13
  "xl": 12,
14
14
  "style": {
15
- "border": "1px solid",
15
+ "border-bottom": "1px solid",
16
16
  "borderRadius": "0px",
17
17
  "padding": "8px",
18
- "marginTop": "10px",
19
18
  "marginBottom": "10px",
20
19
  "textAlign": "center",
21
- "font-size": "20px"
20
+ "font-size": "24px"
22
21
  }
23
22
  },
24
23
  "host": {
@@ -308,6 +307,28 @@
308
307
  "marginBottom": "10px"
309
308
  }
310
309
  },
310
+ "lightTargetId": {
311
+ "type": "objectId",
312
+ "label": "light_target",
313
+ "help": "light_target_help",
314
+ "newLine": true,
315
+ "sm": 12,
316
+ "xs": 12,
317
+ "md": 6,
318
+ "lg": 6,
319
+ "xl": 6
320
+ },
321
+ "powerTargetId": {
322
+ "type": "objectId",
323
+ "label": "power_target",
324
+ "help": "power_target_help",
325
+ "newLine": false,
326
+ "sm": 12,
327
+ "xs": 12,
328
+ "md": 6,
329
+ "lg": 6,
330
+ "xl": 6
331
+ },
311
332
  "outro": {
312
333
  "type": "staticText",
313
334
  "text": "Team inventwo • <a href=\"https://github.com/inventwo\">https://github.com/inventwo</a> • by skvarel",
@@ -318,11 +339,10 @@
318
339
  "lg": 12,
319
340
  "xl": 12,
320
341
  "style": {
321
- "border": "1px solid",
342
+ "border-top": "1px solid",
322
343
  "borderRadius": "0px",
323
344
  "padding": "8px",
324
345
  "marginTop": "10px",
325
- "marginBottom": "10px",
326
346
  "textAlign": "center",
327
347
  "font-size": "larger"
328
348
  }
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "autodarts",
4
- "version": "0.4.0",
4
+ "version": "0.5.1",
5
5
  "news": {
6
+ "0.5.1": {
7
+ "en": "Fixed: Hardware light/power mapping now respects configured target IDs and works on all systems.",
8
+ "de": "Behoben: Hardware-Licht/Strom-Mapping respektiert nun konfigurierte Ziel-IDs und arbeitet an allen Systemen.",
9
+ "ru": "Фиксированный: аппаратное отображение света/мощности теперь учитывает настроенные идентификаторы цели и работает на всех системах.",
10
+ "pt": "Fixo: O mapeamento de luz/potência de hardware agora respeita IDs de destino configurados e funciona em todos os sistemas.",
11
+ "nl": "Vast: Hardware licht/kracht mapping respecteert nu geconfigureerde doel ID's en werkt op alle systemen.",
12
+ "fr": "Correction : La cartographie matérielle de la lumière/puissance respecte désormais les identifiants de cible configurés et fonctionne sur tous les systèmes.",
13
+ "it": "Risolto: la mappatura della luce/potenza hardware ora rispetta gli ID di destinazione configurati e funziona su tutti i sistemi.",
14
+ "es": "Fijo: Hardware light/power mapping respeta ahora los IDs de destino configurados y funciona en todos los sistemas.",
15
+ "pl": "Naprawiono: Hardware light / Power mapowanie teraz szanuje skonfigurowane identyfikatory docelowe i działa na wszystkich systemach.",
16
+ "uk": "Виправлено: Апаратне освітлення / живлення тепер поважає налаштовувати цільові ідентифікатори і працює на всіх системах.",
17
+ "zh-cn": "固定:硬件光电映射现在尊重已配置的目标ID,并在所有系统中工作."
18
+ },
19
+ "0.5.0": {
20
+ "en": "Added: Bidirectional hardware control states `system.hardware.light` and `system.hardware.power`\nAdded: Configuration options to map light/power states to external ioBroker states (e.g., 0_userdata)\nChanged: Hardware states now support read/write operations for full automation integration",
21
+ "de": "Hinzugefügt: Bidirektionale Hardware-Steuerzustände `system.hardware.light` und `system.hardware.power `\nHinzugefügt: Konfigurationsoptionen zur Abbildung von Licht/Leistungszuständen zu externen ioBroker Zuständen (z.B. 0_userdata)\nGeändert: Hardware-Staaten unterstützen nun Lese- und Schreibvorgänge für die vollständige Automatisierungsintegration",
22
+ "ru": "Добавлено: Двунаправленное аппаратное управление состояниями «system.hardware.light» и «system.hardware.power» пункт\nДобавлено: Варианты конфигурации для отображения состояний света/мощности на внешние состояния ioBroker (например, 0_userdata)\nИзменены: штаты оборудования теперь поддерживают операции чтения / записи для полной интеграции автоматизации",
23
+ "pt": "Adicionado: estados de controle de hardware bidirecional `system.hardware.light' e `system.hardware.power `\nAdicionado: Opções de configuração para mapear estados de luz/poder para estados de ioBroker externos (por exemplo, 0_userdata)\nModificado: Os estados de hardware agora suportam operações de leitura/escrita para integração completa de automação",
24
+ "nl": "Toegevoegd: Bidirectionele hardware-besturing staat voor Wat\nToegevoegd: Configuratie-opties voor het in kaart brengen van licht/krachttoestanden naar externe ioBroker-toestanden (bijv. 0_userdata)\nGewijzigd: Hardware toestanden ondersteunen nu lezen/schrijven bewerkingen voor volledige automatisering integratie",
25
+ "fr": "Ajouté : Les états de contrôle du matériel bidirectionnel `system.hardware.light` et `system.hardware.power \"\nAjouté: Options de configuration pour cartographier les états de lumière/puissance vers les états externes ioBroker (par exemple, 0_userdata)\nChanged: Les états matériels prennent désormais en charge les opérations de lecture/écriture pour l'intégration complète de l'automatisation",
26
+ "it": "Aggiunto: Bidirectional hardware control stati `system.hardware.light` e `system.hardware.power #\nAggiunto: Opzioni di configurazione per mappare gli stati di luce/potenza agli stati ioBroker esterni (ad esempio, 0_userdata)\nCambiato: gli stati hardware ora supportano le operazioni di lettura/scrittura per l'integrazione completa dell'automazione",
27
+ "es": "Añadido: Bidirectional hardware control states `system.hardware.light` y `system.hardware.power `\nAñadido: Opciones de configuración para mapear estados de luz/poder a estados de yoBroker externos (por ejemplo, 0_userdata)\nCambio: Los estados de Hardware ahora apoyan operaciones de lectura/escritura para la integración de la automatización completa",
28
+ "pl": "Dodano: dwukierunkowa kontrola sprzętowa stanów 'system.hardware.light' i 'system.hardware.power'\nDodano: Opcje konfiguracji do mapowania stanów światła / mocy do zewnętrznych stanów jOBroker (np. 0 _ userdata)\nZmiana: Stan sprzętu obsługuje teraz operacje odczytu / zapisu dla pełnej automatyzacji integracji",
29
+ "uk": "Додано: Двосторонні стани керування обладнанням `system.hardware.light` і `system.hardware.power й\nДодано: Параметри конфігурації для мапи світло/потужних станів на зовнішні стани ioBroker (наприклад, 0_userdata)\nЗмінено: Апаратні стани, які зараз підтримують операції читання/запису для повної інтеграції автоматизації",
30
+ "zh-cn": "添加:双向硬件控制状态为‘system.hardware.light'和‘system.hardware.power. `\n添加: 将光/ 电状态映射到外部 ioBroker 状态的配置选项( 如 0_ userdata)\n更改: 硬件状态现在支持读/写操作,以便完全自动化集成"
31
+ },
6
32
  "0.4.0": {
7
33
  "en": "Changed: Restructured system information into dedicated `system.hardware`, `system.software` and `system.cams` channels.\nAdded: New software info states (`desktopVersion`, `boardVersion`, `platform`, `os`) and hardware info states (`kernelArch`, `cpuModel`, `hostname`).\nAdded: Camera configuration states `system.cams.cam0/1/2` containing JSON with width, height and fps.\nChanged: Adapter configuration for polling interval and triple trigger thresholds is now fully driven via jsonConfig (dropdowns and number fields).\nRemoved: Experimental light/power alias mapping from internal logic (no user-visible feature was released).",
8
34
  "de": "Geändert: Restrukturierte Systeminformationen in dedizierte `system.hardware`, `system.software` und `system.cams` Kanäle.\nHinzugefügt: Neue Software-Info-Zustände (`desktopVersion`, `boardVersion`, `platform`, `os`) und Hardware-Info-Zustände (`kernelArch`, `cpuModel`, `hostname`).\nHinzugefügt: Kamera-Konfigurationszustände `system.cams.cam0/1/2` mit JSON mit Breite, Höhe und fps.\nGeändert: Adapterkonfiguration für das Abfrageintervall und die dreifachen Triggerschwellen werden nun über jsonConfig (Dropdowns und Nummernfelder) voll angesteuert.\nEntfernt: Experimentelles Licht/Power Alias Mapping aus interner Logik (keine Benutzersichtbarkeit wurde freigegeben).",
@@ -67,32 +93,6 @@
67
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.",
68
94
  "uk": "Додано точки світла трафіку (`status.trafficLightColor`, `status.trafficLightState`) на карті Board Manager (`Throw` / `Takeout` / помилки підключення).\nРефакторний код: візитна обробка, кидання (стриптиз / бик) і логіка трафіку переходить на окремі модулі.",
69
95
  "zh-cn": "增加从董事会管理者身份绘制的交通灯数据点(`Status.trafficLightColor ' ,`Status.trafficLight Station ' ) (`扔'/`Takeout ' /连接错误).\n重构代码:访问处理,投掷处理(三重/公牛)和交通灯逻辑移动到单独的模块."
70
- },
71
- "0.2.2": {
72
- "en": "bugfix",
73
- "de": "fehlerbehebung",
74
- "ru": "исправление ошибок",
75
- "pt": "correção de erros",
76
- "nl": "bugfix",
77
- "fr": "correction du bug",
78
- "it": "bugfix",
79
- "es": "bugfix",
80
- "pl": "bugfix",
81
- "uk": "панчохи",
82
- "zh-cn": "错误修正"
83
- },
84
- "0.2.1": {
85
- "en": "Reset for triple and bullseye trigger added",
86
- "de": "Zurücksetzen für Triple und Bullseye Trigger hinzugefügt",
87
- "ru": "Сброс тройного и бычьего триггера добавлен",
88
- "pt": "Reiniciar para gatilho triplo e bullseye adicionado",
89
- "nl": "Reset voor drievoudige en bullseye trigger toegevoegd",
90
- "fr": "Réinitialiser pour triple et bullseye déclencheur ajouté",
91
- "it": "Reset per trigger triple e bullseye aggiunto",
92
- "es": "Reiniciar para triple y disparador de toros",
93
- "pl": "Reset dla triple i bulseye wyzwalacz dodany",
94
- "uk": "Зміщено переадресацію для тридцятого і буклесу",
95
- "zh-cn": "重置三重和牛眼触发器"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -167,7 +167,9 @@
167
167
  "intervalSec": 1,
168
168
  "triggerResetSec": 0,
169
169
  "tripleMinScore": 1,
170
- "tripleMaxScore": 20
170
+ "tripleMaxScore": 20,
171
+ "lightTargetId": "",
172
+ "powerTargetId": ""
171
173
  },
172
174
  "objects": [],
173
175
  "instanceObjects": []
package/main.js CHANGED
@@ -245,6 +245,30 @@ class Autodarts extends utils.Adapter {
245
245
  },
246
246
  native: {},
247
247
  });
248
+ // LED State anlegen
249
+ await this.extendObjectAsync("system.hardware.light", {
250
+ type: "state",
251
+ common: {
252
+ name: { en: "Board light", de: "Board-Beleuchtung" },
253
+ type: "boolean",
254
+ role: "switch.light",
255
+ read: true,
256
+ write: true,
257
+ },
258
+ native: {},
259
+ });
260
+ // POWER State anlegen
261
+ await this.extendObjectAsync("system.hardware.power", {
262
+ type: "state",
263
+ common: {
264
+ name: { en: "Board power", de: "Board-Strom" },
265
+ type: "boolean",
266
+ role: "switch.power",
267
+ read: true,
268
+ write: true,
269
+ },
270
+ native: {},
271
+ });
248
272
 
249
273
  // Kamera-Infos als JSON-States
250
274
  await this.extendObjectAsync("system.cams.cam0", {
@@ -400,6 +424,18 @@ class Autodarts extends utils.Adapter {
400
424
  this.subscribeStates("config.tripleMaxScore");
401
425
  this.subscribeStates("config.triggerResetSec");
402
426
 
427
+ // Auf Hardware-Schalter hören (eigene States)
428
+ this.subscribeStates("system.hardware.light");
429
+ this.subscribeStates("system.hardware.power");
430
+
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
+ }
438
+
403
439
  // Zustand zurücksetzen
404
440
  this.lastThrowsCount = 0;
405
441
  this.lastSignature = "";
@@ -447,12 +483,22 @@ class Autodarts extends utils.Adapter {
447
483
  return;
448
484
  }
449
485
 
450
- // Nur auf Schreibaktionen reagieren (ack === false)
451
- 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 });
452
495
  return;
453
496
  }
454
497
 
455
- 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
+ }
456
502
 
457
503
  if (idShort === "config.tripleMinScore") {
458
504
  const val = Number(state.val);
@@ -463,8 +509,6 @@ class Autodarts extends utils.Adapter {
463
509
 
464
510
  this.tripleMinScoreRuntime = val;
465
511
  this.log.info(`Runtime tripleMinScore updated to ${val}`);
466
-
467
- // Wert mit ack bestätigen
468
512
  await this.setStateAsync("config.tripleMinScore", { val, ack: true });
469
513
  } else if (idShort === "config.tripleMaxScore") {
470
514
  const val = Number(state.val);
@@ -475,7 +519,6 @@ class Autodarts extends utils.Adapter {
475
519
 
476
520
  this.tripleMaxScoreRuntime = val;
477
521
  this.log.info(`Runtime tripleMaxScore updated to ${val}`);
478
-
479
522
  await this.setStateAsync("config.tripleMaxScore", { val, ack: true });
480
523
  } else if (idShort === "config.triggerResetSec") {
481
524
  const val = Number(state.val);
@@ -486,8 +529,19 @@ class Autodarts extends utils.Adapter {
486
529
 
487
530
  this.triggerResetSecRuntime = val;
488
531
  this.log.info(`Runtime triggerResetSec updated to ${val} s`);
489
-
490
532
  await this.setStateAsync("config.triggerResetSec", { val, ack: true });
533
+ } else if (idShort === "system.hardware.light") {
534
+ if (this.config.lightTargetId) {
535
+ await this.setForeignStateAsync(this.config.lightTargetId, state.val, false);
536
+ } else {
537
+ this.log.warn("Light state changed, but no lightTargetId configured");
538
+ }
539
+ } else if (idShort === "system.hardware.power") {
540
+ if (this.config.powerTargetId) {
541
+ await this.setForeignStateAsync(this.config.powerTargetId, state.val, false);
542
+ } else {
543
+ this.log.warn("Power state changed, but no powerTargetId configured");
544
+ }
491
545
  }
492
546
  }
493
547
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.autodarts",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Autodarts Autoscoring",
5
5
  "author": "skvarel <skvarel@inventwo.com>",
6
6
  "contributors": [