Update service domain for todoist from 'calendar' to 'todoist' (#29131)
* move todoist constants to const.py and update service domain * update .coveragerc * remove unused variable * save file
This commit is contained in:
parent
004476a1f8
commit
1681d36637
4 changed files with 115 additions and 108 deletions
|
@ -692,6 +692,7 @@ omit =
|
||||||
homeassistant/components/tile/device_tracker.py
|
homeassistant/components/tile/device_tracker.py
|
||||||
homeassistant/components/time_date/sensor.py
|
homeassistant/components/time_date/sensor.py
|
||||||
homeassistant/components/todoist/calendar.py
|
homeassistant/components/todoist/calendar.py
|
||||||
|
homeassistant/components/todoist/const.py
|
||||||
homeassistant/components/tof/sensor.py
|
homeassistant/components/tof/sensor.py
|
||||||
homeassistant/components/tomato/device_tracker.py
|
homeassistant/components/tomato/device_tracker.py
|
||||||
homeassistant/components/toon/*
|
homeassistant/components/toon/*
|
||||||
|
|
|
@ -1,26 +1,2 @@
|
||||||
# Describes the format for available calendar services
|
# Describes the format for available calendar services
|
||||||
|
|
||||||
todoist_new_task:
|
|
||||||
description: Create a new task and add it to a project.
|
|
||||||
fields:
|
|
||||||
content:
|
|
||||||
description: The name of the task.
|
|
||||||
example: Pick up the mail
|
|
||||||
project:
|
|
||||||
description: The name of the project this task should belong to. Defaults to Inbox.
|
|
||||||
example: Errands
|
|
||||||
labels:
|
|
||||||
description: Any labels that you want to apply to this task, separated by a comma.
|
|
||||||
example: Chores,Deliveries
|
|
||||||
priority:
|
|
||||||
description: The priority of this task, from 1 (normal) to 4 (urgent).
|
|
||||||
example: 2
|
|
||||||
due_date_string:
|
|
||||||
description: The day this task is due, in natural language.
|
|
||||||
example: "tomorrow"
|
|
||||||
due_date_lang:
|
|
||||||
description: The language of due_date_string.
|
|
||||||
example: "en"
|
|
||||||
due_date:
|
|
||||||
description: The day this task is due, in format YYYY-MM-DD.
|
|
||||||
example: "2018-04-01"
|
|
||||||
|
|
|
@ -5,97 +5,48 @@ import logging
|
||||||
from todoist.api import TodoistAPI
|
from todoist.api import TodoistAPI
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.calendar import (
|
from homeassistant.components.calendar import PLATFORM_SCHEMA, CalendarEventDevice
|
||||||
DOMAIN,
|
|
||||||
PLATFORM_SCHEMA,
|
|
||||||
CalendarEventDevice,
|
|
||||||
)
|
|
||||||
from homeassistant.const import CONF_ID, CONF_NAME, CONF_TOKEN
|
from homeassistant.const import CONF_ID, CONF_NAME, CONF_TOKEN
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.template import DATE_STR_FORMAT
|
from homeassistant.helpers.template import DATE_STR_FORMAT
|
||||||
from homeassistant.util import Throttle, dt
|
from homeassistant.util import Throttle, dt
|
||||||
|
|
||||||
|
from .const import (
|
||||||
|
ALL_DAY,
|
||||||
|
ALL_TASKS,
|
||||||
|
CHECKED,
|
||||||
|
COMPLETED,
|
||||||
|
CONF_PROJECT_DUE_DATE,
|
||||||
|
CONF_EXTRA_PROJECTS,
|
||||||
|
CONF_PROJECT_LABEL_WHITELIST,
|
||||||
|
CONF_PROJECT_WHITELIST,
|
||||||
|
CONTENT,
|
||||||
|
DATETIME,
|
||||||
|
DESCRIPTION,
|
||||||
|
DOMAIN,
|
||||||
|
DUE,
|
||||||
|
DUE_DATE,
|
||||||
|
DUE_DATE_LANG,
|
||||||
|
DUE_DATE_STRING,
|
||||||
|
DUE_DATE_VALID_LANGS,
|
||||||
|
DUE_TODAY,
|
||||||
|
END,
|
||||||
|
ID,
|
||||||
|
LABELS,
|
||||||
|
NAME,
|
||||||
|
OVERDUE,
|
||||||
|
PRIORITY,
|
||||||
|
PROJECT_ID,
|
||||||
|
PROJECT_NAME,
|
||||||
|
PROJECTS,
|
||||||
|
SERVICE_NEW_TASK,
|
||||||
|
START,
|
||||||
|
SUMMARY,
|
||||||
|
TASKS,
|
||||||
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF_EXTRA_PROJECTS = "custom_projects"
|
|
||||||
CONF_PROJECT_DUE_DATE = "due_date_days"
|
|
||||||
CONF_PROJECT_LABEL_WHITELIST = "labels"
|
|
||||||
CONF_PROJECT_WHITELIST = "include_projects"
|
|
||||||
|
|
||||||
# Calendar Platform: Does this calendar event last all day?
|
|
||||||
ALL_DAY = "all_day"
|
|
||||||
# Attribute: All tasks in this project
|
|
||||||
ALL_TASKS = "all_tasks"
|
|
||||||
# Todoist API: "Completed" flag -- 1 if complete, else 0
|
|
||||||
CHECKED = "checked"
|
|
||||||
# Attribute: Is this task complete?
|
|
||||||
COMPLETED = "completed"
|
|
||||||
# Todoist API: What is this task about?
|
|
||||||
# Service Call: What is this task about?
|
|
||||||
CONTENT = "content"
|
|
||||||
# Calendar Platform: Get a calendar event's description
|
|
||||||
DESCRIPTION = "description"
|
|
||||||
# Calendar Platform: Used in the '_get_date()' method
|
|
||||||
DATETIME = "dateTime"
|
|
||||||
DUE = "due"
|
|
||||||
# Service Call: When is this task due (in natural language)?
|
|
||||||
DUE_DATE_STRING = "due_date_string"
|
|
||||||
# Service Call: The language of DUE_DATE_STRING
|
|
||||||
DUE_DATE_LANG = "due_date_lang"
|
|
||||||
# Service Call: The available options of DUE_DATE_LANG
|
|
||||||
DUE_DATE_VALID_LANGS = [
|
|
||||||
"en",
|
|
||||||
"da",
|
|
||||||
"pl",
|
|
||||||
"zh",
|
|
||||||
"ko",
|
|
||||||
"de",
|
|
||||||
"pt",
|
|
||||||
"ja",
|
|
||||||
"it",
|
|
||||||
"fr",
|
|
||||||
"sv",
|
|
||||||
"ru",
|
|
||||||
"es",
|
|
||||||
"nl",
|
|
||||||
]
|
|
||||||
# Attribute: When is this task due?
|
|
||||||
# Service Call: When is this task due?
|
|
||||||
DUE_DATE = "due_date"
|
|
||||||
# Todoist API: Look up a task's due date
|
|
||||||
DUE_DATE_UTC = "due_date_utc"
|
|
||||||
# Attribute: Is this task due today?
|
|
||||||
DUE_TODAY = "due_today"
|
|
||||||
# Calendar Platform: When a calendar event ends
|
|
||||||
END = "end"
|
|
||||||
# Todoist API: Look up a Project/Label/Task ID
|
|
||||||
ID = "id"
|
|
||||||
# Todoist API: Fetch all labels
|
|
||||||
# Service Call: What are the labels attached to this task?
|
|
||||||
LABELS = "labels"
|
|
||||||
# Todoist API: "Name" value
|
|
||||||
NAME = "name"
|
|
||||||
# Attribute: Is this task overdue?
|
|
||||||
OVERDUE = "overdue"
|
|
||||||
# Attribute: What is this task's priority?
|
|
||||||
# Todoist API: Get a task's priority
|
|
||||||
# Service Call: What is this task's priority?
|
|
||||||
PRIORITY = "priority"
|
|
||||||
# Todoist API: Look up the Project ID a Task belongs to
|
|
||||||
PROJECT_ID = "project_id"
|
|
||||||
# Service Call: What Project do you want a Task added to?
|
|
||||||
PROJECT_NAME = "project"
|
|
||||||
# Todoist API: Fetch all Projects
|
|
||||||
PROJECTS = "projects"
|
|
||||||
# Calendar Platform: When does a calendar event start?
|
|
||||||
START = "start"
|
|
||||||
# Calendar Platform: What is the next calendar event about?
|
|
||||||
SUMMARY = "summary"
|
|
||||||
# Todoist API: Fetch all Tasks
|
|
||||||
TASKS = "items"
|
|
||||||
|
|
||||||
SERVICE_NEW_TASK = "todoist_new_task"
|
|
||||||
|
|
||||||
NEW_TASK_SERVICE_SCHEMA = vol.Schema(
|
NEW_TASK_SERVICE_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(CONTENT): cv.string,
|
vol.Required(CONTENT): cv.string,
|
||||||
|
|
79
homeassistant/components/todoist/const.py
Normal file
79
homeassistant/components/todoist/const.py
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
"""Constants for the Todoist component."""
|
||||||
|
CONF_EXTRA_PROJECTS = "custom_projects"
|
||||||
|
CONF_PROJECT_DUE_DATE = "due_date_days"
|
||||||
|
CONF_PROJECT_LABEL_WHITELIST = "labels"
|
||||||
|
CONF_PROJECT_WHITELIST = "include_projects"
|
||||||
|
|
||||||
|
# Calendar Platform: Does this calendar event last all day?
|
||||||
|
ALL_DAY = "all_day"
|
||||||
|
# Attribute: All tasks in this project
|
||||||
|
ALL_TASKS = "all_tasks"
|
||||||
|
# Todoist API: "Completed" flag -- 1 if complete, else 0
|
||||||
|
CHECKED = "checked"
|
||||||
|
# Attribute: Is this task complete?
|
||||||
|
COMPLETED = "completed"
|
||||||
|
# Todoist API: What is this task about?
|
||||||
|
# Service Call: What is this task about?
|
||||||
|
CONTENT = "content"
|
||||||
|
# Calendar Platform: Get a calendar event's description
|
||||||
|
DESCRIPTION = "description"
|
||||||
|
# Calendar Platform: Used in the '_get_date()' method
|
||||||
|
DATETIME = "dateTime"
|
||||||
|
DUE = "due"
|
||||||
|
# Service Call: When is this task due (in natural language)?
|
||||||
|
DUE_DATE_STRING = "due_date_string"
|
||||||
|
# Service Call: The language of DUE_DATE_STRING
|
||||||
|
DUE_DATE_LANG = "due_date_lang"
|
||||||
|
# Service Call: The available options of DUE_DATE_LANG
|
||||||
|
DUE_DATE_VALID_LANGS = [
|
||||||
|
"en",
|
||||||
|
"da",
|
||||||
|
"pl",
|
||||||
|
"zh",
|
||||||
|
"ko",
|
||||||
|
"de",
|
||||||
|
"pt",
|
||||||
|
"ja",
|
||||||
|
"it",
|
||||||
|
"fr",
|
||||||
|
"sv",
|
||||||
|
"ru",
|
||||||
|
"es",
|
||||||
|
"nl",
|
||||||
|
]
|
||||||
|
# Attribute: When is this task due?
|
||||||
|
# Service Call: When is this task due?
|
||||||
|
DUE_DATE = "due_date"
|
||||||
|
# Attribute: Is this task due today?
|
||||||
|
DUE_TODAY = "due_today"
|
||||||
|
# Calendar Platform: When a calendar event ends
|
||||||
|
END = "end"
|
||||||
|
# Todoist API: Look up a Project/Label/Task ID
|
||||||
|
ID = "id"
|
||||||
|
# Todoist API: Fetch all labels
|
||||||
|
# Service Call: What are the labels attached to this task?
|
||||||
|
LABELS = "labels"
|
||||||
|
# Todoist API: "Name" value
|
||||||
|
NAME = "name"
|
||||||
|
# Attribute: Is this task overdue?
|
||||||
|
OVERDUE = "overdue"
|
||||||
|
# Attribute: What is this task's priority?
|
||||||
|
# Todoist API: Get a task's priority
|
||||||
|
# Service Call: What is this task's priority?
|
||||||
|
PRIORITY = "priority"
|
||||||
|
# Todoist API: Look up the Project ID a Task belongs to
|
||||||
|
PROJECT_ID = "project_id"
|
||||||
|
# Service Call: What Project do you want a Task added to?
|
||||||
|
PROJECT_NAME = "project"
|
||||||
|
# Todoist API: Fetch all Projects
|
||||||
|
PROJECTS = "projects"
|
||||||
|
# Calendar Platform: When does a calendar event start?
|
||||||
|
START = "start"
|
||||||
|
# Calendar Platform: What is the next calendar event about?
|
||||||
|
SUMMARY = "summary"
|
||||||
|
# Todoist API: Fetch all Tasks
|
||||||
|
TASKS = "items"
|
||||||
|
|
||||||
|
DOMAIN = "todoist"
|
||||||
|
|
||||||
|
SERVICE_NEW_TASK = "new_task"
|
Loading…
Add table
Reference in a new issue