Some hardware links on this page are affiliate links. As an Amazon Associate I earn from qualifying purchases. We may earn a commission if you buy through them, at no extra cost to you. See the affiliate disclosure.
A fixed 06:30 wake light is wrong on the days the alarm is 07:45, and it is worse on the days there is no alarm. The Companion app exposes the phone’s next alarm as a timestamp sensor. This pack starts a light ramp that many minutes before sensor.phone_next_alarm, and only if that person is home and the sun is still below the horizon.
It is not a hallway night light. Motion at a low preset, with the off timer reset by presence, is adaptive night path. This one does not care about motion. It cares about the alarm.
One automation per person. Entity ids are blueprint inputs. Do not publish a phone name or which room the lamp is in beyond a stand-in like light.bedroom.
What problem it solves
You want the bedroom to come up gently before the alarm you actually set, including a weekend alarm that is not the weekday one, and you do not want that ramp when you are away or when the alarm is in daylight.
How it works
- Alarm time — enable the Next alarm sensor in Companion (Android: Companion settings → Manage sensors → Next alarm). The entity looks like
sensor.phone_next_alarmand hasdevice_class: timestamp. A time trigger with a negative offset (pack default 15 minutes, range 5 to 60) fires whennowcrosses alarm-minus-offset. Changing the alarm on the phone reschedules the trigger. Clearing the alarm removes it. A timestamp in the past does not fire. - Home and dark — at fire time the person must be
home, andsun.sunmust bebelow_horizon. An alarm at noon does not turn the lamp on. An alarm while that person is away does not turn it on for an empty room. Both checks are conditions, so they are evaluated when the ramp would start, not when you set the alarm the night before. - Ramp — the first call sets a low brightness and a warm color temperature (pack defaults 1% and 2200 K). A second call, a second later, sets the end brightness and a more neutral temperature (pack defaults 40% and 4000 K) with
transitionequal to the lead time. The bulb interpolates. Home Assistant does not step the level every minute. - Which days — optional filter: all days, weekdays, or weekends. Two people are two automations (or two choose branches) so one alarm does not drive the other person’s lamp.
- Phones without an alarm sensor — iOS does not expose the Clock alarm. Write the next alarm into an
input_datetimefrom Shortcuts, and point this blueprint at that helper. The trigger is the same shape: a timestamp, minus the offset.
The ramp is one transition. Turning the lamp off at the wall can lose to a transition the bulb is already running. If you cancel the alarm after the ramp has started, this pack does not turn the lamp back off.
Hardware notes
- Lamp. Any
lightthat acceptsbrightness_pctandcolor_temp_kelvin. A tunable-white bulb in the 2700 K to 6500 K range covers the pack defaults. Readmin_color_temp_kelvinandmax_color_temp_kelvinon the entity. A start below the bulb’s minimum is ignored or errors. On/off-only bulbs can still take the brightness call if you drop the kelvin fields. - Phone. Companion, with Next alarm enabled, and a
personthat uses that phone’s device tracker. The person is how “home” is decided. Do not compare a raw GPS tracker here if you already smoothed presence with door-gated presence. Point the person at that helper’s result instead. - No extra clock. The alarm on the phone is the schedule.
Snippet
The pack ships a blueprint. The offset is negative, so the trigger is before the alarm.
mode: single
max_exceeded: silent
variables:
lead: !input lead
trigger:
- platform: time
at:
entity_id: !input next_alarm
offset: !input lead
condition:
- condition: state
entity_id: !input person
state: "home"
- condition: state
entity_id: sun.sun
state: "below_horizon"
action:
- variables:
lead_seconds: >-
{% set s = as_timedelta(lead).total_seconds() | int %}
{{ (s * -1) if s < 0 else s }}
- action: light.turn_on
target:
entity_id: !input lamp
data:
brightness_pct: !input start_pct
color_temp_kelvin: !input start_kelvin
- delay: "00:00:01"
- action: light.turn_on
target:
entity_id: !input lamp
data:
brightness_pct: !input end_pct
color_temp_kelvin: !input end_kelvin
transition: "{{ lead_seconds }}"
lead is a negative offset such as -00:15:00. start_pct / end_pct and start_kelvin / end_kelvin are the two ends of the ramp. Weekday filtering is a template condition in the full blueprint.
Setup outline
- Enable Next alarm on the phone. Set a test alarm 20 minutes out and confirm
sensor.phone_next_alarmshows that timestamp in Developer Tools. Confirm the person ishome. - Import the blueprint. Select the alarm sensor, the person, the lamp, a 15 minute lead, and brightness and kelvin ends the bulb can actually do.
- Temporarily set the lead so the trigger is a minute or two away, or run the actions from the trace. The lamp should come on dim and warm, then move toward the end level across the lead.
- Set the person to
not_homeand confirm a second run does nothing. Restorehome. Set an alarm after sunrise and confirm the sun condition blocks it. - Put the real lead back. The next real alarm should schedule itself. You should not edit the automation when the alarm time changes.
Troubleshooting
- Never fires. Next alarm is disabled, the entity is
unavailable(no alarm set), or the offset is positive and you asked for a ramp after the alarm. The sensor has to bedevice_class: timestamp. Aninput_datetimeworks. A string sensor of the clock time does not. - Fires at the alarm, not before. The offset sign is wrong. The pack stores a negative offset (
-00:15:00). A positive offset is “after the alarm.” - Lamp snaps to the end, or ignores color. The bulb has no
transitionsupport, or it rejectedcolor_temp_kelvin. Check the entity’s supported color modes in Developer Tools. Drop kelvin if the mode list has brightness only. - Ran while you were away. The condition is on a different person than the phone, or “home” is a GPS tracker that still says
homebecause the zone is large. Use the person you mean. - Ran in the daytime.
sun.sunwas notbelow_horizonin the condition, or you replaced it with a clock window that includes late morning. Keep the sun condition if “dark” is the rule. - Weekend alarm turned the weekday lamp on. The weekday filter is off, or both people share one lamp target. Split the targets.
- iPhone has no next-alarm entity. Expected. Push the alarm time into an
input_datetimeand select that helper asnext_alarm.
Credits
Based on the community blueprint Alarm Light — wake up with lights on before your phone alarm by r3mcos3 (next-alarm offset, person-is-home, and a darkness check). The brightness and color-temperature ramp follows the start-and-end kelvin extension posted on that thread. This write-up is an original overview of that ramp, not a paste of the blueprint.