diff --git a/docs/USAGE.md b/docs/USAGE.md index 0f44d6be..eb5a2b82 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -66,17 +66,17 @@ Dimmer { ga="Light" } Color { ga="Light" [ colorTemperatureRange="2000,9000" ] } ``` -#### `Light as Group with separate Color and Brightness` +#### `Light as Group with separate Controls` | | | |---|---| | **Device Type** | [Light](https://developers.google.com/assistant/smarthome/guides/light) | | **Supported Traits** | [OnOff](https://developers.google.com/assistant/smarthome/traits/onoff), [ColorSetting](https://developers.google.com/assistant/smarthome/traits/colorsetting), [Brightness](https://developers.google.com/assistant/smarthome/traits/brightness) | -| **Supported Items** | Group as `light` with the following members: (optional) Number or Dimmer as `lightBrightness`, (optional) Number or Dimmer as `lightColorTemperature`, (optional) Color as `lightColor`, (optional) Switch as `lightPower` | +| **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) `useKelvin=true/false`
(optional) `checkState=true/false`
(optional) `colorTemperatureRange="minK,maxK"`
_Hint: if you want to use `lightColorTemperature` you either need to set `useKelvin=true` or `colorTemperatureRange`_ | ```shell -Group lightGroup { ga="Light" [ useKelvin=true, colorTemperatureRange="2000,9000" ] } +Group lightGroup { ga="SpecialColorLight" [ useKelvin=true, colorTemperatureRange="2000,9000" ] } Switch powerItem (lightGroup) { ga="lightPower" } Dimmer brightnessItem (lightGroup) { ga="lightBrightness" } Color colorItem (lightGroup) { ga="lightColor" } diff --git a/functions/devices/specialcolorlight.js b/functions/devices/specialcolorlight.js index 24d48246..d7a87af6 100644 --- a/functions/devices/specialcolorlight.js +++ b/functions/devices/specialcolorlight.js @@ -9,6 +9,10 @@ class SpecialColorLight extends DefaultDevice { return ['action.devices.traits.OnOff', 'action.devices.traits.Brightness', 'action.devices.traits.ColorSetting']; } + static isCompatible(item = {}) { + return item.metadata && item.metadata.ga && item.metadata.ga.value.toLowerCase() == 'specialcolorlight'; + } + static matchesItemType(item) { const members = this.getMembers(item); return ( diff --git a/tests/devices/specialcolorlight.test.js b/tests/devices/specialcolorlight.test.js index 2bc697c3..066d635f 100644 --- a/tests/devices/specialcolorlight.test.js +++ b/tests/devices/specialcolorlight.test.js @@ -6,7 +6,7 @@ describe('SpecialColorLight Device', () => { Device.isCompatible({ metadata: { ga: { - value: 'LIGHT' + value: 'SpecialColorLight' } } })