I have a specific work schedule Google Calendar that I update once every 3rd month. Each working day is added as an event to the calendar with my working hours. Sometimes I also cover the evening shift, then there are two events on a single day that might overlap, e.g. Event 1 “08:00-17:00” and Event 2 “16:00-21:00”.
I would like Home Assistant to notify and remind me of the evening shifts. Is it possible to query, let say the next 10 events from the calendar where the event’s end time is after 18:00 (6 pm), and present them in Home Assistant in someway?
I can think of a couple of use cases that I would like to achieve:
Send a notification at the end of the week if there are any evening shifts the next week.
Send a notification on the morning/evening before of an evening shift.
List the next 5 upcoming dates with evening shifts on a dashboard card.
Has anyone done something similar or know if it’s possible with the current Google Calendar integration to achieve this?
I’m looking for sort off the same thing. But io couldnt get the google calander intergration give me more than one sensor or attributes. Only the next event is usable as tamplate.
The closest thing we have is the calendar trigger which has more ability to get notified independently and for multiple events separately where the entity only looks at one. However in an automation you can’t really query and see multiple.we do have the rest API however which can return multiple events for a date range.
The iCal sensor works with secret iCal address too.
Do you have an example of quering all sensors for a calendar for a particular title (summary attribute)? They appear as separate sensors rather than multiple attributes of a single sensor.
You say that it also work with a secret iCal address, does that mean that anyone can access the calendar if they get hold of the (secret) address?
I haven’t looked into this since I created the initial post, but my thinking is that perhaps it’s possible to query and parse the calendar manually using app daemon. But I haven’t looked into this at all so I don’t know what’s possible.
After setting up the google calendar integration manually create a config/google_calendars.yaml file then restart HA. In this file you can create other entities and use the search capability and look for a hash tag that you put in the description. You might need to use something like #firstshift and #secondshift then you will have multiple binary sensors instead of just one. You might need to combine this with something like #working#firstshift and #working#secondshift etc. This would create binary sensors calendar.working calendar.firstshift calendar.secondshift and then you’d use the combinations of these states in your automation. If there is something that matches the hashtag upcoming, it have attributes that hold start and end times; and message will have the event title. You could have an automation that runs nightly to look at that entity and evaluate the start time and see what the next event will be. Jeff from SlackerLabs has a good walkthrough of how to use the yaml file to deal with the single event issue on YouTube Make Home Assistant Smarter with the Google Calendar Integration - YouTube
It is so silly that they created the google calendar integration but didn’t put all the abilities that it had from the yaml. I have to do this because i need to filter the items. why not add to the integration the search we had before?
I’m working on a replacement feature that will work for all calendar integrations. The yaml search and entity has caveats so my recommendation is to use the examples in the calendar automation from calendar integration for automations instead.
I did that, and if you delete the integration and re add it won’t listen to the file. What is the order of getting it to work. I am also working on something to make it filtered before It gets to google calendar.
I’m working with the group because the filter I want I need it to be across the spectrum.
There is no order to worry about. The file is used when present when the Integration loads. (Whether it’s the first time or when restarted). It definitely works for me and I delete and add the integration all the time when developing new features.