Skip to content

Commit

Permalink
Change color temperature state reset value (#475)
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <jeremy.setton@gmail.com>
  • Loading branch information
jsetton authored Jan 11, 2022
1 parent 907f58c commit e8bf295
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lambda/alexa/smarthome/handlers/colorController.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* SPDX-License-Identifier: EPL-2.0
*/

const { ItemValue } = require('@openhab/constants');
const { Interface, Property } = require('../constants');
const AlexaHandler = require('./handler');

Expand Down Expand Up @@ -70,9 +69,9 @@ class ColorController extends AlexaHandler {
(state && parseFloat(state.split(',')[2])) || directive.payload.color.brightness * 100
];

// Reset color temperature state if required
if (temperature && temperature.requiresSetColorReset) {
await openhab.postUpdate(temperature.item.name, ItemValue.NULL);
// Reset color temperature state if retrievable and required
if (temperature && temperature.isRetrievable && temperature.requiresSetColorReset) {
await openhab.postUpdate(temperature.item.name, 0);
}

await openhab.sendCommand(color.item.name, hsb.join(','));
Expand Down
2 changes: 1 addition & 1 deletion lambda/test/alexa/cases/colorController.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ module.exports = [
},
openhab: {
commands: [{ name: 'color', value: '350.5,71.38,65.24' }],
updates: [{ name: 'colorTemperature', value: 'NULL' }]
updates: [{ name: 'colorTemperature', value: 0 }]
}
}
}
Expand Down

0 comments on commit e8bf295

Please sign in to comment.