Date dialog

hello.
i’m trying to create a holiday mode where HA doesn’t wake me up as early as if i had to go to work. part of that is to check if the current date is after the end date when i turn holiday mode on, and if so bring up some kind of dialog to set the end date (when holiday mode is automatically turned off). what’s the best way to bring up that dialog?

It isn’t clear how you are doing anything you have described.

How are you defining the “holiday mode”?
How is that being used to not wake you up?

Post any related configuration for what you are doing.

i have an input boolean that indicates if holiday mode is on. i also have 2 automations that wake me up (one early for weekdays and one not so early for the weekend). of course i have to modify them to take the input boolean into account, but that won’t be a problem.

right now i have 2 problems:

  • determining if it is before or after the end date (a datetime helper) but i think i can do that with a template.
  • bringing up some kind of dialog box to set the end date.

If you mark your holidays in your calendar, you can use a calendar integration to check for it and adjust HA behaviour. You could for instance create a template based binary sensor that indicates you are in a holiday period. In that case you do not need to do anything in HA to start/stop.

If you want to keep it in HA, then just an input date time entity with the end date on your dashboard would be enough. You don ot need any other switch. If the date time is in the future, you are in holiday mode. You could use a template binary sensor for easier checking if you wish.

2 Likes

You should post the YAML for the automations you have, and that will make it much easier for people to help you.

Use the </> Preformatted Text feature.

As I understand it, the steps you are describing are as follows:

  1. You manually turn on the Input boolean
  2. An automation is triggered that compares the current date to one held in an Input Datetime.
  3. If that time is in the past, some kind of “dialog box” should appear to help you set it to a future date.

What “dialog box” are you talking about? If you are using a specific integration, you need to tell us what it is.

The only core options I can think of would be either an Actionable Notification through the mobile app (or some other notifier) or a Persistent Notification.

Actionable notifications have the advantage that you could set it up to accept direct input like a date string, but they are more complicated to configure.

Persistent Notifications are easier, but the only “action” they can contain is a link:

action: persistent_notification.create
data:
  message: |
    [Click to go to the Calendar.](https://my.home-assistant.io/redirect/calendar/)
  title: Set an end date for your holiday.

In our household, we just use a local Calendar like Edwin suggested above. For holiday days I just add an all-day event titled “Off Work”. Then I have a template binary sensor to check if the calendar’s state is “on” and the message attribute is “Off Work”.

You may also want to take a look at the Workday integration which allows adding custom dates.

The problem with a switch and a date is that both need to be right for it to work, while just the date/time should be enough. Also, a popup dialog when setting the switch is hard to do. That is why I suggested to either use a calendar or just an input date/time entity on the dashboard. Et it in the future and you have a holiday, if it is in the past, the holiday is over.

But personally, I like the calendar approach much more.

i’ve put the event into a calendar but now i have another problem: i’ve written an automation that is supposed to set a flag when the event begins and reset it when the event ends. but as far as i can tell, that automation does not get triggered. no traces, no notifications, no nothing. now the question is, what am i doing wrong?

here’s the automation:

triggers:
  - trigger: calendar
    entity_id: calendar.home
    event: start
    id: start
  - trigger: calendar
    entity_id: calendar.home
    event: end
    id: end
conditions: []
actions:
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: Triggered!
  - choose:
      - conditions:
          - condition: trigger
            id:
              - start
        sequence:
          - if:
              - condition: state
                entity_id: calendar.home
                state:
                  - Holiday
                attribute: description
            then:
              - action: input_boolean.turn_on
                metadata: {}
                target:
                  entity_id: input_boolean.holiday_mode
                data: {}
              - action: notify.persistent_notification
                metadata: {}
                data:
                  message: "test: holiday mode is on"
      - conditions:
          - condition: trigger
            id:
              - end
        sequence:
          - if:
              - condition: state
                entity_id: calendar.home
                state:
                  - Holiday
                attribute: description
            then:
              - action: input_boolean.turn_off
                metadata: {}
                target:
                  entity_id: input_boolean.holiday_mode
                data: {}
              - action: notify.persistent_notification
                metadata: {}
                data:
                  message: "test: holiday mode is off"
mode: single

i have an event that starts next sunday and ends in the new year, and i want to get it working by then. i’ve also created a one-day event with the same info as the main event that i used for testing, and the automation failed every test. what’s going on?