Skip to content

Commit

Permalink
Support color sync
Browse files Browse the repository at this point in the history
This allows the color sync functionality to work if it's enabled in the
device settings.
  • Loading branch information
AndreKR committed Mar 17, 2023
1 parent 3140b52 commit 00de169
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion devices/lidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const tzLocal = {
key: ['brightness', 'color', 'color_temp', 'transition'],
options: [exposes.options.color_sync()],
convertSet: async (entity, _key, _value, meta) => {
const newState = {};
let newState = {};

// The color mode encodes whether the light is using its white LEDs or its color LEDs
let colorMode = meta.state.color_mode ?? colorModeLookup[ColorMode.ColorTemp];
Expand Down Expand Up @@ -234,6 +234,10 @@ const tzLocal = {
}
}

// If we're in white mode, calculate a matching display color for the set color temperature. This also kind
// of works in the other direction.
newState = libColor.syncColorState(newState, meta.state, entity, meta.options, meta.logger);

return {state: newState};
},
convertGet: async (entity, key, meta) => {
Expand Down

0 comments on commit 00de169

Please sign in to comment.