Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bri_inc support #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ More advanced way to control the light is to send an object payload with one or
| `x` and/or `y`| Set XY color (0.0-1.0) |
| `sat` or `saturation` | Set color saturation (0-100) |
| `bri` or `brightness` | Set light brightness (0-100%) |
| `bri_inc` | Set brightness increase (0-100%) (0 to stop transition) |
| `ct`, `mired` or `mirek` | Set Mired color temperature (153 - 500) |
| `kelvin` | Set kelvin color temperature (2200-6500) |
| `duration` | Transition time (ms) |
Expand Down
7 changes: 7 additions & 0 deletions lib/hue-light.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,13 @@ LightItem.prototype.setColor = function setColor(input) {
newState.off();
}

//Brightness Increase/Decrease specified
if (_.isFinite(input.bri_inc)&&input.bri_inc>-101 &&input.bri_inc<101){
newState.bri_inc((input.bri_inc * 0xFF)/100);

this.modified += Math.round(1 + (input.duration/1000));
}

// Duration specified
if (_.isFinite(input.duration) && input.duration > 0) {
newState.transition(input.duration);
Expand Down
1 change: 1 addition & 0 deletions red/hue-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<li><code>hue</code> HUE (0-359)</li>
<li><code>sat></code>/<code>saturation</code> Saturation (0-100%)</li>
<li><code>bri</code>/<code>brightness</code> Brightness number (0-100%)</li>
<li><code>bri_inc</code> Brightness increase number (0-100%)</li>

<li><code>red</code> Red (0-255)</li>
<li><code>green</code> Green (0-255)</li>
Expand Down