Alarm Clock with boolean

Hello,
I am in the process of making an alarm clock.

I have create the following helpers:

  • input_boolean.wakestatus_1 ( to switch the alarm clock on and off in general )
  • input_datetime.waketime_1 ( so set the alarm time)
  • input_boolean.wakeweekday_mon_1 (so that the alarm clock goes on that day or not)
  • input_boolean.wakeweekday_tue_1 (so that the alarm clock goes on that day or not)
  • input_boolean.wakeweekday_wed_1 (so that the alarm clock goes on that day or not)
  • input_boolean.wakeweekday_thu_1 (so that the alarm clock goes on that day or not)
  • input_boolean.wakeweekday_fri_1 (so that the alarm clock goes on that day or not)
  • input_boolean.wakeweekday_sat_1 (so that the alarm clock goes on that day or not)
  • input_boolean.wakeweekday_sun_1 (so that the alarm clock goes on that day or not)

So now I would like to make an automation, whitch take care of the following:

  • is input_boolean.wakestatus_1 = on
  • input_datetime.waketime_1 = now
  • input_boolean.wakeweekday_mon_1 = on
  • input_boolean.wakeweekday_tue_1 = on
  • input_boolean.wakeweekday_wed_1 = on
  • input_boolean.wakeweekday_thu_1 = on
  • input_boolean.wakeweekday_fri_1 = on
  • input_boolean.wakeweekday_sat_1 = on
  • input_boolean.wakeweekday_sun_1 = on
  • and today is a day of the week when a boolean is on

I have test ist with the following code:

alias: Wecker 1
description: ''
trigger:
  - platform: time
    at: input_datetime.waketime_1
condition:
  - condition: state
    entity_id: input_boolean.wakestatus_1
    state: 'on'
  - condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.wakeweekday_mon_1
        state: 'on'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_tue_1
            state: 'on'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_wed_1
            state: 'on'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_thu_1
            state: 'on'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_fri_1
            state: 'on'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_sat_1
            state: 'on'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_sun_1
            state: 'on'
action:
  - service: scene.turn_on
    target:
      entity_id: scene.musik_fur_wecker
    metadata: {}
mode: single

but it does not start the scene. And I have no idea how to add this “and today is a day of the week when a boolean is on”

and today is a day of the week when a boolean is on

You’ve set up your Or conditions incorrectly, but this is a lot easier to do using templating.
As long as your wake time is after midnight, the following templating will generate the name abbreviation of your Input boolean according to the current day and use that to check its state.

alias: Wecker 1
description: ''
trigger:
  - platform: time
    at: input_datetime.waketime_1
condition:
  - condition: state
    entity_id: input_boolean.wakestatus_1
    state: 'on'
  - condition: template
    value_template: >
      {{ is_state("input_boolean.wakeweekday_"~now().strftime("%a")|lower~"_1", 'on') }}
action:
  - service: scene.turn_on
    target:
      entity_id: scene.musik_fur_wecker
    metadata: {}
mode: single

If you want to use a non-template method and check for current day, your conditions would look like:

condition:
  - condition: state
    entity_id: input_boolean.wakestatus_1
    state: 'on'
  - condition: or
    conditions:
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_mon_1
            state: 'on'
          - condition: time
            before: '00:00:00'
            weekday:
            - mon
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_tue_1
            state: 'on'
          - condition: time
            before: '00:00:00'
            weekday:
            - tue
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_wed_1
            state: 'on'
          - condition: time
            before: '00:00:00'
            weekday:
            - wed
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_thu_1
            state: 'on'
          - condition: time
            before: '00:00:00'
            weekday:
            - thu
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_fri_1
            state: 'on'
          - condition: time
            before: '00:00:00'
            weekday:
            - fri
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_sat_1
            state: 'on'
          - condition: time
            before: '00:00:00'
            weekday:
            - sat
      - condition: and
        conditions:
          - condition: state
            entity_id: input_boolean.wakeweekday_sun_1
            state: 'on'
          - condition: time
            before: '00:00:00'
            weekday:
            - sun
1 Like

I understand this is not what you actually want but as an option:

You could set the alarm on the phone and have it set to 0 in ring volume (I think) if you don’t want the phone to ring.
This then exposes the time as a sensor via the HA app.
The sensor is very easy to use as a trigger in an automation.

I have try it with your first code and it works.

Thank you very much

I have not think about to do it over my mobilefone. I’m not sure, if it work. Because I think I cant set the ring volume to 0. And If it works, think I must stopp two alarm clocks.

But I still have two questions.

  • In Germany we have 24 hours on our clock.
    If I put 06:20 in my boolean the change it to 6:20
    It it works when the time is 06:20?

  • Is there another possibility for the input, because with this (see screenshot) the input works only with difficulty

There is a time picker card in HACS

1 Like

Thank you that works

Only on Android, right?

Don’t know but probably, the number of sensors available on Apple products are very low

Sensors | Home Assistant Companion Docs (home-assistant.io)

1 Like