From 7752193274bff2083fa7c4a0fb78b2bb163bd185 Mon Sep 17 00:00:00 2001 From: Bram Hoefnagel Date: Sun, 26 Jan 2020 22:31:03 +0100 Subject: [PATCH] Added bri_inc support --- README.md | 1 + lib/hue-light.js | 7 +++++++ red/hue-input.html | 1 + 3 files changed, 9 insertions(+) diff --git a/README.md b/README.md index fca0e28..d1dc505 100644 --- a/README.md +++ b/README.md @@ -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) | diff --git a/lib/hue-light.js b/lib/hue-light.js index ef3f6d4..6a3df5c 100644 --- a/lib/hue-light.js +++ b/lib/hue-light.js @@ -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); diff --git a/red/hue-input.html b/red/hue-input.html index c134a10..0f82c78 100644 --- a/red/hue-input.html +++ b/red/hue-input.html @@ -29,6 +29,7 @@
  • hue HUE (0-359)
  • sat>/saturation Saturation (0-100%)
  • bri/brightness Brightness number (0-100%)
  • +
  • bri_inc Brightness increase number (0-100%)
  • red Red (0-255)
  • green Green (0-255)