Skip to content

Commit

Permalink
Add color temperature number dimension item type support (#613)
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <jeremy.setton@gmail.com>
  • Loading branch information
jsetton authored Sep 12, 2023
1 parent 2a7f70b commit e08c70c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ Items that represents a color temperature. It is important to note that temperat

* Supported item types:
* Dimmer (Colder `0%` to warmer `100%` based on defined temperature range for bindings integration)
* Number (Color temperature value in Kelvin for custom integration)
* Number(:Temperature) (Color temperature value in Kelvin for custom integration)
* Supported binding presets:
* [hue](https://www.openhab.org/addons/bindings/hue/) [color=`2000:6500`, white=`2200:6500`]
* [lifx](https://www.openhab.org/addons/bindings/lifx/) [color=`2500:9000`, white=`2700:6500`]
Expand Down
4 changes: 2 additions & 2 deletions lambda/alexa/smarthome/properties/colorTemperature.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class ColorTemperature extends AlexaProperty {
* @return {Array}
*/
get supportedItemTypes() {
return [ItemType.DIMMER, ItemType.NUMBER];
return [ItemType.DIMMER, ItemType.NUMBER, ItemType.NUMBER_TEMPERATURE];
}

/**
Expand Down Expand Up @@ -110,7 +110,7 @@ export default class ColorTemperature extends AlexaProperty {
* @return {Boolean}
*/
get requiresSetColorReset() {
return this.item.type === ItemType.NUMBER && this.parameters[Parameter.REQUIRES_SET_COLOR_RESET] === true;
return this.item.type !== ItemType.DIMMER && this.parameters[Parameter.REQUIRES_SET_COLOR_RESET] === true;
}

/**
Expand Down
19 changes: 19 additions & 0 deletions lambda/test/alexa/cases/discovery/light.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ export default {
}
}
},
{
type: 'Number:Temperature',
name: 'colorTemperature11',
label: 'Color Temperature 11',
metadata: {
alexa: {
value: 'ColorTemperature'
}
}
},
{
type: 'Color',
name: 'light99',
Expand Down Expand Up @@ -371,6 +381,15 @@ export default {
item: { name: 'colorTemperature10', type: 'Number' }
}
]
},
colorTemperature11: {
capabilities: [
'Alexa.ColorTemperatureController.colorTemperatureInKelvin',
'Alexa.EndpointHealth.connectivity',
'Alexa'
],
displayCategories: ['LIGHT'],
friendlyName: 'Color Temperature 11'
}
}
};

0 comments on commit e08c70c

Please sign in to comment.