diff --git a/lambda/alexa/smarthome/handlers/colorController.js b/lambda/alexa/smarthome/handlers/colorController.js index 86e387da..5a8a0c2a 100644 --- a/lambda/alexa/smarthome/handlers/colorController.js +++ b/lambda/alexa/smarthome/handlers/colorController.js @@ -11,7 +11,6 @@ * SPDX-License-Identifier: EPL-2.0 */ -const { ItemValue } = require('@openhab/constants'); const { Interface, Property } = require('../constants'); const AlexaHandler = require('./handler'); @@ -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(',')); diff --git a/lambda/test/alexa/cases/colorController.test.js b/lambda/test/alexa/cases/colorController.test.js index 8355ba78..dea15b5a 100644 --- a/lambda/test/alexa/cases/colorController.test.js +++ b/lambda/test/alexa/cases/colorController.test.js @@ -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 }] } } }