Hue Daylight
Auto change hue lights to match daylight based on the sun schedule
Usage
const hueDaylight = require('hue-daylight');
const daylight = hueDaylight(config); // See example config beloy
daylight.start();
// Later
daylight.stop();
Example Config
// config.js
module.exports = {
// fake: {
// initial:
// skip:
// },
colors: {
'<name>': [x, y] // Color xy format
RED : [ 0.6807, 0.3032],
ORNG: [ 0.6041, 0.3743],
GOLD: [ 0.4566, 0.4108],
PINK: [ 0.3203, 0.3172],
BLUE: [ 0.3003, 0.3102]
}
bridge: {
username: '' // Hue Bridge Username
ipaddress: '192.168.1.117' // IP of Hue Bridge
}
location: {
// Used to calc sunrise / sunset
lat: 30.2198,
lon: -98.3586,
},
interval: 5,
configurations: [
{
name: /^recessed|light/i, // regex to match
breakpoints: [
{offset: -1.00, color: 'GOLD'},
{offset: -0.30, color: 'RED'},
{offset: 0.00, color: 'ORNG'},
{offset: 0.05, color: 'GOLD'},
{offset: 0.15, color: 'PINK'},
{offset: 0.50, color: 'PINK'},
{offset: 0.60, color: 'BLUE'},
{offset: 0.70, color: 'PINK'},
{offset: 0.95, color: 'GOLD'},
{offset: 2.00, color: 'GOLD'}
]
}
]
};
Offset
Offset is scaled based on sunrise and sunset. We use 3 ranges:
When | Range |
---|
0:00 to sunrise | -1 to 0 |
sunrise to sunset | 0 to 1 |
sunset to 23:59 | 1 to 2 |