Home Assistant

Sleep-trainer light

A bedroom RGB lamp turns red at a start time, purple shortly before wake-up, and green when an input_datetime says it is time to get up, then turns off at a stop time.

Difficulty · BeginnerSetup · 20–40 minutesHA · current stable (blueprint)
Get the pack · from $19Have us set it up

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 clock on the wall does not help someone who cannot read one yet. This pack uses one RGB lamp as the signal. Red means stay in bed. Purple means it is almost time. Green means it is okay to get up. The wake time for each weekday is an input_datetime, so a dashboard change moves tomorrow morning without editing the automation.

Entity ids are blueprint inputs (light.bedroom). Do not publish a person’s name or which room the lamp sits in beyond a stand-in like that.

A ramp that follows a phone alarm is phone-alarm wake light. This one ignores the phone. The colors are the schedule.

What problem it solves

You want a dim lamp to say “stay put”, “almost”, and “you can get up”, with a different wake time on the weekend, and you want that lamp off once the morning is underway.

How it works

  1. Enable helper — an input_boolean. Off means every trigger is a no-op and a restart will not turn the lamp on. Use it for travel nights and sick days.
  2. Start — a time trigger at the start clock (pack default 05:30) turns the lamp red at the brightness you set (pack default 10%). Red stays on until the almost-time trigger.
  3. Almost — each weekday helper has a time trigger with a negative offset (pack default 15 minutes). On that weekday only, the lamp switches to purple. Other weekdays’ almost-triggers do nothing because a weekday condition fails.
  4. Wake — the same helper, with no offset, turns the lamp green. Change the helper in the dashboard and the next morning follows. A time trigger on an input_datetime reschedules itself when the helper changes.
  5. Stop — a time trigger at the stop clock (pack default 09:00) turns the lamp off. Green does not stay on all day.
  6. Restart — homeassistant.start runs the same color choice from the clock. If it is between start and almost, the lamp goes red. Between almost and wake, purple. Between wake and stop, green. Outside that window, off. A reboot at 06:10 does not wait until tomorrow to correct a lamp that booted dark.

The wake helpers are time-only (has_date: false). A date-and-time helper will not match the weekday trigger the way this blueprint expects.

Keep the wake time inside the start-to-stop window. A wake time of 10:00 with a stop time of 09:00 turns the lamp off at the stop trigger and the green trigger never wins.

Hardware notes

  • Lamp. Any light that accepts rgb_color. The linked bulb is a Kasa KL125 two-pack (A19, 120 V, full color). A tunable-white-only bulb will ignore red, purple, and green. Read supported_color_modes in Developer Tools and confirm rgb or hs is listed. Brightness stays low on purpose. This is a signal, not a room light.
  • Helpers. Seven input_datetime entities, one per weekday, plus the enable boolean. Create them before you import the blueprint. Apps and helpers do not get a product link.
  • No extra clock. The helpers are the schedule.

Snippet

The pack ships a blueprint. Monday is shown. Tuesday through Sunday repeat the same pair of triggers with their own helpers and a weekday condition.

mode: restart

trigger:
  - platform: time
    at: !input start_time
    id: start
  - platform: time
    at:
      entity_id: !input wake_monday
      offset: !input almost_offset
    id: almost
  - platform: time
    at: !input wake_monday
    id: wake
  - platform: time
    at: !input stop_time
    id: stop

condition:
  - condition: state
    entity_id: !input trainer_enabled
    state: "on"
  - condition: or
    conditions:
      - condition: trigger
        id:
          - start
          - stop
      - condition: time
        weekday:
          - mon

action:
  - choose:
      - conditions:
          - condition: trigger
            id: stop
        sequence:
          - action: light.turn_off
            target:
              entity_id: !input lamp
      - conditions:
          - condition: trigger
            id: wake
        sequence:
          - action: light.turn_on
            target:
              entity_id: !input lamp
            data:
              brightness_pct: !input brightness
              rgb_color: [0, 180, 70]
      - conditions:
          - condition: trigger
            id: almost
        sequence:
          - action: light.turn_on
            target:
              entity_id: !input lamp
            data:
              brightness_pct: !input brightness
              rgb_color: [150, 40, 200]
    default:
      - action: light.turn_on
        target:
          entity_id: !input lamp
        data:
          brightness_pct: !input brightness
          rgb_color: [180, 0, 0]

almost_offset is a negative duration such as -00:15:00. The boot path in the full blueprint picks red, purple, green, or off from the current time instead of always falling through to red.

Setup outline

  1. Create seven time-only input_datetime helpers and one input_boolean. Set a weekday wake time and a later weekend wake time.
  2. Confirm the lamp turns red, purple, and green from Developer Tools → Actions with rgb_color. If the color does not change, stop here and pick a bulb that supports it.
  3. Import the blueprint. Select the lamp, the enable helper, the start and stop clocks, the seven wake helpers, the almost offset, and the brightness.
  4. Turn the enable helper on. Set the start time a minute ahead and confirm red. Set today’s wake helper two minutes ahead and confirm purple, then green. Set the stop time a minute after that and confirm off.
  5. Restart Home Assistant while the lamp should be green and confirm the boot path restores green.

Troubleshooting

  • The lamp turns white. The entity has no rgb or hs color mode. color_temp_kelvin is a different call. Use a color bulb, or the action is dropped by the integration.
  • Purple never happens. The offset is positive, so the trigger is after wake. Store -00:15:00. Also confirm today’s weekday condition matches the helper that fired.
  • Green flashes and the lamp goes off. Wake is at or after the stop time. Move the stop later than the latest wake helper.
  • Saturday used Friday’s time. That morning’s trigger is bound to the wrong helper. Each weekday trigger in the pack names one helper and one weekday.
  • Dark after a reboot. The enable helper is off, or the boot path is missing and you relied on a wait_template that died with the restart. Use the pack’s start trigger.
  • Too bright for a bedroom. Lower brightness. 10% is the pack default. Some bulbs ignore values under a floor. Raise it only until the color is visible.

Credits

Based on the community blueprint Sleep trainer for children using input_datetime and an RGB light. This write-up is an original overview of the red, purple, and green schedule with a restart check. It is not a paste of that blueprint.

Changelog

v1.0 · Oct 26, 2026: First publish.