*SOLVED* Check whether vacation is entered in the calendar

Hello, one more question.
I have imported my iOS calendar into the Home Assistant. It is displayed correctly.
How can I now check for an automation whether vacation is entered in the calendar on the current day?

To test this, I enter vacation in the calendar.
I have assigned the string “Urlaub” as the title of the entry
The entry is added to the iCloud calendar “Urlaub” (Entity: calendar.Ulraub)

I have following yaml:

condition: and
conditions:
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  - condition: state
    entity_id: calendar.urlaub
    state: "off"

But regardless of whether vacation is entered on the current day or not: the condition is passed. Where did I make the mistake? The condition should only be passed if no vacation is entered

Best regards
Ralph

First things first - please format your code correctly.

Secondly, what exactly do you want the automation to work on? Is it vacation days you have booked off work, public holidays, or both?

Third, what do you want to do with this automation? You have posted an automation without a trigger or an action. You need to tell us what you want to achieve.

Finally, if you go to the Developer tools and search for calendar.urlaub, what does it show when it’s a holiday?

Hello ShadowFirst,

1.)Thanks for the link to the correct formatting of code. I have adapted it.
2) It is my private vacation
3) I would like to switch on a receiver on the days Monday to Friday when no vacation is entered
4.)

calender.urlaub, state: ON
      Attributes:
      message: urlaub
      all_day: true
      start_time: 2025-02-24 00:00:00
      end_time: 2025-03-01 00:00:00
      location: 
      description: 
      friendly_name: urlaub

I have no more vacations in my calendar for this period…one moment…at this moment the status has changed. Takes it severel minutes to change?
Now it’s

calendar.urlaub, stat: OFF
friendly_name: Urlaub

If that’s the case, then I just have to wait a few minutes for Home Assistant to update the calendar.

:thinking:
I entered the vacation again a good 5 minutes ago. The vacation is also displayed in the Home Assistant calendar view. But in the status of

calendar.urlaub

nothing changes. It is still set to OFF.

So, now the stats changed to ON. After round about 10 minutes. Is this normal? Ok…this is normal…according to my further research. Now that I know this, everything makes sense.

Greetings
Ralph

Ok, so here’s what you need to know:

  • Your state changed while you were writing because the calendar integration warns you that it takes 15 minutes to check the state.
  • You are trying to check the state, when you should be checking the message attribute for “urlaub”.
  • Unless you have a specific requirement to see your vacation in a calendar on HA and to import directly from iCloud calendar, I think the Workday Integration might be more suited to you (using Add Holidays function). However, you would have to enter these dates manually - I am not aware of any automation which can grab your Apple calendar and manually add those dates to the workday calendar.