diff --git a/LICENSE b/LICENSE index 090caf53..d90f4158 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 patrickbs96 +Copyright (c) 2022 patrickbs96 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index bb676ddf..ff98c73f 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,12 @@ The following Settings are available: In the table you can add all the Twinkly lights you want to control. -| Column | Description | -|--------------|------------------------------------| -| `Enabled` | Shall this connection be accessed | -| `Name` | Name of the connection in ioBroker | -| `IP Address` | IP-Address to the Twinkly Lights | +| Column | Description | +|--------------|----------------------------------------------------------------| +| `Enabled` | Shall this connection be accessed | +| `Name` | Name of the connection in ioBroker | +| `IP Address` | IP-Address to the Twinkly Lights | +| `State On` | Which `ledMode` should be activated when state `on` is enabled | The following additionals States are created per device when checked: * Device Info @@ -46,7 +47,7 @@ The following States are available: | `details` | :x: | Device Details | | `firmware` | :x: | Firmware Version | | `ledBri` | :heavy_check_mark: | Brightness (deactivate control with -1) | -| `ledColor` | :heavy_check_mark: | Color of LEDs, HSV/RGB(W)/HEX | +| `ledColor` | :heavy_check_mark: | Color of LEDs, HSV/RGB(W)/HEX (`Color`) | | `ledConfig` | :heavy_check_mark: | Configuration of LEDs | | `ledEffect` | :heavy_check_mark: | Effects (`Effect`) | | `ledLayout` | :heavy_check_mark: | Layout of LEDs (disabled for further testing) | @@ -72,6 +73,9 @@ The following States are available: ## Changelog +### 0.2.11 (2022-01-02) +* (patrickbs96) Add setting to select which ledMode should be activated + ### 0.2.10 (2021-12-31) * (patrickbs96) Add setting to enable automatically switching of Mode after State change (color, effect, movie, playlist) @@ -135,7 +139,7 @@ The following States are available: ## License MIT License -Copyright (c) 2021 patrickbs96 +Copyright (c) 2022 patrickbs96 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/admin/index_m.html b/admin/index_m.html index d5a64b6d..ef125d4c 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -49,6 +49,8 @@ for (let i = 0; i < devices.length; i++) { if (devices[i].enabled === undefined) devices[i].enabled = true; + if (devices[i].stateOn === undefined) + devices[i].stateOn = 'movie'; } for (const key in settings) { @@ -56,15 +58,12 @@ const $value = $('#' + key + '.value'); if ($value.attr('type') === 'checkbox') { - $value.prop('checked', settings[key]).on('change', function() { - onChange(); - }); + $value.prop('checked', settings[key]) + .on('change', onChange); } else { - $value.val(settings[key]).on('change', function() { - onChange(); - }).keyup(function() { - onChange(); - }); + $value.val(settings[key]) + .on('change', onChange) + .keyup(onChange); } } @@ -107,12 +106,13 @@
add
- +
- - - + + + + diff --git a/admin/words.js b/admin/words.js index 36ad2b54..322fbf25 100644 --- a/admin/words.js +++ b/admin/words.js @@ -133,5 +133,65 @@ systemDictionary = { 'es': 'Cambiar de modo después del cambio de estado', 'pl': 'Przełącz tryb po zmianie stanu', 'zh-cn': '状态改变后切换模式' + }, + 'State On': { + 'en': 'State On', + 'de': 'Status an', + 'ru': 'Состояние включено', + 'pt': 'Estado Ligado', + 'nl': 'Staat Aan', + 'fr': 'État activé', + 'it': 'Stato attivo', + 'es': 'Estado encendido', + 'pl': 'Stan włączony', + 'zh-cn': '状态开启' + }, + 'Color': { + 'en': 'Color', + 'de': 'Farbe', + 'ru': 'Цвет', + 'pt': 'Cor', + 'nl': 'Kleur', + 'fr': 'Couleur', + 'it': 'Colore', + 'es': 'Color', + 'pl': 'Kolor', + 'zh-cn': '颜色' + }, + 'Effect': { + 'en': 'Effect', + 'de': 'Effekt', + 'ru': 'Эффект', + 'pt': 'Efeito', + 'nl': 'Effect', + 'fr': 'Effet', + 'it': 'Effetto', + 'es': 'Efecto', + 'pl': 'Efekt', + 'zh-cn': '影响' + }, + 'Movie': { + 'en': 'Movie', + 'de': 'Film', + 'ru': 'Кино', + 'pt': 'Filme', + 'nl': 'Film', + 'fr': 'Film', + 'it': 'Film', + 'es': 'Película', + 'pl': 'Film', + 'zh-cn': '电影' + }, + 'Playlist': { + 'en': 'Playlist', + 'de': 'Wiedergabeliste', + 'ru': 'Плейлист', + 'pt': 'Lista de reprodução', + 'nl': 'afspeellijst', + 'fr': 'Playlist', + 'it': 'elenco di riproduzione', + 'es': 'Lista de reproducción', + 'pl': 'Lista odtwarzania', + 'zh-cn': '播放列表' } }; \ No newline at end of file diff --git a/img/admin.png b/img/admin.png index 02ffd5d2..ea7b7df5 100644 Binary files a/img/admin.png and b/img/admin.png differ diff --git a/io-package.json b/io-package.json index 6d837fed..4e097914 100644 --- a/io-package.json +++ b/io-package.json @@ -1,8 +1,20 @@ { "common": { "name": "twinkly", - "version": "0.2.10", + "version": "0.2.11", "news": { + "0.2.11": { + "en": "Add setting to select which ledMode should be activated", + "de": "Einstellung hinzufügen, um auszuwählen, welcher LEDMode aktiviert werden soll", + "ru": "Добавьте настройку, чтобы выбрать, какой ledMode должен быть активирован", + "pt": "Adicionar configuração para selecionar qual ledMode deve ser ativado", + "nl": "Instelling toevoegen om te selecteren welke ledMode moet worden geactiveerd", + "fr": "Ajouter un paramètre pour sélectionner quel ledMode doit être activé", + "it": "Aggiungi impostazione per selezionare quale ledMode deve essere attivato", + "es": "Agregar configuración para seleccionar qué ledMode debe activarse", + "pl": "Dodaj ustawienie, aby wybrać, który tryb led powinien być aktywowany", + "zh-cn": "添加设置以选择应激活哪个 ledMode" + }, "0.2.10": { "en": "Add setting to enable automatic switching Mode after State change (color, effect, movie, playlist)", "de": "Einstellung hinzufügen, um den automatischen Wechselmodus nach Statusänderung zu aktivieren (color, effect, movie, playlist)", diff --git a/main.js b/main.js index 18eeaa98..e45cffea 100644 --- a/main.js +++ b/main.js @@ -22,7 +22,7 @@ let pollingInterval = null; /** * Twinkly-Verbindungen - * @type {{[x: string]: {enabled: Boolean, paused: Boolean, name: String, host: String, connected: Boolean, twinkly: Twinkly}}} + * @type {{[x: string]: {enabled: Boolean, paused: Boolean, name: String, host: String, stateOn: String, connected: Boolean, twinkly: Twinkly}}} */ const connections = {}; @@ -605,7 +605,7 @@ function startAdapter(options) { // Gerät ein-/ausschalten } else if (!group && command === stateNames.on.id) { try { - await connection.twinkly.setLEDMode(state.val ? twinkly.lightModes.value.movie : twinkly.lightModes.value.off); + await connection.twinkly.setLEDMode(state.val ? connection.stateOn : twinkly.lightModes.value.off); } catch (e) { adapter.log.error(`[${connectionName}.${command}] Could not set ${state.val}! ${e.message}`); } @@ -1065,6 +1065,7 @@ async function syncConfig() { paused : false, name : deviceName, host : device.host, + stateOn : device.stateOn && Object.keys(twinkly.lightModes.value).includes(device.stateOn) ? device.stateOn : twinkly.lightModes.value.movie, connected : false, twinkly : new twinkly.Twinkly(adapter, deviceName, device.host, handleSentryMessage) }; diff --git a/package-lock.json b/package-lock.json index 0ed39da5..15f55842 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "iobroker.twinkly", - "version": "0.2.10", + "version": "0.2.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 623a57fc..3eb29a9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.twinkly", - "version": "0.2.10", + "version": "0.2.11", "description": "Adapter to communicate with the Twinkly lights.", "author": { "name": "patrickbs96",
EnabledNameIP AddressEnabledNameIP AddressState On