Office 365 Calendar Access

I have set this and the login and everything worked fine. However I’m trying to pull events from a secondary calendar, but it isnt pulling an event that starts tomorrow afternoon.

I’m using the configuration. It will find an event that is happening now, but not one if set in the future.

o365:
  client_secret: !secret o365_secret
  client_id: !secret o365_id
  calendars:
    - calendar_name: "Bookings"
      start_offset: 0
      end_offset: 72
    - calendar_name: default_calendar

Any advice appreciated.

My error, it is pulling it, you just can’t see future events in the states dialogue.

Hey, thanks for the work on this. Just wondering, do I need to authenticate every time i restart HA? is there something i’m missing?

This seems like what I have been looking for. :slight_smile:
I’m travelling a lot for work. Would it be possible for HA to look for a specific subject, like “Travelling” in the calendar? This way I might use this to toggle “home” or “travelling”, right?

Best regards

Great integration! Thank you!

I have two quesions.

  1. While setting up the configuration and going through the auth flow I keep getting an error.
The reply URL specified in the request does not match the reply URLs configured for the application

I run home assistant core in docker in network_mode=host. I’ve tried adding a few variations on http://localhost:<port>/api/o365 and https://<local-ip>:<port>/api/o365. Neither works. What should be the correct callback url?

  1. The integration seems to need a few unneeded API permissions. Why does it need to have Write and Send access to emails? Or Write access to calenders. It seems Read access should be plenty?

Thanks!

Trying to understand if Office 365 Integration is still part of HomeAssistant HACS, I am not able to find any such component however the link below suggest to look under HACS:


Thank you.

You need to add the repository… go to integrations, then click the big Plus icon at the bottom… search for 365 and it should be there.

Right I have the integration working and it appears to be where it needs to be, however I am getting lost on how to pull the calendar details.

Can someone spell it out to me, how to I create a separate calendar entity for each mailbox in my o365 tenancy ?

You just create an entry for each calendar in the o365_calendar.yaml file (create the file in the root of the config folder if you don’t have one yet):

- cal_id: AQMkADM3YjBlYjFiLTBlNWYtNGE2Mi05NWViLTRiMGEwZWM5O...
  entities:
  - device_id: Calendar2
    end_offset: 24
    name: Calendar 2
    start_offset: 0
    track: true

- cal_id: AAMkADM3YjBlYjFiLTBlNWYtNGE2Mi05NWViLTRiMGEwZWM5OGUy...
  entities:
  - device_id: Calendar1
    end_offset: 24
    name: Calendar 1
    start_offset: 0
    track: true

ok so just create yaml file in root ?
do I need to add a reference to the configuration.yaml to load the file ?
and finally, the ID or device_id do i put in the email address or something else to pull it from specific user ?

Thanks again

ok so just create yaml file in root ?

Yes

do I need to add a reference to the configuration.yaml to load the file ?

No

and finally, the ID or device_id do i put in the email address or something else to pull it from specific user ?

device_id is the name you want to asssign to the instance in HA (I just used the exact calendar name)

cal_id you have to get from O365, easiest is from Power Automate. This should point you in the right direction: Solved: Re: Easiuest way to get calendar_id for the Office… - Page 2 - Power Platform Community (microsoft.com)

Actually after step 6 just select the calendar you need from the dropdown box and click on the three dots, click Peek code and you will find the cal_id in the “table” value.
Rest of the steps not needed.

It has been a while since I got this working so this is the best I can do :slightly_smiling_face:

Anyone having issues with the integration after the most recent HA updates?

Appreciate it!

Anyone had success in getting the search in the o365_calendars.yaml to work correctly?

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAAAAAk_AAA=
  entities:
  - device_id: Birthdays
    end_offset: 24
    name: Birthdays
    start_offset: 0
    track: false

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAANJI2eAAAA=
  entities:
  - device_id: Dog Boarding
    end_offset: 24
    name: Dog Boarding
    start_offset: 0
    track: true

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAUHKKdaAAA=
  entities:
  - device_id: 'Birthday '
    end_offset: 24
    name: 'Birthday '
    start_offset: 0
    track: false

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAAAAAk7AAA=
  entities:
  - device_id: cleaningschedule
    name: Cleaning Schedule
    track: true
    search: "Cleaning Lady"
    
- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAAAAAk7AAA=
  entities:
  - device_id: dogwalking
    name: Auggie Walking Schedule
    track: true
    search: "Auggie Walk"

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAAAAAk7AAA=
  entities:
  - device_id: Calendar
    end_offset: 24
    name: Family Calendar
    track: true

But this is all that shows up:

image

It seems the last “search” criteria overwrites any other calendar searching. If I put the Cleaning Schedule at the bottom of the yaml file then I see this with the correct search results populating the calendar:

image

Thoughts?

Did you get this working in the end? It looks like the issue with your setup is you’re repeating calendars. It should be something like

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAAAAAk_AAA=
  entities:
  - device_id: Birthdays
    end_offset: 24
    name: Birthdays
    start_offset: 0
    track: false

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAANJI2eAAAA=
  entities:
  - device_id: Dog Boarding
    end_offset: 24
    name: Dog Boarding
    start_offset: 0
    track: true

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAUHKKdaAAA=
  entities:
  - device_id: 'Birthday '
    end_offset: 24
    name: 'Birthday '
    start_offset: 0
    track: false

- cal_id: AAMkADVlODZmM2Y0LTE2YTgtNGVlNS04ODA0LWZhOTk4NjNiYThiNgBGAAAAAADVRsrPPx3JSpECaiGWNKLIBwBm_DmLwSqWRrRk2rF5mjSDAAAAAAEGAABm_DmLwSqWRrRk2rF5mjSDAAAAAAk7AAA=
  entities:
  - device_id: cleaningschedule
    name: Cleaning Schedule
    track: true
    search: "Cleaning Lady"
  - device_id: dogwalking
    name: Auggie Walking Schedule
    track: true
    search: "Auggie Walk"
  - device_id: Calendar
    end_offset: 24
    name: Family Calendar
    track: true

I did get it working. Unfortunately, something has changed in O365 and now only the birthday calendar display. There must be another bug in the code case but I don’t believe it is being managed anymore. A shame as I used it to automate many things in the house based off a shared family calendar.

Do your HA report any errors with the component? For instance, I’ve been receiving issues with HA raising the following:

AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'zone'

With thanks to some other HA folk, it looks like Error Handling Request · Issue #123 · PTST/O365-HomeAssistant · GitHub is the issue around the above error. Long story short this can be fixed by replacing the following

"requirements": ["O365==2.0.15", "BeautifulSoup4==4.8.2"]

with

"requirements": ["O365==2.0.15", "BeautifulSoup4==4.8.2", "tzlocal==2.1"]

in the components manifest.json file. If you clear the __pycache__ folder and restart HA, then the above issue is fixed.

I gave up and exported everything out of O365 and put it into a Gmail calendar. Seems to be working fine. The export/import was a big help so I didn’t lose all my stuff already in the calendar. Too bad as I hate google.