2.0.0 • Published 6 months ago

homebridge-hue-daylight-sync v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

Hue Daylight Sync

npm version npm downloads GitHub Issues GitHub pull requests verified-by-homebridge

Hue Daylight Sync: Automated Philips Hue Light Adjustment for Natural Daylight Cycles

Hue Daylight Sync is a Homebridge plugin that automatically adjusts your Philips Hue lights based on the natural daylight cycle. It calculates the ideal color temperature throughout the day based on your geographical location and smoothly transitions your lights to match.

Demo

Features

  • Natural Bell Curve Color Temperature Transitions
  • Smooth, Gradual Changes: The plugin now uses a cosine function to create a smooth, bell-shaped curve for color temperature transitions throughout the day.
  • Enhanced Natural Lighting: Mimics the natural progression of daylight, providing a more comfortable and realistic lighting environment.
  • Automatic color temperature adjustment based on time of day
  • Customizable warm and cool temperature ranges
  • Geolocation-based calculations for accurate sunlight mimicking
  • Manual override option with automatic mode switch
  • Exclude specific lights from automatic adjustments
  • Smart retry mechanism for reliable updates

Auto Mode and Manual Adjustments

  • Auto Mode: Automatically adjusts your lights' color temperature based on the time of day. Enabled by default.
  • Manual Adjustments: Changing the brightness slider or color temperature in the Home app will disable Auto Mode, allowing you to set your preferred lighting.
  • Re-Enabling Auto Mode: To resume automatic adjustments, simply toggle the "Auto Mode" switch back on in the Home app.
  • Excluded Lights: Specify lights that should never be automatically adjusted, perfect for accent lighting or areas where you want consistent color temperature.

Prerequisites

  • Homebridge installed on your system
  • Philips Hue Bridge with API access - Hue Guide
  • Philips Hue color temperature capable lights

Installation

  1. Install the plugin through Homebridge UI or manually:
npm install -g homebridge-hue-daylight-sync
  1. Configure the plugin in your Homebridge config.json or through the Homebridge UI.

Configuration

Add the following to your Homebridge config.json file:

{
  "platforms": [
    {
      "platform": "HueDaylightSync",
      "name": "Hue Daylight Sync",
      "bridgeIp": "YOUR_HUE_BRIDGE_IP",
      "apiToken": "YOUR_HUE_API_TOKEN",
      "latitude": 51.5072,  // Replace with your latitude
      "longitude": 0.1276,  // Replace with your longitude
      "warmTemp": 2700,
      "coolTemp": 3000,
      "curveExponent": 3,
      "updateInterval": 300000,
      "inputDebounceDelay": 750,
      "defaultAutoMode": true,
      "excludedLights": []  // Array of light IDs to exclude from auto adjustments
    }
  ]
}

Configuration Options

OptionTypeDescriptionDefault
bridgeIpstringThe IP address of your Hue BridgeRequired
apiTokenstringYour Hue API tokenRequired
latitudenumberYour geographical decimal degrees latitude. Example: 51.5072 for London, but use your location's coordinatesRequired
longitudenumberYour geographical decimal degrees longitude. Example: 0.1276 for London, but use your location's coordinatesRequired
warmTempnumberWarmest color temperature in Kelvin2700
coolTempnumberCoolest color temperature in Kelvin3000
curveExponentnumberAdjusts the steepness of the transition curve3
updateIntervalnumberInterval in milliseconds between temperature updates300000 (5 minutes)
inputDebounceDelaynumberDelay in milliseconds to prevent rapid successive updates750
defaultAutoModebooleanEnable Auto Mode by defaulttrue
excludedLightsstring[]Array of light IDs to exclude from automatic adjustments[]

Note: For latitude and longitude, you must enter the coordinates for your specific location. The values shown in the example are for London, UK - make sure to replace these with your own coordinates.

You can find your coordinates using online services like Google Maps or websites like https://www.latlong.net/

Excluding Lights

To exclude specific lights from automatic adjustments:

  1. Find the light ID from your Hue Bridge (using the Hue API or developer tools)
  2. Add the light ID to the excludedLights array in your config
  3. Excluded lights will maintain their manual settings and won't be affected by the daylight sync

Example configuration with excluded lights:

{
  "excludedLights": ["light1", "light2"]
}

Usage

Once installed and configured, the plugin will appear in your Home app as a light accessory with an additional switch for the Auto Mode.

  • Toggle the main switch to turn the Daylight Sync on or off.
  • Use the brightness slider to manually adjust the color temperature.
  • Toggle the Auto Mode switch to enable or disable automatic temperature adjustments.
  • Excluded lights will maintain their manual settings regardless of Auto Mode status.

When Auto Mode is enabled, the plugin will automatically adjust your Hue lights' color temperature throughout the day to match natural daylight patterns.

Troubleshooting

If you encounter any issues:

  1. Check your Homebridge logs for any error messages.
  2. Ensure your Hue Bridge IP and API token are correct.
  3. Verify that your latitude and longitude are set correctly.
  4. Make sure your Hue lights support color temperature adjustments.
  5. Verify that excluded light IDs are correct if using that feature.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Acknowledgements

1.4.0

9 months ago

2.0.0

6 months ago

1.3.9

9 months ago

1.3.8

9 months ago

1.3.7

9 months ago

1.3.6

9 months ago

1.3.5

9 months ago

1.3.4

9 months ago

1.3.3

9 months ago

1.3.2

9 months ago

1.3.1

9 months ago

1.3.0

9 months ago

1.2.0

9 months ago

1.1.25

9 months ago

1.1.24

9 months ago

1.1.23

9 months ago

1.1.22

9 months ago

1.1.21

9 months ago

1.1.10

9 months ago

1.1.9

9 months ago

1.1.8

9 months ago

1.1.7

9 months ago

1.1.6

9 months ago

1.1.5

9 months ago

1.1.4

9 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.1.13

9 months ago

1.1.12

9 months ago

1.1.11

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.1793

9 months ago

1.0.1792

9 months ago

1.0.1791

9 months ago

1.0.179

9 months ago

1.0.178

9 months ago

1.0.177

9 months ago

1.0.176

9 months ago

1.0.175

9 months ago

1.0.174

9 months ago

1.0.173

9 months ago

1.0.172

9 months ago

1.0.171

9 months ago

1.0.17

9 months ago

1.0.169

9 months ago

1.0.168

9 months ago

1.0.167

9 months ago

1.0.165

9 months ago

1.0.164

9 months ago

1.0.163

9 months ago

1.0.162

9 months ago

1.0.161

9 months ago

1.0.16

9 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago