Skip to content

Commit

Permalink
making brightness only profile possible
Browse files Browse the repository at this point in the history
fixes #4
  • Loading branch information
tcarlsen committed Nov 22, 2019
1 parent eb26007 commit 637e8a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ light_profiles:
bright: '0.457,0.408,254'
dimmed: '0.457,0.408,77'
nightlight: '0.509,0.411,1'
brightness_only: '0,0,150'
```

3. Lastly add the custom card:
Expand Down
10 changes: 8 additions & 2 deletions light-with-profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ class LightWithProfiles extends LitElement {
}

profileClass(stateObj, profile) {
if (stateObj.attributes.xy_color && stateObj.attributes.brightness) {
const activeProfile = `${stateObj.attributes.xy_color.toString()},${stateObj.attributes.brightness.toString()}`;
let XYcolor = '0,0';

if (stateObj.attributes.xy_color) {
XYcolor = stateObj.attributes.xy_color.toString();
}

if (stateObj.attributes.brightness) {
const activeProfile = `${XYcolor},${stateObj.attributes.brightness.toString()}`;

if (activeProfile === this.lightProfiles[profile]) {
return true;
Expand Down

0 comments on commit 637e8a7

Please sign in to comment.