Lighting control in a growing operation means three different things at three different time scales. At the seconds scale, it is turning individual fixtures on and off. At the minutes scale, it is dimming fixtures to match solar availability or adjusting spectrum through the day. At the hours-and-days scale, it is managing photoperiod for plants whose flowering depends on day length, and tracking daily light integral so the crop accumulates the energy it needs over the course of each day. A working lighting-control setup in Home Assistant handles all three scales deliberately. Specific-value content on this page includes how to calculate DLI from a PAR sensor, how to build supplemental-lighting automations that actually save energy rather than wasting it, how to handle the photoperiod interruption risk that catches indoor growers regularly, and how to avoid the common failure modes that produce wasted electricity or unexpected plant responses. The hardware and software patterns matter less than the conceptual clarity about what is being controlled and why.
Before building lighting automations.
Prerequisites from earlier pages:
Areas and naming conventions established. Per [Organizing Home Assistant for a Farm](/home-assistant/agriculture/organizing).
Understanding the crop's lighting needs. Different crops have different DLI targets, different photoperiod sensitivities, different spectrum preferences. The [Understanding Sensors](/fundamentals/understanding-sensors) Fundamentals page covers measurement theory. Extension resources or crop-specific guides provide the numbers for specific crops.
Light sensor with the right units. A lux meter or visible-light sensor reports what the human eye sees, not what plants use. For serious lighting control, a PAR sensor (quantum sensor) reporting PPFD in μmol/m²/s is what the automation needs. Consumer light sensors are fine for presence detection and ambient awareness; they do not substitute for PAR measurement when DLI or photosynthesis matters.
Hardware safety for lighting. Over-temperature protection on fixtures. Proper electrical protection (breakers sized for the load). GFCI protection where water and lighting share a space. Surge protection on lighting circuits. As elsewhere in this section, Home Assistant handles operational control; hardware handles catastrophic cases.
The three time scales.
Lighting control operates at three distinct time scales, and a deployment that handles only one loses value.
Instantaneous control (seconds). Turn a fixture on or off, dim to a specific level, set spectrum. The raw actuator commands. This is what most smart-plug and smart-bulb integrations support.
Responsive control (minutes). Dim supplemental lighting up or down as the sun's contribution changes. Turn supplemental on when PPFD from natural light drops below a threshold. Turn it off when natural light recovers. This is where real energy savings happen in greenhouses.
Integrative control (hours and days). Manage photoperiod for flowering-sensitive crops. Accumulate DLI through the day and finish supplemental lighting when the day's target is met. Handle seasonal shifts in natural light availability.
A well-designed lighting control setup handles all three scales, with the hours-and-days logic driving the minutes logic, and the minutes logic driving the seconds-scale actuator commands.
Photoperiod management.
For crops whose flowering depends on day length — cannabis, chrysanthemums, poinsettias, many ornamentals, some vegetables — photoperiod control is the most important lighting consideration.
Photoperiod vs. DLI.
These are distinct. Photoperiod is how many hours per day the plant sees light. DLI is how much total light energy the plant receives per day. A plant can get the same DLI from a short bright day (16 hours at 500 μmol/m²/s) or a longer moderate day (12 hours at 667 μmol/m²/s). Photoperiod-sensitive plants care about the hours; DLI-limited plants care about the total energy.
Vegetative vs. flowering photoperiod.
Many crops vegetate under long photoperiods (18-24 hours light) and flower under shorter ones (12 hours light, 12 hours dark — for short-day plants). The transition from vegetative to flowering is triggered by the change in photoperiod.
Interruption risk.
A plant in the dark portion of its photoperiod that experiences even a brief light interruption (a few minutes of bright light in the middle of a 12-hour dark period) can revert to vegetative state or produce intersex problems. This makes photoperiod interruption more than an inconvenience — it can ruin a flowering cycle.
The implications for automation:
- Automations that control the main grow lights must be reliable. A bug, a stuck relay, or a mistimed schedule in the middle of the dark period causes real damage. - Non-grow lights that happen to be in the growing space (status LEDs, flashlight use during inspections, ventilation fan indicator lights) matter. What looks like a minor light leak to a human can interrupt photoperiod. - Light-tight construction of the growing space matters. A greenhouse with street lights leaking in through gaps is not suitable for photoperiod-sensitive crops without substantial blackout curtain work. - Alerts for unexpected light during dark periods help catch problems — a light sensor that reads above a threshold during the scheduled dark period should trigger an alert.
The basic photoperiod automation.
The pattern is deliberately simple. Reliability matters more than cleverness in photoperiod control. A more complex automation with more dependencies has more things to go wrong.
DLI tracking.
Daily light integral is the total light energy received over a day, measured in mol/m²/d. It is one of the most actionable numbers in controlled environment agriculture.
What DLI targets look like.
Rough target ranges (these vary by variety and growth stage): - Lettuce: 12-17 mol/m²/d - Herbs: 10-15 mol/m²/d - Tomatoes, peppers: 22-30 mol/m²/d - Strawberries: 17-22 mol/m²/d - Cannabis (vegetative): 20-35 mol/m²/d - Cannabis (flowering): 35-55 mol/m²/d - Seedlings and propagation: 8-12 mol/m²/d
These are starting points. Actual targets come from the crop and variety.
Calculating DLI.
DLI is PPFD integrated over the photoperiod. The formula:
DLI (mol/m²/d) = PPFD (μmol/m²/s) × photoperiod (seconds) / 1,000,000
For 500 μmol/m²/s over a 12-hour photoperiod: 500 × 43,200 / 1,000,000 = 21.6 mol/m²/d
Real DLI is not constant PPFD over the day — it follows a curve (solar for greenhouse, potentially constant for indoor). The integral needs to be calculated from actual readings.
DLI as a Home Assistant template sensor.
Home Assistant can track DLI as a running-total template sensor that resets at midnight (or at the start of the photoperiod). The pattern:
Once DLI is tracked as a sensor, it becomes available for automations: notify when DLI target is met, shut off supplemental lighting when DLI target is reached, summarize daily DLI at end-of-photoperiod.
DLI-based supplemental lighting shutoff.
An automation that runs supplemental lighting until the daily DLI target is met, then stops, saves energy compared to running on a fixed schedule. A sunny day with high natural light means less supplemental running; a cloudy day means more. The DLI target remains constant; the energy to reach it varies.
Supplemental lighting strategies.
Greenhouses with supplemental lighting face a specific optimization: when to run the supplemental lights, and at what intensity, to hit DLI targets while minimizing electrical cost.
Fixed-schedule supplemental.
The simplest: run supplemental lights during set hours (e.g., 06:00-09:00 and 15:00-18:00 during winter). Ignores weather. Wastes electricity on sunny days; insufficient on cloudy days. The baseline against which smarter strategies are compared.
PPFD-threshold supplemental.
Supplemental on when natural PPFD drops below a threshold (e.g., 200 μmol/m²/s), off when it recovers. Responsive to conditions. Handles cloudy days and early/late hours reasonably.
Hysteresis matters here too — a narrow threshold causes rapid cycling. Start at 200 μmol/m²/s, stop at 300 μmol/m²/s. The 100 μmol/m²/s gap prevents flicker.
DLI-target supplemental.
Supplemental runs as needed to hit the daily DLI target. If natural DLI is accumulating fast (sunny day), supplemental may not run at all. If natural DLI is falling behind schedule (cloudy day), supplemental runs longer to make up the deficit.
This is the most efficient pattern and requires the most sophisticated automation. The logic typically: 1. Calculate DLI accumulated so far today. 2. Calculate DLI target for this time of day (linear interpolation from start to target). 3. If actual DLI is behind schedule, run supplemental. 4. If actual DLI is on track or ahead, don't run supplemental.
The "on track" logic can include forecasting — if the afternoon forecast is sunny, accept falling behind schedule in the morning.
Time-of-use electrical rates.
Operations with time-of-use rate structures benefit from running supplemental lighting during off-peak hours when possible. The automation can prefer off-peak hours for catch-up DLI, deferring to on-peak only when DLI targets will be missed otherwise.
Ramp-up and ramp-down.
Switching fixtures fully on or off produces sharp light transitions that can stress plants and shock electrical circuits. Dimmable fixtures support ramp-up and ramp-down — turn on gradually over 10-30 minutes at start of photoperiod, dim gradually at end. More pleasant for the crop and for the electrical system.
Adaptive lighting.
Smarter deployments adjust spectrum, intensity, or position based on growth stage or time of day.
Spectrum adjustment.
Some modern LED fixtures support per-channel color control (red, blue, far-red, UV). Different spectra favor different plant responses. Vegetative growth responds well to blue-rich spectrum; flowering responds well to red-rich with far-red. Automations can adjust spectrum by growth stage or even through the day.
Practical reality: spectrum tuning is a deep topic and easy to over-engineer. For most operations, a balanced full-spectrum fixture handles the core work well; spectrum adjustment provides marginal gains that are hard to observe. Worth exploring for high-value crops where small performance differences matter.
Sunrise and sunset simulation.
Ramping lights up at dawn and down at dusk mimics natural day. Easier on the crop than sudden on/off. Home Assistant's integrations for dimmable LEDs support this directly.
Cloud-responsive intensity.
Intensity adjustment based on real-time PAR reading outside the growing space. Bright day → lower supplemental intensity (or off entirely). Cloudy day → higher supplemental intensity. Continuous response rather than discrete on/off.
Photoperiod safety patterns.
Photoperiod interruption is serious enough to warrant specific protections.
Dark-period light detection.
A light sensor in the growing space that reads above a threshold during the scheduled dark period should immediately alert the grower. Even brief light leaks can cause problems; the alert catches them early.
Example logic: during scheduled dark period, if PPFD reads above 5 μmol/m²/s for more than 30 seconds, send a high-priority alert.
Main-light-off verification.
After the scheduled lights-off time, verify the main lights are actually off. A smart plug with power monitoring, or a PAR sensor reading far below the scheduled lighting intensity, confirms the command succeeded. A stuck relay that left lights on would otherwise go undetected until the grower noticed the flowering problem weeks later.
Manual override with expiration.
During inspections or maintenance, growers sometimes need to enter the dark-period growing space with a light. An "override" that allows a light for a short period, with automatic expiration and alert if override is left on, handles this safely. Better than no override (growers will enter with a flashlight anyway, breaking photoperiod) and better than unrestricted override (growers forget to turn off and interrupt photoperiod unintentionally).
Scheduling resilience.
The core photoperiod schedule should not depend on external integrations that can fail. A time-based trigger is more reliable than a trigger that depends on a weather integration or a remote clock. The simplest photoperiod automation — fixed times, hardcoded in Home Assistant — is often the right choice for flowering crops.
Common failure modes.
Specific things that go wrong.
The stuck contactor. The main lights ran continuously for three days because the contactor welded closed. The grower didn't notice until the flowering crop showed stress from photoperiod interruption. Fix: power monitoring on the lighting circuits, state-verification automations that check lights are off when they should be off.
The scheduling bug during DST. The photoperiod schedule was written in a way that didn't handle daylight saving time correctly; at the transition, the dark period started an hour later than the grower intended, causing a small photoperiod interruption. Fix: use Home Assistant's native time triggers (which handle DST correctly) rather than fixed-UTC triggers.
The light leak from the equipment room. A small LED indicator on a piece of equipment in an adjacent room leaked through a gap in the wall. Not visible during the day; noticed during the dark period. Caused intermittent flowering problems. Fix: light-tight construction, dark-period PAR monitoring to catch any sources.
The dimmer that stopped dimming. A dimmable driver failed partially — the lights responded to on/off but not to dimming commands. Automation thought it had dimmed to 30% but lights were at 100%. Fix: verification sensors (PAR readings matching commanded intensity), replacement of failing drivers.
The DLI target that was wrong. A grower set up DLI tracking with a target that was right for a different variety. Plants received too much or too little light for months before the grower noticed. Fix: crop-specific research for target-setting, occasional review of targets.
The supplemental lighting that ran 24/7. A buggy automation left supplemental lights on continuously. DLI far exceeded target; crop showed light stress; electric bill spiked. Fix: safety timeouts on lighting automations, DLI ceiling alerts, daily summary reports that flag anomalies.
The photoperiod schedule someone "fixed." A new employee thought the schedule was wrong and changed it to "turn lights on at dawn, off at dusk." Flowering crop reverted to vegetative. Fix: change-control discipline on critical automations, review cycles for automation changes.
The PAR sensor that went bad. A PAR sensor aged and its dome yellowed, reducing the reading by 20%. Automation thought natural light was insufficient and ran supplemental lights that weren't needed. Electric bill climbed slowly over months. Fix: periodic calibration against a reference sensor, alerts for unusual patterns in sensor readings.
What not to do.
Don't use lux meters for horticultural lighting decisions. Lux meters measure what the human eye sees, not what plants use. PAR sensors in μmol/m²/s are what matters for photosynthetic crops.
Don't assume lights are off because you commanded them off. Verify with power monitoring or a PAR sensor. Photoperiod-sensitive crops depend on this.
Don't over-engineer spectrum tuning. For most crops, balanced full-spectrum fixtures with consistent operation outperform complex spectrum schedules that are hard to tune and easy to get wrong.
Don't let photoperiod automations fail silently. An automation that doesn't fire because of a bug, an integration failure, or a clock drift causes real damage. Alerts on expected-but-missing events matter.
Don't put lighting control automations at the mercy of integrations. Weather integrations go down. Cloud services go down. Photoperiod timing should be reliable regardless.
Don't run supplemental lighting on a fixed schedule if DLI-target control is possible. Fixed schedules waste energy on sunny days and may be insufficient on cloudy ones. DLI-target control matches supplemental runtime to actual need.
Don't forget ramp-up and ramp-down for dimmable fixtures. Sudden on/off stresses electrical and biological systems alike.
Don't skip dark-period monitoring. A single PAR sensor that reports dark-period intrusions is cheap insurance against light-leak problems that are otherwise hard to detect.