diff --git a/docs/USAGE.md b/docs/USAGE.md
index 4ce47825..a0f5da68 100644
--- a/docs/USAGE.md
+++ b/docs/USAGE.md
@@ -94,7 +94,7 @@ Color { ga="Light" [ colorTemperatureRange="2000,9000" ] }
| **Device Type** | [Light](https://developers.home.google.com/cloud-to-cloud/guides/light) |
| **Supported Traits** | [OnOff](https://developers.home.google.com/cloud-to-cloud/traits/onoff), [ColorSetting](https://developers.home.google.com/cloud-to-cloud/traits/colorsetting), [Brightness](https://developers.home.google.com/cloud-to-cloud/traits/brightness) |
| **Supported Items** | Group as `SpecialColorLight` with the following members:
(optional) Number or Dimmer as `lightBrightness`
(optional) Number or Dimmer as `lightColorTemperature`
(optional) Color as `lightColor`
(optional) Switch as `lightPower` |
-| **Configuration** | (optional) `colorUnit=percent/kelvin/mired`
(optional) `checkState=true/false`
(optional) `colorTemperatureRange="minK,maxK"`
_Hint: if you want to use `lightColorTemperature` you either need to set `colorUnit` to `kelvin` or `mired` or define a `colorTemperatureRange` as `colorUnit` defaults to `percent`_ |
+| **Configuration** | (optional) `colorUnit=percent/kelvin/mired`
(optional) `checkState=true/false`
(optional) `colorTemperatureRange="minK,maxK"`
_Hint: if you want to use `lightColorTemperature`, you must either set `colorUnit` to `kelvin` or `mired` or define a `colorTemperatureRange`, because `colorUnit` defaults to `percent`_ |
```shell
Group lightGroup { ga="SpecialColorLight" [ colorUnit="kelvin", colorTemperatureRange="2000,9000" ] }
diff --git a/functions/commands/colorabsolutetemperature.js b/functions/commands/colorabsolutetemperature.js
index 45476642..f5859d1c 100644
--- a/functions/commands/colorabsolutetemperature.js
+++ b/functions/commands/colorabsolutetemperature.js
@@ -42,10 +42,7 @@ class ColorAbsoluteTemperature extends DefaultCommand {
return convertMired(params.color.temperature).toString();
}
const { temperatureMinK, temperatureMaxK } = SpecialColorLight.getAttributes(item).colorTemperatureRange;
- return (
- 100 -
- ((params.color.temperature - temperatureMinK) / (temperatureMaxK - temperatureMinK)) * 100
- ).toString();
+ return (((params.color.temperature - temperatureMinK) / (temperatureMaxK - temperatureMinK)) * 100).toString();
} catch (error) {
return '0';
}
diff --git a/functions/devices/specialcolorlight.js b/functions/devices/specialcolorlight.js
index fa95ed2b..90d6a56b 100644
--- a/functions/devices/specialcolorlight.js
+++ b/functions/devices/specialcolorlight.js
@@ -94,7 +94,7 @@ class SpecialColorLight extends DefaultDevice {
state.color = {
temperatureK:
temperatureMinK +
- Math.round(((temperatureMaxK - temperatureMinK) / 100) * (100 - Number(members[member].state)) || 0)
+ Math.round(((temperatureMaxK - temperatureMinK) / 100) * Number(members[member].state) || 0)
};
}
} catch (error) {
diff --git a/tests/commands/colorabsolutetemperature.test.js b/tests/commands/colorabsolutetemperature.test.js
index 6083e6b5..c8e11bc0 100644
--- a/tests/commands/colorabsolutetemperature.test.js
+++ b/tests/commands/colorabsolutetemperature.test.js
@@ -54,7 +54,7 @@ describe('ColorAbsoluteTemperature Command', () => {
}
};
const device = { customData: { deviceType: 'SpecialColorLight' } };
- expect(Command.convertParamsToValue(params, item, device)).toBe('75');
+ expect(Command.convertParamsToValue(params, item, device)).toBe('25');
expect(Command.convertParamsToValue(params, { state: '100,100,50' }, device)).toBe('0');
});
diff --git a/tests/devices/specialcolorlight.test.js b/tests/devices/specialcolorlight.test.js
index 0c23f025..02cf3378 100644
--- a/tests/devices/specialcolorlight.test.js
+++ b/tests/devices/specialcolorlight.test.js
@@ -305,7 +305,7 @@ describe('SpecialColorLight Device', () => {
}
},
{
- state: '23',
+ state: '77',
metadata: {
ga: {
value: 'lightColorTemperature'
@@ -422,7 +422,7 @@ describe('SpecialColorLight Device', () => {
}
},
{
- state: '20',
+ state: '80',
metadata: {
ga: {
value: 'lightColorTemperature'
@@ -469,7 +469,7 @@ describe('SpecialColorLight Device', () => {
}
},
{
- state: '20',
+ state: '80',
metadata: {
ga: {
value: 'lightColorTemperature'
@@ -567,7 +567,7 @@ describe('SpecialColorLight Device', () => {
}
},
{
- state: '20',
+ state: '80',
metadata: {
ga: {
value: 'lightColorTemperature'