PTST / O365-HomeAssistant

Office 365 integration for Home Assistant
MIT License
69 stars 13 forks source link

what does this do exactly? The readme doesn't say. #48

Closed bbrendon closed 4 years ago

PTST commented 4 years ago

It's a custom component for Home Assistant that allows integration of O365 calendars and mail with Home Assistant

bbrendon commented 4 years ago

But like, what data from the calendar and how is it represented in hass?

I read the readme a few more times and for some reason I got lost in the bottom half and didn't concentrate on the top. I think I get the point now.

I know you're a busy person. You can probably close this.

PTST commented 4 years ago

Well, i actually agree with you that the readme could be a lot more concise and fleshed out.

But, let me try and flesh out an answer anyways.

The primary state and attributes is an implementation of Home Assistant's CalendarEventDevice. The current state and attributes will belong to the current or next event in you calendar. It then exposes a function get_events that allows Home Assistant to poll events for a given period.

This is what enables the functionality of the different Lovelace calendar cards you can get (eg. Atomic Calendar).

In addition to that i append all the upcoming events in the data attribute in raw json, to better enable my own automation use cases. In this way i can automate things based on upcoming events easier.

Here is an example from my calendar for today (personal and company info redacted)

message: Breakfast
all_day: false
start_time: '2020-02-28 08:00:00'
end_time: '2020-02-28 08:30:00'
location:
  displayName: The cantine
  locationType: default
  uniqueId: cantine
  uniqueIdType: private
description: "Friday team breakfast"
offset_reached: false
data:
  - summary: Breakfast
    description: "Friday team breakfast"
    location: Kantinen
    categories: []
    sensitivity: Normal
    show_as: Busy
    is_all_day: false
    attendees:
      - email: xxx@xxx.dk
        type: required
      - email: xxx2@xxx.dk
        type: required
    start: '2020-02-28T08:00:00+01:00'
    end: '2020-02-28T08:30:00+01:00'
    uid: redacted
    calendar_id: redacted
    subject: Breakfast
    body: "Friday team breakfast"
  - summary: RPA teammeeting
    description: "Weekly teammeeting"
    location: redacted
    categories: []
    sensitivity: Normal
    show_as: Tentative
    is_all_day: false
    attendees:
      - email: xxx@xxx.dk
        type: required
      - email: xxx@xxx.dk
        type: required
      - email: xxx@xxx.dk
        type: required
    start: '2020-02-28T09:30:00+01:00'
    end: '2020-02-28T10:00:00+01:00'
    uid: redacted
    calendar_id: redacted
    subject: RPA teammeeting
    body: "Weekly teammeeting"
  friendly_name: Work Calender
PTST commented 4 years ago

If any of this does not make sense or need further clarification please let me know. It's the only way the documentation will get any better.

Since i know the code in detail, it's hard for me to know what does and does not make sense from an outside perspective 🙂