Skip to content

Commit

Permalink
Fix for all day_event
Browse files Browse the repository at this point in the history
  • Loading branch information
PTST committed Sep 1, 2020
1 parent da452d9 commit debf019
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions custom_components/o365/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ def __init__(self, hass, account, calendar_id, entity, entity_id):
self.data = O365CalendarData(
account, calendar_id, self.search, self.max_results
)
self._event = None
self._event = {}
self._name = entity.get(CONF_NAME)
self.entity_id = entity_id
self._offset_reached = False
self._data_attribute = []

@property
def device_state_attributes(self):
return {"offset_reached": self._offset_reached, "data": self._data_attribute}
return {"all_day": self._event.get("is_all_day", False) if self.data.event is not None else False, "offset_reached": self._offset_reached, "data": self._data_attribute}

@property
def event(self):
Expand Down Expand Up @@ -190,7 +190,7 @@ async def async_update(self, hass):
)
self.event = None
return

self.event = {
"summary": vevent.subject,
"start": self.get_hass_date(vevent.start),
Expand Down Expand Up @@ -234,7 +234,7 @@ def get_end_date(obj):

else:
enddate = obj.start + timedelta(days=1)

return enddate


Expand Down
3 changes: 2 additions & 1 deletion custom_components/o365/sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from datetime import datetime
from operator import itemgetter
from homeassistant.helpers.entity import Entity
from .const import (
Expand Down Expand Up @@ -101,7 +102,7 @@ def __init__(self, account, conf):
else:
self.query.chain("and")
self.query.on_attribute("IsRead").equals(not self.is_unread)

self.query.order_by("receivedDateTime", ascending=False)
self._state = None
self._attributes = {}

Expand Down

0 comments on commit debf019

Please sign in to comment.