Skip to content

Commit

Permalink
Rename title to subject in line with O365 module.
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Nov 15, 2022
1 parent 0550bdc commit f1c920a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion custom_components/o365/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class EventResponse(Enum):
ATTR_START = "start"
ATTR_SUBJECT = "subject"
ATTR_SUMMARY = "summary"
ATTR_TITLE = "title"
ATTR_TYPE = "type"
ATTR_ZIP_ATTACHMENTS = "zip_attachments"
ATTR_ZIP_NAME = "zip_name"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/o365/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
)

NEW_TASK_SCHEMA = {
vol.Required(ATTR_TITLE): cv.string,
vol.Required(ATTR_SUBJECT): cv.string,
vol.Optional(ATTR_DESCRIPTION): cv.string,
vol.Optional(ATTR_DUE): cv.string,
vol.Optional(ATTR_REMINDER): cv.datetime,
Expand Down
11 changes: 6 additions & 5 deletions custom_components/o365/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
ATTR_OVERDUE_TASKS,
ATTR_SUBJECT,
ATTR_SUMMARY,
ATTR_TITLE,
CONF_ACCOUNT,
CONF_ACCOUNT_NAME,
CONF_BODY_CONTAINS,
Expand Down Expand Up @@ -403,11 +402,13 @@ def extra_state_attributes(self):
all_tasks = []
overdue_tasks = []
for item in self._tasks:
task = {ATTR_TITLE: item.title}
task = {ATTR_SUBJECT: item.subject}
if item.due:
task[ATTR_DUE] = item.due
if item.due < dt.utcnow():
overdue_tasks.append({ATTR_TITLE: item.title, ATTR_DUE: item.due})
overdue_tasks.append(
{ATTR_SUBJECT: item.subject, ATTR_DUE: item.due}
)

all_tasks.append(task)

Expand All @@ -424,9 +425,9 @@ async def async_update(self):

self._tasks = list(data)

def new_task(self, title, description=None, due=None, reminder=None):
def new_task(self, subject, description=None, due=None, reminder=None):
"""Create a new task for this task list."""
new_task = self._todo.new_task(title=title)
new_task = self._todo.new_task(subject=subject)
if description:
new_task.body = description
if due:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/o365/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ new_task:
integration: o365
domain: sensor
fields:
title:
description: The title of the task
subject:
description: The subject of the task
example: Pick up the mail
description:
description: Description of the task
Expand Down

0 comments on commit f1c920a

Please sign in to comment.