{"id":19707,"date":"2024-01-19T13:40:23","date_gmt":"2024-01-19T18:40:23","guid":{"rendered":"https:\/\/nuxx.net\/blog\/?p=19707"},"modified":"2025-05-23T09:26:32","modified_gmt":"2025-05-23T13:26:32","slug":"sunrise-like-alarm-clock-via-home-assistant-android","status":"publish","type":"post","link":"https:\/\/nuxx.net\/blog\/2024\/01\/19\/sunrise-like-alarm-clock-via-home-assistant-android\/","title":{"rendered":"Sunrise-like Alarm Clock via Home Assistant + Android"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-medium\"><a href=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"226\" height=\"300\" src=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-226x300.jpg\" alt=\"\" class=\"wp-image-19718\" srcset=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-226x300.jpg 226w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-770x1024.jpg 770w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-768x1021.jpg 768w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-1156x1536.jpg 1156w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-1541x2048.jpg 1541w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/PXL_20240119_1645189382-scaled.jpg 1926w\" sizes=\"auto, (max-width: 226px) 100vw, 226px\" \/><\/a><figcaption class=\"wp-element-caption\">Bedside Sunrise Alarm Clock Setup<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Quite a few years ago I came across <a href=\"http:\/\/windhovermfg.com\/\">Lighten Up!<\/a>, which was a dawn-simulating alarm clock module that got connected between an incandescent lamp and used gently increasing light instead of noise. Coupled with a halogen bulb (that&#8217;d start out very yellow at lowest brightness) I had a wonderful sunrise-like alarm clock and it was much, much nicer than a beeping alarm.<\/p>\n\n\n\n<p>The LCD displays in the <em>Lighten Up!<\/em> units began failing so I couldn&#8217;t change the programming, which was a hassle as the clocks in them drifted by a couple minutes per month. With a combination of COVID-19 remote work eliminating the need for an alarm clock and the devices dying, in the trash they went. (They also didn&#8217;t work right with LED bulbs, and now the person making them has closed down the business.)<\/p>\n\n\n\n<p>I&#8217;ve been trying to use an alarm to stay on a more regular sleep schedule and while a bunch of other wake-up lights are available, they are dedicated units that are basically alarm clocks with built in lights. I really liked the elegance of the <em>Lighten Up!<\/em> and how it&#8217;d use an existing lamp, and outside of dedicated smart bulbs + an app I couldn&#8217;t find anything else like it. For a while I thought about developing my own hardware version that&#8217;d also work with LED bulbs, but never got around to it.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-medium\"><a href=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"251\" height=\"300\" src=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/image-251x300.png\" alt=\"\" class=\"wp-image-19708\" srcset=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/image-251x300.png 251w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/image.png 418w\" sizes=\"auto, (max-width: 251px) 100vw, 251px\" \/><\/a><figcaption class=\"wp-element-caption\">Lighten Up! (Image from Pintrest)<\/figcaption><\/figure>\n<\/div>\n\n\n<p>This winter I&#8217;ve been experimenting with <a href=\"https:\/\/www.home-assistant.io\/\">Home Assistant<\/a> (HA), and it turns out that with a couple cheap Zigbee parts (bulb and pushbutton from IKEA) it allows for a wonderful replacement\/upgrade sunrise alarm idea. A next-generation <em>Lighten Up!<\/em>, if you will.<\/p>\n\n\n\n<p>With everything put together the lamp next to my bed will now slowly come up to brightness 15 minutes before the wake-up alarm on my phone, reaching final as the normal alarm triggers. If I change the alarm time on my phone, or shut it off, the light-up alarm in HA will follow suit. Additionally, a physical button on the nightstand turns off the light off while replicating a sunrise alarm, or otherwise toggles the light on and off.<\/p>\n\n\n\n<p>Even better, if I&#8217;m not home or if the alarm is set for other than between 3:00 AM and 9:00 AM (times during which I&#8217;d likely be in bed and wanting to wake up) the light won&#8217;t activate. This allows me to use alarms during the normal day for other things without activating with the light, or while traveling without waking Kristen.<\/p>\n\n\n\n<p>Between this and the gently-increasing volume (and vibration) alarm built into the Android clock which triggers at the end of the sunrise cycle it&#8217;s a very nice, gradual wake-up system. And, all of this happens without any cloud services or ongoing subscriptions. My HA instance is local; the phone app communicates directly with it across either my home or the public networks. Communication between the physical controls and lights is a local, private network.<\/p>\n\n\n\n<p>In this post I&#8217;ll document the major building blocks of how I did this so that someone else with basic Home Assistant experience (and a functioning HA setup, which is beyond the scope of this writeup) can do the same.<\/p>\n\n\n\n<p>For reference, my Home Assistant hardware setup for this piece is:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Compute: <a href=\"https:\/\/www.raspberrypi.com\/products\/raspberry-pi-4-model-b\/specifications\/\">Raspberry Pi 4 Model B<\/a> (2GB RAM) w\/<a href=\"https:\/\/www.adafruit.com\/product\/4282\">Adafruit PiRTC<\/a><\/li>\n\n\n\n<li>Operating System: <a href=\"https:\/\/www.home-assistant.io\/installation\/raspberrypi\">Home Assistant Operating System via Raspberry Pi Imager<\/a><\/li>\n\n\n\n<li>Boot\/Root\/Storage: <a href=\"https:\/\/www.lexar.com\/product\/lexar-professional-sl600-portable-ssd\/\">Lexar Professional SL600 1TB nVME USB 3.0 SSD<\/a><\/li>\n\n\n\n<li>Zigbee Radio: <a href=\"https:\/\/phoscon.de\/en\/conbee2\">Phoscon Conbee II<\/a><\/li>\n\n\n\n<li>Light Bulb: <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-led-bulb-e26-1100-lumen-smart-wireless-dimmable-white-spectrum-globe-40518736\/\">IKEA TR\u00c5DFRI 405.187.36 LED E26 1100 Lumen (Dimmable\/White Spectrum, 405.187.36)<\/a><\/li>\n\n\n\n<li>Physical Button: <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-shortcut-button-white-smart-20356382\/\">IKEA TR\u00c5DFRI Shortcut Button (203.563.82)<\/a><\/li>\n<\/ul>\n\n\n\n<p>With the <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=io.homeassistant.companion.android\">Home Assistant Companion App for Android<\/a> running on an Android phone, Home Assistant can get the date and time of the next alarm. After installing the app, go into <em>Settings<\/em> \u2192 <em>Companion app<\/em> \u2192 <em>Manage sensors<\/em> and enable the <em>Next alarm<\/em> sensor. My phone is named <em>Pixel 8<\/em>, so the alarm is now available as entity <code>sensor.pixel_8_next_alarm<\/code>. Note that this is not available if an iPhone (or other iOS device) is used. (ref: <a href=\"https:\/\/companion.home-assistant.io\/docs\/core\/sensors#next-alarm-sensor\">Next Alarm Sensor<\/a>)<\/p>\n\n\n\n<p>Part of setting up HA configures a <em>Zone<\/em> (location) called <em>Home<\/em>. This, combined with the default location information collected by the companion app, allows HA to know if my phone is at <em>Home<\/em> (or elsewhere), via the the state of entity <code>device_tracker.pixel_8<\/code> (eg: <code>home<\/code>). <\/p>\n\n\n\n<p>Note: While I give YAML of the automations for configuration reference, most of these automations were built using the GUI and involve the (automatically generated) entity and device IDs. If you are setting this up you&#8217;ll want to use the GUI and build these out yourself using the code for reference.<\/p>\n\n\n\n<p>To make this all work, three community components are used and must be installed:<\/p>\n\n\n\n<p><a href=\"https:\/\/community.home-assistant.io\/t\/ashley-s-light-fader-2-0-fade-lights-and-or-color-temperature-with-your-choice-of-easing-curves-including-ease-in-ease-out-and-ease-in-out\/584077\">Ashley&#8217;s Light Fader 2.0<\/a>: This script takes a light and, over a configured amount of time, fades from the light&#8217;s current setting to the defined setting (both brightness and color temperature) using natural feeling curves (<a href=\"https:\/\/easings.net\/\">easing<\/a>). It will also cancel the fade if some conditions are met. I use this to have the light fade, over 15 minutes, using a <a href=\"https:\/\/easings.net\/#easeInSine\">sine function<\/a>, to 70% brightness and 4000K temperature, and cancel the fade if the light is turned off or brightness changes significantly, the latter of which allows the button next to the bed to cancel the alarm.<\/p>\n\n\n\n<p>To make this happen I turn on the bulb at 1% brightness and 2202K (it&#8217;s warmest temperature), then use the script to fade to 70% and 4000K over the course of 15 minutes. This does a decent job of replicating a sunrise or the results of the <em>Lighten Up!<\/em> with a halogen bulb.<\/p>\n\n\n\n<p>This is configured as an automation I call <em>Bedroom Steve Nightstand: Lighten Up! (Sunrise)<\/em>. Note that it has no trigger because it&#8217;ll be called from the next automation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias: \"Bedroom Steve Nightstand: Lighten Up! (Sunrise)\"\ndescription: \"\"\ntrigger: &#91;]\ncondition: &#91;]\naction:\n  - condition: state\n    entity_id: light.bedroom_test_bulb_light\n    state: \"off\"\n  - service: light.turn_on\n    metadata: {}\n    data:\n      brightness_pct: 1\n      color_temp: 500\n    target:\n      entity_id: light.bedroom_test_bulb_light\n  - service: script.1705454664908\n    data:\n      lampBrightnessScale: zeroToTwoFiftyFive\n      easingTypeInput: easeInOutSine\n      endBrightnessEntityScale: zeroToOneHundred\n      autoCancelThreshold: 10\n      shouldStopIfTheLampIsTurnedOffDuringTheFade: true\n      shouldResetTheStopEntityToOffAtStart: false\n      shouldInvertTheValueOfTheStopEntity: false\n      minimumStepDelayInMilliseconds: 100\n      shouldTryToUseNativeLampTransitionsToo: false\n      isDebugMode: false\n      light: light.bedroom_test_bulb_light\n      transitionTime:\n        hours: 0\n        minutes: 15\n        seconds: 0\n      endColorTemperatureKelvin: 4000\n      endBrightnessPercent: 70\nmode: single<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/community.home-assistant.io\/t\/adjustable-wake-up-to-android-alarm\/599838\">Adjustable Wake-up to Android alarm v2<\/a>: This blueprint for an Automation takes the time from the next alarm sensor (<code>alarm_source<\/code>) to trigger an action before the alarm happens. I use this to initiate <em>Ashley&#8217;s Light Fader 2.0<\/em> at 15 minutes before my alarm, only when my phone is at Home, and and the alarm is between 3:00 AM and 9:00 AM.<\/p>\n\n\n\n<p>Part of configuring this is setting up a <em>Helper<\/em> or basically a system-wide variable, called <em>Pixel 8 Next Alarm<\/em> (entity id: <code>input_datetime.pixel_8_next_alarm<\/code>, type: <em>Date and\/or time<\/em>).<\/p>\n\n\n\n<p>This is configured as an automation called <em>Bedroom Steve Nightstand: Lighten Up at 15 Before Alarm<\/em>, set to only run if my phone is at <em>Home<\/em> and it&#8217;s between 3:00 AM and 9:00 AM:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias: \"Bedroom Steve Nightstand: Lighten Up at 15 Before Alarm\"\ndescription: \"\"\nuse_blueprint:\n  path: homeassistant\/adjustable-wake-up-to-android-alarm.yaml\n  input:\n    offset: 900\n    alarm_source: sensor.pixel_8_next_alarm\n    alarm_helper: input_datetime.pixel_8_next_alarm\n    conditions:\n      - condition: device\n        device_id: 1fb6fd197bd2b771249ae819f384cfe2\n        domain: device_tracker\n        entity_id: e695e05f01a328b349a42bfd7d533ef6\n        type: is_home\n      - condition: time\n        after: \"03:00:00\"\n        before: \"09:00:00\"\n    actions:\n      - service: automation.trigger\n        metadata: {}\n        data:\n          skip_condition: true\n        target:\n          entity_id: automation.lighten_up<\/code><\/pre>\n\n\n\n<p>I don&#8217;t want to get out a phone and dig into an app to manage the light, so next to the bed I have a <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-shortcut-button-white-smart-20356382\/\">TR\u00c5DFRI Shortcut Button<\/a> for controlling the light. If the button is pressed while the light is simulating sunrise, it turns off. If the light is off it turns it on, or visa versa.<\/p>\n\n\n\n<p>Because turning the light off mid-dimming leaves it set at the current color and brightness, I use this instead of the normal <em>Toggle<\/em> action. In here I check the state of the bulb and either turn it off (if on), or turn it on to 100% brightness and 4000K if it is off:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alias: \"Bedroom Steve Nightstand: Light Toggle\"\ndescription: &gt;-\n  Doesn't use the normal toggle because it needs to set the light color and\n  brightness just in case it was left at something else when turned off\n  mid-alarm.\ntrigger:\n  - device_id: 12994a6c215ae1d4cfb86e261a2b2f3b\n    domain: zha\n    platform: device\n    type: remote_button_short_press\n    subtype: turn_on\ncondition: &#91;]\naction:\n  - if:\n      - condition: device\n        type: is_on\n        device_id: e3421c7d54269752a371fe8443daf95f\n        entity_id: 78599118c4ab8043cf03ce6532546b94\n        domain: light\n    then:\n      - service: light.turn_off\n        metadata: {}\n        data:\n          transition: 0\n        target:\n          entity_id: light.bedroom_test_bulb_light\n      - stop: \"\"\n    alias: On to Off\n  - if:\n      - condition: device\n        type: is_off\n        device_id: e3421c7d54269752a371fe8443daf95f\n        entity_id: 78599118c4ab8043cf03ce6532546b94\n        domain: light\n    then:\n      - service: light.turn_on\n        metadata: {}\n        data:\n          color_temp: 153\n          transition: 0\n          brightness_pct: 100\n        target:\n          entity_id: light.bedroom_test_bulb_light\n      - stop: \"\"\n    alias: \"Off to On: Full Brightness and 4000K\"\nmode: single<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-medium\"><a href=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-24-at-4.15.52-PM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"153\" src=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-24-at-4.15.52-PM-300x153.png\" alt=\"\" class=\"wp-image-19741\" srcset=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-24-at-4.15.52-PM-300x153.png 300w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-24-at-4.15.52-PM-768x391.png 768w, https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2024\/01\/Screen-Shot-2024-01-24-at-4.15.52-PM.png 990w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Finally, I also have this all displaying, and controllable, via a card stack in a dashboard. For the next alarm info I started with the template in <a href=\"https:\/\/community.home-assistant.io\/t\/human-friendly-template-for-next-alarm-companion-app\/230983\">this post<\/a> but modified it to simplify one section by using <code>now()<\/code>, fix a bug in it that occurs with newer versions of HA, and then build it into something that better illustrates the start and end of the simulated sunrise. Because normal entity cards can&#8217;t do templating (to dynamically show data) I used <a href=\"https:\/\/github.com\/TheHolyRoger\/lovelace-template-entity-row\">TheHolyRoger\/lovelace-template-entity-row<\/a> and some Jinja templating to make it look nice.<\/p>\n\n\n\n<p>This gives me a row which shows the next alarm time (or &#8220;No alarm&#8221; if none set), nicely formatted, and has a toggle that can enable\/disable the <em>Bedroom Steve Nightstand: Lighten Up at 15 Before Alarm<\/em> automation. Finally, I added a row of buttons to allow easy toggling between 1% \/ 454 mireds, 33% \/ 357 mireds, 66% \/ 294 mireds, and 100% \/ 250 mireds so I can manually set the light to some nice presets across dawn to full brightness.<\/p>\n\n\n\n<p>Note: There is an older version of this template in HACS, <a href=\"https:\/\/github.com\/thomasloven\/lovelace-template-entity-row\/\">thomasloven\/lovelace-template-entity-row<\/a> in the <a href=\"https:\/\/hacs.xyz\/\">Home Assistant Community Store (HACS)<\/a>, but it has a bug which keeps the icon from changing color to reflect the state of the automation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type: vertical-stack\ncards:\n  - type: entities\n    title: Bedroom\n    entities:\n      - type: custom:template-entity-row\n        entity: automation.adjustable_wake_up_to_android_alarm\n        name: Sunrise Alarm\n        icon: mdi:weather-sunset-up\n        active: '{{ states(\"automation.adjustable_wake_up_to_android_alarm\"), \"on\") }}'\n        toggle: true\n        tap_action: none\n        hold_action: none\n        double_tap_action: none\n        secondary: &gt;-\n          {% set fullformat = '%Y-%m-%d %H:%M' %}\n          {% set longformat = '%a %b %-m %-I:%M %p' %}\n          {% set timeformat = '%-I:%M %p' %}\n          {% if states('sensor.pixel_8_next_alarm') != 'unavailable' %}\n            {% set sunrise_start = state_attr('input_datetime.pixel_8_next_alarm', 'timestamp') | int %}\n            {% set sunrise_end = (state_attr('sensor.pixel_8_next_alarm', 'Time in Milliseconds') \/1000) | int %}\n            {% if sunrise_start | timestamp_custom('%Y-%m-%d', true) == (now().timestamp() | timestamp_custom('%Y-%m-%d', true)) %}\n              {% set sunrise_start_preamble = 'Today' %}\n            {% elif (1+ (sunrise_start - now().timestamp() | int) \/ 86400) | int == 1 %}\n              {% set sunrise_start_preamble = 'Tomorrow' %}\n            {% elif (1+ (sunrise_start - now().timestamp() | int) \/ 86400) | int &lt;= 7 %}\n              {% set sunrise_start_preamble = sunrise_start | timestamp_custom('%A',true) %}\n            {% else %}\n              {% set sunrise_start_preamble = sunrise_start | timestamp_custom('%a %b %-m', true) %}\n            {% endif %}\n            {% if sunrise_end | timestamp_custom('%Y-%m-%d', true) == (now().timestamp() | timestamp_custom('%Y-%m-%d', true)) %}\n              {% set sunrise_end_preamble = 'Today' %}\n            {% elif (1+ (sunrise_end - now().timestamp() | int) \/ 86400) | int == 1 %}\n              {% set sunrise_end_preamble = 'Tomorrow' %}\n            {% elif (1+ (sunrise_end - now().timestamp() | int) \/ 86400) | int &lt;= 7 %}\n              {% set sunrise_end_preamble = sunrise_end | timestamp_custom('%A',true) %}\n            {% else %}\n              {% set sunrise_end_preamble = sunrise_end | timestamp_custom('%a %b %-m', true) %}\n            {% endif %}\n            {% if (sunrise_start_preamble == sunrise_end_preamble) %}\n              {% if sunrise_start_preamble == 'None' %}\n                {{ sunrise_start | timestamp_custom(longformat, true) }} - {{ sunrise_end | timestamp_custom(timeformat, true) }}\n              {% else %}\n                {{ sunrise_start_preamble }} {{ sunrise_start | timestamp_custom(timeformat, true) }} - {{ sunrise_end | timestamp_custom(timeformat, true) }}\n              {% endif %}\n            {% else %}\n              {% if sunrise_start_preamble == 'None' %}\n                {{ sunrise_start | timestamp_custom(longformat, true) }} - {{ sunrise_end | timestamp_custom(longformat, true) }}\n              {% else %}\n                {{ sunrise_start_preamble }} {{ sunrise_start | timestamp_custom(timeformat, true) }} - {{ sunrise_end_preamble }} {{ sunrise_end | timestamp_custom(timeformat, true) }}\n              {% endif %}\n            {% endif %}\n          {% else %}\n            No alarm set on {{ state_attr('device_tracker.pixel_8', 'friendly_name') }}\n          {% endif %}\n      - type: divider\n      - entity: light.bedroom_test_bulb_light\n        name: Steve's Nightstand\n        icon: mdi:bed\n        entity_data:\n          brightness: 255\n          color_temp_kelvin: 4000\n    show_header_toggle: false\n    state_color: true\n  - type: grid\n    square: false\n    cards:\n      - show_name: false\n        show_icon: true\n        show_state: false\n        type: button\n        tap_action:\n          action: call-service\n          service: light.turn_on\n          data:\n            brightness_pct: 1\n            color_temp: 454\n          target:\n            entity_id: light.bedroom_test_bulb_light\n        name: 1%\n        icon: mdi:moon-waning-crescent\n        hold_action:\n          action: none\n      - show_name: false\n        show_icon: true\n        show_state: false\n        type: button\n        tap_action:\n          action: call-service\n          service: light.turn_on\n          data:\n            brightness_pct: 33\n            color_temp: 357\n          target:\n            entity_id: light.bedroom_test_bulb_light\n        name: 33%\n        icon: mdi:moon-last-quarter\n        hold_action:\n          action: none\n      - show_name: false\n        show_icon: true\n        show_state: false\n        type: button\n        tap_action:\n          action: call-service\n          service: light.turn_on\n          data:\n            brightness_pct: 66\n            color_temp: 294\n          target:\n            entity_id: light.bedroom_test_bulb_light\n        name: 66%\n        icon: mdi:moon-waning-gibbous\n        hold_action:\n          action: none\n      - show_name: false\n        show_icon: true\n        show_state: false\n        type: button\n        tap_action:\n          action: call-service\n          service: light.turn_on\n          data:\n            brightness_pct: 100\n            color_temp: 250\n          target:\n            entity_id: light.bedroom_test_bulb_light\n        name: 100%\n        icon: mdi:moon-full\n        hold_action:\n          action: none\n    columns: 4<\/code><\/pre>\n\n\n\n<p>The result of all of this is that, if my phone is at home and I have an alarm set between 3:00 AM and 9:00 AM, the light next to the bed will simulate a 15-minute sunrise before the alarm goes off. If the light is simulating a sunrise, pressing the button will turn it off. Otherwise, the button toggles the light on and off at full brightness, for normal lamp-type use. Finally, via the Home Assistant UI I can easily check the status of, or turn off, the sunset alarm if I don&#8217;t want to use it.<\/p>\n\n\n\n<p>So far, this is working great. There&#8217;s two things I&#8217;m looking into changing:<\/p>\n\n\n\n<p>First, the <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-led-bulb-e26-1100-lumen-smart-wireless-dimmable-white-spectrum-globe-40518736\/\">bulb I&#8217;m using, 405.187.36<\/a>, is an 1100 lumen maximum brightness. This is a bit too bright for the final stage of the alarm, and it&#8217;s minimum brightness is a bit higher than I&#8217;d like and seems a little abrupt. (Ideally the initial turn-on won&#8217;t be noticable.)<\/p>\n\n\n\n<p>Since IKEA bulbs are cheap and generally work well, I&#8217;ll likely try a few other lower brightness ones and see how they work out. Both <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-led-bulb-e12-450-lumen-smart-wireless-dimmable-white-spectrum-globe-60518735\/\">605.187.35<\/a> (globe) and <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-led-bulb-e12-450-lumen-smart-wireless-dimmable-white-spectrum-chandelier-90518734\/\">905.187.34<\/a> (chandelier) are color temperature adjustable,  450 lumen maximum, cost $8.99, and look like good candidates as I expect their minimum brightness to be lower.<\/p>\n\n\n\n<p>There is also <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-led-bulb-e26-250-lumen-smart-wireless-dimmable-warm-white-globe-10439255\/\">104.392.55<\/a> ($12.99), but it is fixed at 2200K and has a maximum brightness of 250 lumens. I suspect this will be nicely dim for the start, but wouldn&#8217;t allow a color transition and might not have enough final brightness to make me feel ready for the day.<\/p>\n\n\n\n<p>I may also try something like <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-led-bulb-e12-450-lumen-smart-wireless-dimmable-color-and-white-spectrum-globe-20439194\/\">204.391.94<\/a> ($17.99), which is adjustable color, as this could allow me to use something like the <a href=\"https:\/\/www.color-hex.com\/color-palette\/9616\">sunrise color pallete<\/a>, but this would require moving to a different script for fading. The current script doesn&#8217;t support fading between colors (see <a href=\"https:\/\/community.home-assistant.io\/t\/ashley-s-light-fader-2-0-fade-lights-and-or-color-temperature-with-your-choice-of-easing-curves-including-ease-in-ease-out-and-ease-in-out\/584077\/29?u=c0nsumer\">here<\/a> for discussion around this), so this would take a lot of work on my part. Probably more than would be beneficial, since varying color temp on white-range bulbs is pretty darn good already.<\/p>\n\n\n\n<p>Second, the <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/tradfri-shortcut-button-white-smart-20356382\/\">TR\u00c5DFRI Shortcut Button (203.563.82)<\/a> that I&#8217;m using has been discontinued. It&#8217;s a nice, simple button, and I can trigger on it using short or long press. It&#8217;s replacement, <a href=\"https:\/\/www.ikea.com\/us\/en\/p\/somrig-shortcut-button-white-smart-30560354\/\">SOMRIG Shortcut Button (305.603.54)<\/a>, isn&#8217;t in stock at my local IKEA so I don&#8217;t have one, but I expect it to be two buttons that can each have short or long presses, and perhaps even double-click on each. If so, I may add something more like dimming the nightstand light to use as a reading light, or perhaps something to leave on for the dogs when we&#8217;re gone.<\/p>\n\n\n\n<p>Thinking a bit bigger picture I could even do things like use an in-wall dimmer to have the adjacent closet lights serve as wake-up lights. But as all the quality ones of these are Z-Wave I&#8217;d have to get another radio for the Pi and&#8230; and&#8230;<\/p>\n\n\n\n<p>The possibilities for this stuff are nearly endless, which is neat, because it becomes an engineering problem of what to do that provides sufficient benefit without complexity for complexity&#8217;s sake. This, at least, a <em>Home Assistant<\/em>-based replacement for the old, beloved <em>Lighten Up!<\/em>, is great.<\/p>\n\n\n\n<p><strong>Note:<\/strong> This post has been updated a few times since original posting to fix grammar, a bug in the Jinga2 template for displaying the next alarm, and to add buttons for setting lamp brightness.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update on 2025-May-23<\/h2>\n\n\n\n<p>With the release of <a href=\"https:\/\/community.home-assistant.io\/t\/adjustable-wake-up-to-android-alarm\/599838\">Adjustable Wake-up to Android alarm v4<\/a> in January 2025, the helper <code>input_datetime.pixel_8_next_alarm<\/code> is no longer needed and can be deleted. Accordingly, the line in the card defining <code>sunrise_start<\/code> needs to be changed to something like this. The <code>-900<\/code> is the offset \/ number of seconds before the alarm that the automation is scheduled to trigger:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    {% set sunrise_start = ((state_attr('sensor.pixel_8_next_alarm', 'Time in Milliseconds') \/1000) - 900) | int %}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Quite a few years ago I came across Lighten Up!, which was a dawn-simulating alarm clock module that got connected between an incandescent lamp and&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/nuxx.net\/blog\/2024\/01\/19\/sunrise-like-alarm-clock-via-home-assistant-android\/\">Continue reading<span class=\"screen-reader-text\">Sunrise-like Alarm Clock via Home Assistant + Android<\/span><\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,13,11],"tags":[],"class_list":["post-19707","post","type-post","status-publish","format-standard","hentry","category-around-the-house","category-computers","category-making-things","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/19707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/comments?post=19707"}],"version-history":[{"count":27,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/19707\/revisions"}],"predecessor-version":[{"id":19941,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/19707\/revisions\/19941"}],"wp:attachment":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/media?parent=19707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/categories?post=19707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/tags?post=19707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}