iobroker.acinfinity 0.4.2 → 0.5.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 CHANGED
@@ -37,7 +37,7 @@ The developer accepts no responsibility for any harm or issues arising from the
37
37
  ## Setup
38
38
 
39
39
  1. Enter your AC Infinity email and password
40
- 2. Set the polling interval (minimum 5 seconds)
40
+ 2. Set the polling interval (minimum 10 seconds)
41
41
  3. Click Save & Close
42
42
 
43
43
  ## Usage
@@ -58,7 +58,10 @@ After installation, the adapter will create device objects for each of your AC I
58
58
 
59
59
  ## Changelog
60
60
 
61
- ### 0.4.1 (2025-03-28)
61
+ ### 0.5.1 (2025-04-08)
62
+ * more bug fixes and improvements
63
+
64
+ ### 0.4.3 (2025-03-28)
62
65
  * Bug fixes and improvements
63
66
 
64
67
  ### 0.3.1 (2025-03-27)
package/io-package.json CHANGED
@@ -1,9 +1,22 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "acinfinity",
4
- "version": "0.4.2",
4
+ "version": "0.5.2",
5
5
  "news": {
6
- "0.4.2": {
6
+ "0.5.2": {
7
+ "en": "Bug fixes and improvements",
8
+ "de": "Fehlerbehebungen und Verbesserungen",
9
+ "ru": "Исправления ошибок и улучшения",
10
+ "pt": "Correções de bugs e melhorias",
11
+ "nl": "Bugfixes en verbeteringen",
12
+ "fr": "Corrections de bugs et améliorations",
13
+ "it": "Correzioni di bug e miglioramenti",
14
+ "es": "Correcciones de errores y mejoras",
15
+ "pl": "Poprawki błędów i ulepszenia",
16
+ "uk": "Виправлення помилок та вдосконалення",
17
+ "zh-cn": "错误修复和改进"
18
+ },
19
+ "0.4.3": {
7
20
  "en": "Bug fixes and improvements",
8
21
  "de": "Fehlerbehebungen und Verbesserungen",
9
22
  "ru": "Исправления ошибок и улучшения",
package/lib/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * AC Infinity API Client
2
+ * AC Infinity API Client new
3
3
  * Handles all API communication with AC Infinity servers
4
4
  */
5
5
 
package/lib/constants.js CHANGED
@@ -17,7 +17,7 @@ const API_ENDPOINTS = {
17
17
 
18
18
  // Polling intervals
19
19
  const DEFAULT_POLLING_INTERVAL = 30; // seconds
20
- const MINIMUM_POLLING_INTERVAL = 5; // seconds
20
+ const MINIMUM_POLLING_INTERVAL = 10; // seconds
21
21
 
22
22
  // Controller property keys
23
23
  const CONTROLLER_PROPERTY_KEY = {
@@ -205,7 +205,32 @@ class PortModeHandler {
205
205
  break;
206
206
  }
207
207
 
208
- // Rest der Methode wie bisher...
208
+ case 'offSpeed': {
209
+ const speedValue = parseInt(value);
210
+ if (!isNaN(speedValue) && speedValue >= 0 && speedValue <= 10) {
211
+ // Verwende die spezielle Methode für offSpeed
212
+ const success = await this.handleOffSpeedChange(deviceId, portId, speedValue);
213
+
214
+ // Bestätige den State, wenn erfolgreich
215
+ if (success) {
216
+ await this.adapter.setStateAsync(`devices.${deviceId}.ports.${portId}.mode.offSpeed`,
217
+ { val: speedValue, ack: true });
218
+ }
219
+ } else {
220
+ this.adapter.log.warn(`Ungültiger offSpeed-Wert: ${value}`);
221
+ }
222
+ break;
223
+ }
224
+
225
+ // Verschachtelte Einstellungen verarbeiten
226
+ default:
227
+ if (['timer', 'cycle', 'schedule', 'auto', 'vpd'].includes(settingType) && path.length > 1) {
228
+ const category = settingType;
229
+ const subPath = path.slice(1); // Alle Elemente nach dem Kategorienamen
230
+ await this.handleNestedPortSettingsChange(deviceId, portId, category, subPath, value);
231
+ } else {
232
+ this.adapter.log.warn(`Unbekannter Port-Modus-Einstellungstyp: ${settingType}`);
233
+ }
209
234
  }
210
235
 
211
236
  // Aktualisierung der Daten mit Verzögerung auslösen
@@ -221,84 +246,190 @@ class PortModeHandler {
221
246
  }
222
247
 
223
248
  /**
224
- * Spezialisierte Methode für den Moduswechsel (besonders für Ein/Aus)
225
- * @param {string} deviceId - Geräte-ID
226
- * @param {number} portId - Port-ID
227
- * @param {string} value - Neuer Moduswert
228
- * @returns {Promise<boolean>} - True bei Erfolg
229
- */
230
- async handleActiveMode(deviceId, portId, value) {
231
- // UI sofort aktualisieren, um Flackern zu vermeiden
232
- await this.stateManager.updateUIState(`devices.${deviceId}.ports.${portId}.mode.active`, value);
233
-
234
- const turnOn = (value === "On");
235
- this.adapter.log.info(`Setting device ${deviceId}, port ${portId} to ${turnOn ? 'On' : 'Off'}`);
236
-
237
- try {
238
- // Verwende direkt curl für zuverlässige Steuerung
239
- // Settings holen für die modeSetid
240
- const settings = await this.client.getDeviceModeSettings(deviceId, portId);
241
- const modeSetid = settings.modeSetid;
242
- const vpdnums = settings.vpdnums || 107;
249
+ * Spezialisierte Methode für den Moduswechsel (besonders für Ein/Aus)
250
+ * @param {string} deviceId - Geräte-ID
251
+ * @param {number} portId - Port-ID
252
+ * @param {string} value - Neuer Moduswert
253
+ * @returns {Promise<boolean>} - True bei Erfolg
254
+ */
255
+ async handleActiveMode(deviceId, portId, value) {
256
+ // UI sofort aktualisieren, um Flackern zu vermeiden
257
+ await this.stateManager.updateUIState(`devices.${deviceId}.ports.${portId}.mode.active`, value);
243
258
 
244
- // Parameter festlegen
245
- const mode = turnOn ? 2 : 1; // 1=Aus, 2=Ein
259
+ const turnOn = (value === "On");
260
+ this.adapter.log.info(`Setting device ${deviceId}, port ${portId} to ${turnOn ? 'On' : 'Off'}`);
246
261
 
247
- // Wichtig: Hier ist die Änderung - wir holen den aktuellen onSpeed-Wert
248
- let speed;
249
- if (turnOn) {
250
- // Wenn eingeschaltet, dann nutze den gespeicherten onSpeed-Wert (oder Standard 3)
262
+ try {
263
+ // Verwende direkt curl für zuverlässige Steuerung
264
+ // Settings holen für die modeSetid
265
+ const settings = await this.client.getDeviceModeSettings(deviceId, portId);
266
+ const modeSetid = settings.modeSetid;
267
+ const vpdnums = settings.vpdnums || 107;
268
+
269
+ // Parameter festlegen
270
+ const mode = turnOn ? 2 : 1; // 1=Aus, 2=Ein
271
+
272
+ // Hole den aktuellen onSpeed-Wert
251
273
  const onSpeedState = await this.adapter.getStateAsync(`devices.${deviceId}.ports.${portId}.mode.onSpeed`);
252
- speed = (onSpeedState && typeof onSpeedState.val === 'number' && onSpeedState.val > 0) ?
274
+ const onSpeed = (onSpeedState && typeof onSpeedState.val === 'number' && onSpeedState.val > 0) ?
253
275
  onSpeedState.val : 3; // Fallback auf 3 (mittlere Geschwindigkeit)
254
- } else {
255
- // Wenn ausgeschaltet, im API-Aufruf "speak" auf 0 setzen, aber nicht den onSpeed-Wert aktualisieren
256
- speed = 0;
276
+
277
+ // WICHTIGE ÄNDERUNG:
278
+ // Verwende "speak=0" wenn ausgeschaltet, aber behalte den onSpeed-Wert bei
279
+ const speakValue = turnOn ? onSpeed : 0;
280
+ const onSpeedValue = onSpeed; // Behalte den onSpeed Wert immer bei
281
+
282
+ this.adapter.log.debug(`Mode change - onSpeed: ${onSpeedValue}, speak: ${speakValue}, Mode: ${mode}, turnOn: ${turnOn}`);
283
+
284
+ // Hole offSpeed Wert
285
+ const offSpeedState = await this.adapter.getStateAsync(`devices.${deviceId}.ports.${portId}.mode.offSpeed`);
286
+ const offSpeedValue = (offSpeedState && typeof offSpeedState.val === 'number') ?
287
+ offSpeedState.val : 0;
288
+
289
+ const cmd = `curl -X POST "http://www.acinfinityserver.com/api/dev/addDevMode" -H "User-Agent: ACController/1.8.5 (com.acinfinity.humiture; build:500; iOS 17.0.1) Alamofire/5.7.1" -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" -H "token: ${this.client.token}" -d "modeSetid=${modeSetid}&devId=${deviceId}&externalPort=${portId}&offSpead=${offSpeedValue}&onSpead=${onSpeedValue}&atType=${mode}&speak=${speakValue}&curMode=${mode}&vpdstatus=0&vpdnums=${vpdnums}"`;
290
+
291
+ this.adapter.log.debug(`Executing curl command: ${cmd}`);
292
+
293
+ return new Promise((resolve, reject) => {
294
+ require('child_process').exec(cmd, async (error, stdout, stderr) => {
295
+ if (error) {
296
+ this.adapter.log.error(`Curl command error: ${error.message}`);
297
+ reject(error);
298
+ return;
299
+ }
300
+
301
+ try {
302
+ const response = JSON.parse(stdout);
303
+ if (response && response.code === 200) {
304
+ this.adapter.log.info(`Successfully set device ${deviceId}, port ${portId} to ${turnOn ? 'On' : 'Off'}`);
305
+
306
+ // State als bestätigt markieren
307
+ await this.adapter.setStateAsync(`devices.${deviceId}.ports.${portId}.mode.active`,
308
+ { val: value, ack: true });
309
+
310
+ // Hier NICHT den onSpeed-Wert aktualisieren, wenn wir ausschalten
311
+ // Wir aktualisieren nur den Gerätestatus
312
+
313
+ resolve(true);
314
+ } else {
315
+ this.adapter.log.error(`API error: ${JSON.stringify(response)}`);
316
+ reject(new Error(`API error: ${response.msg || 'Unknown error'}`));
317
+ }
318
+ } catch (parseError) {
319
+ this.adapter.log.error(`Error parsing API response: ${parseError.message}`);
320
+ reject(parseError);
321
+ }
322
+ });
323
+ });
324
+ } catch (error) {
325
+ this.adapter.log.error(`Error controlling device ${deviceId}, port ${portId}: ${error.message}`);
326
+ throw error;
257
327
  }
328
+ }
329
+
330
+ /**
331
+ * Spezialisierte Methode für die Änderung der Aus-Geschwindigkeit
332
+ * @param {string} deviceId - Geräte-ID
333
+ * @param {number} portId - Port-ID
334
+ * @param {number} value - Neuer Geschwindigkeitswert
335
+ * @returns {Promise<boolean>} - True bei Erfolg
336
+ */
337
+ async handleOffSpeedChange(deviceId, portId, value) {
338
+ // UI sofort aktualisieren, um Flackern zu vermeiden
339
+ await this.stateManager.updateUIState(`devices.${deviceId}.ports.${portId}.mode.offSpeed`, parseInt(value));
258
340
 
259
- this.adapter.log.debug(`Mode change - Speed: ${speed}, Mode: ${mode}, turnOn: ${turnOn}`);
260
-
261
- const cmd = `curl -X POST "http://www.acinfinityserver.com/api/dev/addDevMode" -H "User-Agent: ACController/1.8.5 (com.acinfinity.humiture; build:500; iOS 17.0.1) Alamofire/5.7.1" -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" -H "token: ${this.client.token}" -d "modeSetid=${modeSetid}&devId=${deviceId}&externalPort=${portId}&offSpead=0&onSpead=${speed}&atType=${mode}&speak=${speed}&curMode=${mode}&vpdstatus=0&vpdnums=${vpdnums}"`;
262
-
263
- this.adapter.log.debug(`Executing curl command: ${cmd}`);
264
-
265
- return new Promise((resolve, reject) => {
266
- require('child_process').exec(cmd, async (error, stdout, stderr) => {
267
- if (error) {
268
- this.adapter.log.error(`Curl command error: ${error.message}`);
269
- reject(error);
270
- return;
271
- }
272
-
273
- try {
274
- const response = JSON.parse(stdout);
275
- if (response && response.code === 200) {
276
- this.adapter.log.info(`Successfully set device ${deviceId}, port ${portId} to ${turnOn ? 'On' : 'Off'}`);
277
-
278
- // State als bestätigt markieren
279
- await this.adapter.setStateAsync(`devices.${deviceId}.ports.${portId}.mode.active`,
280
- { val: value, ack: true });
281
-
282
- // Hier NICHT den onSpeed-Wert aktualisieren, wenn wir ausschalten
283
- // Wir aktualisieren nur den Gerätestatus
284
-
285
- resolve(true);
286
- } else {
287
- this.adapter.log.error(`API error: ${JSON.stringify(response)}`);
288
- reject(new Error(`API error: ${response.msg || 'Unknown error'}`));
341
+ try {
342
+ // Settings holen für die modeSetid
343
+ const settings = await this.client.getDeviceModeSettings(deviceId, portId);
344
+ const modeSetid = settings.modeSetid;
345
+ const vpdnums = settings.vpdnums || 107;
346
+
347
+ // Hole den aktuellen Modus und onSpeed-Wert
348
+ const currentModeState = await this.adapter.getStateAsync(`devices.${deviceId}.ports.${portId}.mode.active`);
349
+ const currentMode = currentModeState && currentModeState.val ?
350
+ MODE_OPTIONS.indexOf(currentModeState.val) + 1 : 1; // Default zu "Off" (1) wenn nicht bekannt
351
+
352
+ const onSpeedState = await this.adapter.getStateAsync(`devices.${deviceId}.ports.${portId}.mode.onSpeed`);
353
+ const onSpeed = (onSpeedState && typeof onSpeedState.val === 'number') ?
354
+ onSpeedState.val : 3; // Default zu 3 wenn nicht bekannt
355
+
356
+ // Aktuelle Sprechgeschwindigkeit basierend auf Modus
357
+ const speakValue = currentMode === 2 ? onSpeed : 0;
358
+
359
+ // Neuer offSpeed-Wert vom Benutzer
360
+ const offSpeedValue = parseInt(value);
361
+
362
+ this.adapter.log.debug(`Changing offSpeed - offSpeed: ${offSpeedValue}, onSpeed: ${onSpeed}, speak: ${speakValue}, Mode: ${currentMode}`);
363
+
364
+ // API-Aufruf mit explizitem offSpead-Parameter
365
+ const cmd = `curl -X POST "http://www.acinfinityserver.com/api/dev/addDevMode" -H "User-Agent: ACController/1.8.5 (com.acinfinity.humiture; build:500; iOS 17.0.1) Alamofire/5.7.1" -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" -H "token: ${this.client.token}" -d "modeSetid=${modeSetid}&devId=${deviceId}&externalPort=${portId}&offSpead=${offSpeedValue}&onSpead=${onSpeed}&atType=${currentMode}&speak=${speakValue}&curMode=${currentMode}&vpdstatus=0&vpdnums=${vpdnums}"`;
366
+
367
+ this.adapter.log.debug(`Executing curl command for offSpeed change: ${cmd}`);
368
+
369
+ return new Promise((resolve, reject) => {
370
+ require('child_process').exec(cmd, async (error, stdout, stderr) => {
371
+ if (error) {
372
+ this.adapter.log.error(`Curl command error: ${error.message}`);
373
+ reject(error);
374
+ return;
289
375
  }
290
- } catch (parseError) {
291
- this.adapter.log.error(`Error parsing API response: ${parseError.message}`);
292
- reject(parseError);
293
- }
376
+
377
+ try {
378
+ const response = JSON.parse(stdout);
379
+ if (response && response.code === 200) {
380
+ this.adapter.log.info(`Successfully set offSpeed for device ${deviceId}, port ${portId} to ${offSpeedValue}`);
381
+
382
+ // Wichtig: Setze den State als bestätigt mit dem neuen Wert
383
+ await this.adapter.setStateAsync(
384
+ `devices.${deviceId}.ports.${portId}.mode.offSpeed`,
385
+ { val: offSpeedValue, ack: true }
386
+ );
387
+
388
+ // Erzeuge offSpeedCache-State, falls er noch nicht existiert
389
+ const stateObj = {
390
+ type: 'state',
391
+ common: {
392
+ name: 'Cached Off Speed',
393
+ type: 'number',
394
+ role: 'level',
395
+ read: true,
396
+ write: false
397
+ },
398
+ native: {}
399
+ };
400
+
401
+ try {
402
+ await this.adapter.setObjectNotExistsAsync(
403
+ `devices.${deviceId}.ports.${portId}.mode.offSpeedCache`,
404
+ stateObj
405
+ );
406
+ } catch (objError) {
407
+ this.adapter.log.warn(`Couldn't create offSpeedCache state: ${objError.message}`);
408
+ }
409
+
410
+ // Verhindere, dass der nächste Update-Zyklus den Wert überschreibt
411
+ // Speichere den Wert in den lokalen Cache
412
+ await this.adapter.setStateAsync(
413
+ `devices.${deviceId}.ports.${portId}.mode.offSpeedCache`,
414
+ { val: offSpeedValue, ack: true }
415
+ );
416
+
417
+ resolve(true);
418
+ } else {
419
+ this.adapter.log.error(`API error: ${JSON.stringify(response)}`);
420
+ reject(new Error(`API error: ${response.msg || 'Unknown error'}`));
421
+ }
422
+ } catch (parseError) {
423
+ this.adapter.log.error(`Error parsing API response: ${parseError.message}`);
424
+ reject(parseError);
425
+ }
426
+ });
294
427
  });
295
- });
296
- } catch (error) {
297
- this.adapter.log.error(`Error controlling device ${deviceId}, port ${portId}: ${error.message}`);
298
- throw error;
428
+ } catch (error) {
429
+ this.adapter.log.error(`Error setting offSpeed for device ${deviceId}, port ${portId}: ${error.message}`);
430
+ throw error;
431
+ }
299
432
  }
300
- }
301
-
302
433
 
303
434
  /**
304
435
  * Verarbeitet Änderungen an verschachtelten Port-Einstellungen
@@ -67,13 +67,38 @@ class DeviceUpdater {
67
67
  await this.stateManager.updateState(`devices.${deviceId}.info.online`, device.online === 1);
68
68
  await this.stateManager.updateState(`devices.${deviceId}.info.mac`, device.devMacAddr);
69
69
 
70
- // Wandle den numerischen Gerätetyp in einen benutzerfreundlichen Namen um
70
+ // Ermittle die numerische Gerätetypnummer
71
+ let deviceTypeNum = 0;
71
72
  if (typeof device.devType === 'number') {
72
- const deviceTypeStr = this.getDeviceModelByType(device.devType);
73
- await this.stateManager.updateState(`devices.${deviceId}.info.deviceType`, deviceTypeStr);
74
- } else {
75
- // Fallback, falls devType nicht als Zahl vorliegt
76
- await this.stateManager.updateState(`devices.${deviceId}.info.deviceType`, device.devType);
73
+ deviceTypeNum = device.devType;
74
+ } else if (typeof device.devType === 'string') {
75
+ // Versuche, die Zahl zu extrahieren
76
+ const match = device.devType.match(/\d+/);
77
+ if (match) {
78
+ deviceTypeNum = parseInt(match[0], 10);
79
+ }
80
+ }
81
+
82
+ // Verwende zusätzlich den beschreibenden Namen als Text-Beschreibung
83
+ const deviceTypeStr = this.getDeviceModelByType(deviceTypeNum);
84
+
85
+ // Setze den numerischen Gerätetyp
86
+ await this.stateManager.updateState(`devices.${deviceId}.info.deviceType`, deviceTypeNum);
87
+
88
+ // Optional: Füge eine zusätzliche Beschreibung hinzu
89
+ if (deviceTypeStr !== `UIS Controller Typ ${deviceTypeNum}`) {
90
+ await this.adapter.setObjectNotExistsAsync(`devices.${deviceId}.info.deviceTypeDescription`, {
91
+ type: 'state',
92
+ common: {
93
+ name: 'Device Type Description',
94
+ type: 'string',
95
+ role: 'text',
96
+ read: true,
97
+ write: false
98
+ },
99
+ native: {}
100
+ });
101
+ await this.stateManager.updateState(`devices.${deviceId}.info.deviceTypeDescription`, deviceTypeStr);
77
102
  }
78
103
 
79
104
  // Prüfen, wo die Firmware- und Hardwaredaten zu finden sind
@@ -104,6 +104,23 @@ class PortUpdater {
104
104
  }
105
105
  }
106
106
  }
107
+
108
+ // WICHTIG: Prüfe, ob es einen gecachten offSpeed-Wert gibt, bevor wir aktualisieren
109
+ const offSpeedCacheState = await this.adapter.getStateAsync(`devices.${deviceId}.ports.${portId}.mode.offSpeedCache`);
110
+ if (offSpeedCacheState && offSpeedCacheState.val !== undefined) {
111
+ // Wenn ein gecachter Wert existiert, verwende diesen anstelle des API-Werts
112
+ await this.stateManager.updateState(`devices.${deviceId}.ports.${portId}.mode.offSpeed`, offSpeedCacheState.val);
113
+ this.adapter.log.debug(`offSpeed aus Cache verwendet: ${offSpeedCacheState.val} anstelle von API-Wert`);
114
+ } else if (portData.offSpead !== undefined) {
115
+ // Nur aktualisieren, wenn kein Cache existiert
116
+ await this.stateManager.updateState(`devices.${deviceId}.ports.${portId}.mode.offSpeed`, portData.offSpead);
117
+ this.adapter.log.debug(`offSpeed aktualisiert von portData.offSpead: ${portData.offSpead}`);
118
+ } else if (portData.onSpead !== undefined && typeof portData.onSpead === 'number') {
119
+ // Wenn der onSpead-Wert existiert, könnte der offSpeed-Wert ebenfalls dort sein
120
+ const offSpeed = portData.offSpead !== undefined ? portData.offSpead : 0;
121
+ await this.stateManager.updateState(`devices.${deviceId}.ports.${portId}.mode.offSpeed`, offSpeed);
122
+ this.adapter.log.debug(`offSpeed aktualisiert auf Basis von onSpead: ${offSpeed}`);
123
+ }
107
124
  }
108
125
 
109
126
  /**
@@ -122,6 +139,17 @@ class PortUpdater {
122
139
  this.adapter.log.debug(`Aktualisiere Port-Einstellungen für ${deviceId}.${portId}: ${JSON.stringify(settings).substring(0, 500)}...`);
123
140
 
124
141
  try {
142
+ // Explizit nach offSpead im settings-Objekt suchen und aktualisieren
143
+ if (settings.offSpead !== undefined) {
144
+ // Prüfe, ob es einen gecachten Wert gibt
145
+ const offSpeedCacheState = await this.adapter.getStateAsync(`devices.${deviceId}.ports.${portId}.mode.offSpeedCache`);
146
+ if (!offSpeedCacheState || offSpeedCacheState.val === undefined) {
147
+ // Nur aktualisieren, wenn kein Cache existiert
148
+ await this.stateManager.updateState(`devices.${deviceId}.ports.${portId}.mode.offSpeed`, settings.offSpead);
149
+ this.adapter.log.debug(`offSpeed aktualisiert aus Settings: ${settings.offSpead}`);
150
+ }
151
+ }
152
+
125
153
  // Aktualisiere Gerätetyp
126
154
  if (typeof settings[PORT_CONTROL_KEY.DEVICE_LOAD_TYPE] === 'number') {
127
155
  const deviceTypeId = settings[PORT_CONTROL_KEY.DEVICE_LOAD_TYPE];
@@ -160,6 +188,27 @@ class PortUpdater {
160
188
  * @returns {Promise<void>}
161
189
  */
162
190
  async updatePortModeSettings(deviceId, portId, settings) {
191
+ // Überprüfe und aktualisiere offSpead/onSpead direkt aus den Einstellungen
192
+ if (settings[PORT_CONTROL_KEY.OFF_SPEED] !== undefined) {
193
+ // Prüfe, ob es einen gecachten Wert gibt
194
+ const offSpeedCacheState = await this.adapter.getStateAsync(`devices.${deviceId}.ports.${portId}.mode.offSpeedCache`);
195
+ if (!offSpeedCacheState || offSpeedCacheState.val === undefined) {
196
+ // Nur aktualisieren, wenn kein Cache existiert
197
+ await this.stateManager.updateState(
198
+ `devices.${deviceId}.ports.${portId}.mode.offSpeed`,
199
+ settings[PORT_CONTROL_KEY.OFF_SPEED]
200
+ );
201
+ this.adapter.log.debug(`offSpeed aktualisiert aus PORT_CONTROL_KEY.OFF_SPEED: ${settings[PORT_CONTROL_KEY.OFF_SPEED]}`);
202
+ }
203
+ }
204
+
205
+ if (settings[PORT_CONTROL_KEY.ON_SPEED] !== undefined) {
206
+ await this.stateManager.updateState(
207
+ `devices.${deviceId}.ports.${portId}.mode.onSpeed`,
208
+ settings[PORT_CONTROL_KEY.ON_SPEED]
209
+ );
210
+ }
211
+
163
212
  // Aktualisiere Timer-Einstellungen
164
213
  if (typeof settings[PORT_CONTROL_KEY.TIMER_DURATION_TO_ON] === 'number') {
165
214
  await this.stateManager.updateState(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.acinfinity",
3
- "version": "0.4.2",
3
+ "version": "0.5.2",
4
4
  "description": "Monitor and control AC Infinity devices",
5
5
  "author": {
6
6
  "name": "laurent Standard",
@@ -54,7 +54,8 @@
54
54
  ],
55
55
  "scripts": {
56
56
  "test": "mocha test/unit --exit",
57
- "lint": "eslint ."
57
+ "lint": "eslint .",
58
+ "build": "npm run lint && npm test"
58
59
  },
59
60
  "bugs": {
60
61
  "url": "https://github.com/raspilaurent/ioBroker.acinfinity/issues"