Wake up to configurable actions at next alarm (android)

Don’t make it a zone condition, but a state condition based on person.entity (home or not_home).

blueprint:
  name: Wake up to configurable actions at next alarm V2
  description:
    Wakes you up to configurable actions at your phones next alarm with
    an offset
  domain: automation
  author: op00
  input:
    offset:
      name: Offset
      description: Set a offset in seconds to the next alarm. When (before) the action should run
      selector:
        number:
          min: 0.0
          max: 3600.0
          mode: box
          step: 1.0
          unit_of_measurement: Seconds
    alarm_source:
      name: Alarm Source
      description: Select the alarm source
      selector:
        entity:
          integration: mobile_app
          device_class: timestamp
          multiple: false
    alarm_helper:
      name: Alarm Helper
      description: Select the date time helper
      selector:
        entity:
          integration: input_datetime
          multiple: false
    active_hours:
      name: Active hours
      description: Only between set values below
      default: false
      selector:
        boolean:
    person:
      name: Person
      description: Select the person for the state condition
      selector:
        entity:
          integration: person
          multiple: false
    person_state:
      name: State of the person
      description: condition as to when the automation runs for the person selected
      selector:
        select:
          mode: dropdown
          options:
            - label: Home
              value: home
            - label: Away
              value: not_home
            - label: Unavailable
              value: unavailable
            - label: Unknown
              value: unknown
    actions:
      name: Actions
      description: Actions to run before alarm goes off
      default: []
      selector:
        action: {}
 variables:
  offset: !input offset
  hello: !input person
trigger:
  - platform: time
    at: !input alarm_helper
    id: wake_up
  - platform: state
    entity_id:
      - !input alarm_source
    id: helper_update
action:
  - choose:
      - conditions:
          - condition: trigger
            id: helper_update
          - condition: template
            value_template:
              '{{ trigger.to_state.state not in ["unknown","unavailable"]
              }}'
        sequence:
          - service: input_datetime.set_datetime
            data:
              timestamp: "{{ (as_timestamp(trigger.to_state.state) |int ) - (offset)}}"
            target:
              entity_id: !input alarm_helper
      - conditions:
          - condition: trigger
            id: wake_up
          - condition: state
            entity_id: !input person
            state: !input person_state
          - condition: or
            conditions:
              - condition: template
                value_template: "{{ active_hours == false }}"
              - condition: sun
                before: sunrise
                after: sunset
        sequence: !input actions
    default: []
mode: single

try this, it’s checking state

Invalid blueprint: missing input definition person

my bad, it should be fixed now

Do i -redownload this blueprint via the link on top of this post, or is it a separate one? Because you named it v2, and it seems i get the same one as before using zone…

It’s a separate one and I want to keep it that way. As I guess the original works for most users and it supports zones. These import links, AFAIK only work with one blueprint per forum topic.

Create a yaml file in your /blueprints/automation/ folder and copy the text into it. (Studio Code Server addon will be your friend).

1 Like

Thanks a lot! It’s accepting the blueprint now. I’ll test it in the comming days… Many thanks again for the contribution and quick responces!

1 Like

Hello

When importing the blueprint i get the following error:

Invalid blueprint: extra keys not allowed @ data['blueprint']['author']. Got 'op00'

Are you on the latest Home Assistant version?

Thanks for the automation, it works, but I am not seeing the option to ‘run it only during night time?’

Thank you so much for this, tried to create something similar myself but couldn’t get it to work. Only question I have is, can I set it to only trigger on the first alarm for the day? I usually have a few alarms in the morning for various things but don’t want the actions from this to trigger every time a new alarm goes off.

Wouldn’t know an easy way to implement this. The companion app sensor next alarm only has the date time value. I wish there was alarm name sent with it to. You could open a feature request, if they could implement an additional attribute such as alarm name. With that this blueprint could only trigger for a specific alarm.

Maybe you can make you own automation to enable and disable this automation for time range you’d like.

Thank you for this automation, it is almost exactly what I am looking for. My use case is I would like to open my curtains 10-15 minutes before my alarm goes off to wake us up gently. This means I would like it to only trigger if it’s light enough outside to wake me up and not too much later.

The one change I would like to request is rather than just a boolean for the active range, I would love to be able to specify sunrise to noon or sunrise to sunrise + offset.

you can add to the action an if (sun) condition, should give you all that.

I missed that conditions are available under actions. Thank you!

@dmulligan @Sh500 @Sarnog and everone : check out my new blueprint. You may be happier with this one: Adjustable Wake-up to Android alarm - Blueprints Exchange - Home Assistant Community (home-assistant.io)

1 Like

thank you so much for that, I am quite new to HASS and this was exactly what I am looking for!
Now my electric floor heating in bathroom switches on automatically 30 minutes before my alarm rings :)!

1 Like

Hello!
I have just found this thread, and I was testing this out, and my lights did turn on when I set it in HA to do so before my sleep as android alarm. I did have it set to turn on the lights at 30% brightness, just to test it out.

But I do want to know if it is possible to get the lights to first turn them on, at 10% brightness, and then after 2 minutes, they increase by 10% every 2 minutes.

And how would I do that in HA?
And please keep it simple, I am noob to this stuff.

Thanks.

Hi @kiptanoi ,
FYI: I have deprecated this blueprint in favor of this one: Adjustable Wake-up to Android alarm

I do have a script blueprint to increase or decrease the brightness of a light that doesn’t support transitions: Increase or decrease light brightness over time - Blueprints Exchange - Home Assistant Community (home-assistant.io)

Maybe you give the “new” wake-up blueprint in combination with the increase or decrease script blueprint a try. That’s what I have been using for years now.

Hello,
first thank you for blueprint is great, i have problem the blueprint stop working after i update my HA to leatest version and the blueprint to lastest verion but everthing look good is there somthing change ?

Thank you