Add support for white_value. Fix #70
This commit is contained in:
parent
b7dfd7104c
commit
2c430ce722
@ -98,6 +98,7 @@ Currently, the following attribute settings are supported.
|
|||||||
- `green`
|
- `green`
|
||||||
- `blue`
|
- `blue`
|
||||||
- `effect`
|
- `effect`
|
||||||
|
- `white_value`
|
||||||
|
|
||||||
**For `cover` domain:**
|
**For `cover` domain:**
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -11,8 +11,10 @@ export class LightController extends Controller {
|
|||||||
switch (this.attribute) {
|
switch (this.attribute) {
|
||||||
case "color_temp":
|
case "color_temp":
|
||||||
return Math.ceil(this.stateObj.attributes.color_temp);
|
return Math.ceil(this.stateObj.attributes.color_temp);
|
||||||
|
case "white_value":
|
||||||
|
return Math.ceil(this.stateObj.attributes.white_value);
|
||||||
case "brightness":
|
case "brightness":
|
||||||
return Math.ceil(this.stateObj.attributes.brightness*100.0/255)
|
return Math.ceil(this.stateObj.attributes.brightness*100.0/255);
|
||||||
case "red":
|
case "red":
|
||||||
return this.stateObj.attributes.rgb_color ? Math.ceil(this.stateObj.attributes.rgb_color[0]) : 0;
|
return this.stateObj.attributes.rgb_color ? Math.ceil(this.stateObj.attributes.rgb_color[0]) : 0;
|
||||||
case "green":
|
case "green":
|
||||||
@ -56,6 +58,7 @@ export class LightController extends Controller {
|
|||||||
case "red":
|
case "red":
|
||||||
case "green":
|
case "green":
|
||||||
case "blue":
|
case "blue":
|
||||||
|
case "white_value":
|
||||||
return 255;
|
return 255;
|
||||||
case "hue":
|
case "hue":
|
||||||
return 360;
|
return 360;
|
||||||
@ -141,6 +144,11 @@ export class LightController extends Controller {
|
|||||||
if (("supported_features" in this.stateObj.attributes) &&
|
if (("supported_features" in this.stateObj.attributes) &&
|
||||||
(this.stateObj.attributes.supported_features & 2)) return true;
|
(this.stateObj.attributes.supported_features & 2)) return true;
|
||||||
return false;
|
return false;
|
||||||
|
case "white_value":
|
||||||
|
if ("white_value" in this.stateObj.attributes) return true;
|
||||||
|
if (("supported_features" in this.stateObj.attributes) &&
|
||||||
|
(this.stateObj.attributes.supported_features & 128)) return true;
|
||||||
|
return false;
|
||||||
case "red":
|
case "red":
|
||||||
case "green":
|
case "green":
|
||||||
case "blue":
|
case "blue":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user