[RELEASE] Advanced Lighting Circadian Rhythm

Hello everyone! I'm excited to share a custom app I've been developing: Advanced Lighting Circadian Rhythm.

This is a commercial-grade Circadian Rhythm engine designed to calculate the natural solar color temperature based on your local sunrise and sunset. Instead of directly fighting for control over your bulbs, it outputs the exact calculated Kelvin value to a Hubitat Hub Variable, giving you the flexibility to use that variable in your own rules, WebCoRE pistons, or lighting apps.

:star2: Key Features

  • Live Circadian Dashboard: Provides a real-time view of the sun's position, your outdoor lux, and the exact color temperature (Kelvin) the engine is transmitting to your Hub Variable.
  • Daytime Storm Compensation: Connect an outdoor Lux (Illuminance) sensor. If it gets unusually dark during the middle of the day (like a heavy rainstorm), the app will temporarily drop the color temperature to a cozy, warm setting until the sun comes back out.
  • Manual Color Overrides: Instantly locks the color temperature to a specific value, bypassing the sun logic entirely. This is useful for tasks requiring bright white light at night, or forcing cozy lighting during a dark storm.
  • Master Kill Switch: A master toggle that stops the app from updating the Hub Variable completely, allowing you to manually control your lights without any interference.
  • Circadian Rhythm Boundaries: Defines the absolute floor and ceiling for your color temperature. You can easily set these to match the physical limits of your specific smart bulbs.
  • Customizable Update Frequency: Control how often the app recalculates the sun's position and updates the Hub Variable. Options range from every 1 minute to every 30 minutes.

:unlock: 100% Free and Open Source

This is entirely free-use code. It is fully open source, free to use, and free to edit. You are highly encouraged to modify the code, adapt it for your own unique setup, and do whatever you want with it!

raw.githubusercontent.com/ShaneAllen334/Hubitat_Apps/refs/heads/main/Advanced_Lighting_Circadian_Rhythm/Advanced Lighting Circadian Rhythm.groovy

1 Like

1. Integrated Dimming Intensity Engine

The engine has evolved from a color-shifter to a full intensity-management system. It now calculates a parallel Dimmer Level (%) curve alongside the Color Temperature logic. This allows your home to not only change "mood" but also reduce total light output as the day ends to better align with natural circadian triggers.

2. Selectable Curve Logic: Standard vs. Inverted

You can now define how the brightness behaves relative to the sun’s position:

  • Standard Curve: Mimics the sun (Brightest at Solar Noon, Dimmest at Night). This is the gold standard for indoor living areas to help with evening wind-down.
  • Inverted Curve: Flips the logic (Dimmest at Solar Noon, Brightest at Night). This is a game-changer for outdoor security lighting, landscape lighting, or rooms with significant window glare that need "fill light" only after the sun goes down.

3. Expanded "Output Destination" Protocol

To ensure the engine fits into any automation architecture, we’ve added a flexible output selector. You can now route the calculated Dimmer Level to:

  • Hub Variables: For those using Rule Machine or custom logic.
  • Virtual Dimmer Devices: Allows any standard "Mirror" or "Follower" app to treat the circadian engine as a physical reference point.
  • Dual-Broadcast: Update both a Variable and a Virtual Device simultaneously.

4. Adaptive Dimmer Boundaries

To protect your hardware and ensure the lighting remains comfortable, we’ve added explicit floor and ceiling controls for the dimming curve:

  • Min/Max Level Settings: Define the absolute lowest (e.g., 10%) and highest (e.g., 100%) brightness the engine is allowed to command. This prevents bulbs from flickering at ultra-low levels or getting "too bright" for specific zones.

5. Enhanced Real-Time Dashboard

The Live Circadian Dashboard has been upgraded to provide a unified view of your lighting's "Target State." It now displays:

  • Calculated Dimmer Level: Live view of the current target percentage.
  • Output Routing Status: Instant verification of which Virtual Dimmers or Hub Variables are currently being managed by the engine.
  • Solar Phase Context: Visual confirmation of where you are in the morning ramp, afternoon decay, or nighttime lock phases.

6. Dynamic Storm-Aware Dimming

The Daytime Storm Compensation feature now applies to the dimming engine as well. If your outdoor Lux sensor detects a heavy storm during the day, the engine won't just warm the lights; it will instantly drop the brightness to your "Cozy" setpoint until the weather clears.

App:
raw.githubusercontent.com/ShaneAllen334/Hubitat_Apps/refs/heads/main/Advanced_Lighting_Circadian_Rhythm/Advanced_Lighting_Circadian_Rhythm.groovy