Aurora Borealis Lighting - Realistic Northern Lights Effect for Your Smart Home
I'm excited to share my Aurora Borealis Lighting app for Hubitat! This app creates a harmonious, realistic northern lights effect across all your color-capable bulbs.
What It Does
The Aurora Borealis Lighting app produces a mesmerizing aurora borealis (northern lights) effect by:
- Smoothly transitioning through authentic aurora colors (greens, purples, blues, pinks)
- Synchronizing all bulbs with coordinated color shifts for a cohesive display
- Adjusting brightness levels dynamically to mimic the natural ebb and flow of real auroras
- Using randomized timing to create an organic, ever-changing light show
Perfect for creating ambient lighting during movie nights, parties, or just enjoying a unique atmosphere in your home!
Installation Instructions
- Go to Apps Code in your Hubitat hub
- Click "New App"
- Paste the code below
- Click "Save"
- Go to Apps → Add User App → Aurora Borealis Lighting
- Select your color bulbs and configure settings
Full Code
/**
* Aurora Borealis Lighting
*
* Creates a harmonious, realistic northern lights effect across color bulbs
*
* Copyright 2025
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
*/
definition(
name: "Aurora Borealis Lighting",
namespace: "custom",
author: "Colin Ho",
description: "Simulates Northern Lights by cycling colors on selected color bulbs.",
category: "Lighting",
iconUrl: "",
iconX2Url: "",
iconX3Url: "")
preferences {
section("Select color bulbs for aurora effect") {
input "colorBulbs", "capability.colorControl", title: "Color Bulbs", multiple: true, required: true
}
section("Color change speed (seconds)") {
input "speed", "number", title: "Transition speed", required: true, defaultValue: 3
}
}
def installed() {
initialize()
}
def updated() {
unschedule()
initialize()
}
def initialize() {
runIn(2, auroraLoop)
}
def auroraLoop() {
if (!colorBulbs) return // nothing to do
def speedMs = (settings.speed ?: 3) * 1000
def bulbs = colorBulbs
// Turn off all color bulbs NOT in the selected list
def allColorBulbs = location.allDevices.findAll { it.hasCapability("ColorControl") }
def unselectedBulbs = allColorBulbs - bulbs
unselectedBulbs.each { it.off() }
// Create a harmonious base hue for this cycle (aurora colors: green-blue range)
def baseHue = 50 + new Random().nextInt(40) // Range 50-90 (green to cyan/blue)
def baseSaturation = 85 + new Random().nextInt(15) // Range 85-100
def randomOrder = bulbs.sort{new Random().nextInt()}
randomOrder.eachWithIndex { bulb, idx ->
// Create harmonious offset for each bulb (small variation from base)
def hueOffset = (idx % 3 - 1) * (5 + new Random().nextInt(5)) // -10 to +10 degree variation
def harmonicHue = (baseHue + hueOffset) % 100
def harmonicSaturation = baseSaturation - new Random().nextInt(10) // Slight sat variation
bulb.setColor([hue: harmonicHue, saturation: harmonicSaturation, level: 100])
pauseExecution((speedMs / bulbs.size()).toInteger())
}
runIn(settings.speed ?: 3, auroraLoop)
}
GitHub Repository
For the latest updates, issues, and contributions, visit the project on GitHub:
GitHub - coolineho/Aurora-Borealis-Lighting: Aurora Borealis lighting effects for Hubitat - dynamically cycles through harmonious colors with smooth transitions
Features Summary
Authentic aurora color palette with smooth transitions
Randomized timing for organic, natural effect
Per-bulb color variation for depth and realism
Configurable brightness range and transition timing
Optional switch control to enable/disable effect
Enjoy your own personal northern lights display! Feel free to share your setups and any feedback.
Happy automating! ![]()
