From ef02e4128fae990bda1fdcc4c244341e5f7a0d2b Mon Sep 17 00:00:00 2001 From: Patrick <49351462+patrickbs96@users.noreply.github.com> Date: Sat, 19 Nov 2022 16:21:35 +0100 Subject: [PATCH] Playlist could not be changed when switchMode was active --- README.md | 4 ++++ main.js | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a923ab1e..fcbacf55 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,10 @@ sendTo('twinkly.0', 'generateFrame', { Placeholder for the next version (at the beginning of the line): ### **WORK IN PROGRESS** --> +### **WORK IN PROGRESS** +* Fixed deprecated messages from Sentry with api-validations +* Automatic switch mode had an error with playlists. Playlist item could never be selected. + ### 1.0.6 (2022-11-19) * Fixed polling (ledBri, ledSat) * Added Connection-Info diff --git a/main.js b/main.js index c9724218..b1f9288d 100644 --- a/main.js +++ b/main.js @@ -155,7 +155,7 @@ async function stateChange(id, state) { }); await connection.twinkly.setLEDColorHSV(json.hue, json.saturation, json.value); - changeMode = true; + changeMode = connection.twinkly.ledMode !== twinkly.lightModes.value.color; } else if ([apiObjectsMap.ledColor.child.red.id, apiObjectsMap.ledColor.child.green.id, apiObjectsMap.ledColor.child.blue.id, apiObjectsMap.ledColor.child.white.id, apiObjectsMap.ledColor.child.hex.id].includes(command)) { /** @type {{red: Number, green: Number, blue: Number, white: Number}} */ @@ -175,7 +175,7 @@ async function stateChange(id, state) { } await connection.twinkly.setLEDColorRGBW(json.red, json.green, json.blue, json.white); - changeMode = true; + changeMode = connection.twinkly.ledMode !== twinkly.lightModes.value.color; } } catch (e) { adapter.log.error(`[${connectionName}.${group}.${command}] Could not set ${state.val}! ${e}`); @@ -210,7 +210,7 @@ async function stateChange(id, state) { adapter.log.warn(`[${connectionName}.${command}] Effect ${state.val} does not exist!`); } else { await connection.twinkly.setCurrentLEDEffect(state.val); - changeMode = true; + changeMode = connection.twinkly.ledMode !== twinkly.lightModes.value.effect; } } catch (e) { adapter.log.error(`[${connectionName}.${command}] Could not set ${state.val}! ${e}`); @@ -290,7 +290,7 @@ async function stateChange(id, state) { adapter.log.warn(`[${connectionName}.${command}] Movie ${state.val} does not exist!`); } else { await connection.twinkly.setCurrentMovie(state.val); - changeMode = true; + changeMode = connection.twinkly.ledMode !== twinkly.lightModes.value.movie; } } catch (e) { adapter.log.error(`[${connectionName}.${command}] Could not set ${state.val}! ${e}`); @@ -315,7 +315,7 @@ async function stateChange(id, state) { adapter.log.warn(`[${connectionName}.${command}] Playlist ${state.val} does not exist!`); } else { await connection.twinkly.setCurrentPlaylistEntry(state.val); - changeMode = true; + changeMode = connection.twinkly.ledMode !== twinkly.lightModes.value.playlist; } } catch (e) { adapter.log.error(`[${connectionName}.${command}] Could not set ${state.val}! ${e}`);