Skip to content

Commit

Permalink
Playlist could not be changed when switchMode was active
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbs96 committed Nov 19, 2022
1 parent 35f3fc6 commit ef02e41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}} */
Expand All @@ -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}`);
Expand Down Expand Up @@ -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}`);
Expand Down Expand Up @@ -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}`);
Expand All @@ -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}`);
Expand Down

1 comment on commit ef02e41

@patrickbs96
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.