From 6cb631078b628e6bf4dd0b67adb2232ef6430f39 Mon Sep 17 00:00:00 2001 From: RogerSelwyn Date: Mon, 28 Feb 2022 13:42:17 +0000 Subject: [PATCH] Remove the already deprecated YAML Calendar configuration --- custom_components/o365/__init__.py | 49 ++++++------------------------ custom_components/o365/const.py | 10 ------ 2 files changed, 9 insertions(+), 50 deletions(-) diff --git a/custom_components/o365/__init__.py b/custom_components/o365/__init__.py index 8406f4a..df60a0e 100644 --- a/custom_components/o365/__init__.py +++ b/custom_components/o365/__init__.py @@ -10,34 +10,15 @@ from homeassistant.helpers.network import get_url from O365 import Account, FileSystemTokenBackend -from .const import ( - AUTH_CALLBACK_NAME, - AUTH_CALLBACK_PATH, - AUTH_CALLBACK_PATH_ALT, - CONF_ALT_CONFIG, - CONF_CALENDARS, - CONF_CLIENT_ID, - CONF_CLIENT_SECRET, - CONF_EMAIL_SENSORS, - CONF_ENABLE_UPDATE, - CONF_QUERY_SENSORS, - CONF_STATUS_SENSORS, - CONF_TRACK_NEW, - CONFIG_SCHEMA, - CONFIGURATOR_DESCRIPTION, - CONFIGURATOR_LINK_NAME, - CONFIGURATOR_SUBMIT_CAPTION, - DEFAULT_CACHE_PATH, - DEFAULT_NAME, - DOMAIN, - TOKEN_FILENAME, -) -from .utils import ( - build_config_file_path, - build_minimum_permissions, - build_requested_permissions, - validate_permissions, -) +from .const import (AUTH_CALLBACK_NAME, AUTH_CALLBACK_PATH, + AUTH_CALLBACK_PATH_ALT, CONF_ALT_CONFIG, CONF_CLIENT_ID, + CONF_CLIENT_SECRET, CONF_EMAIL_SENSORS, CONF_ENABLE_UPDATE, + CONF_QUERY_SENSORS, CONF_STATUS_SENSORS, CONF_TRACK_NEW, + CONFIG_SCHEMA, CONFIGURATOR_DESCRIPTION, + CONFIGURATOR_LINK_NAME, CONFIGURATOR_SUBMIT_CAPTION, + DEFAULT_CACHE_PATH, DEFAULT_NAME, DOMAIN, TOKEN_FILENAME) +from .utils import (build_config_file_path, build_minimum_permissions, + build_requested_permissions, validate_permissions) _LOGGER = logging.getLogger(__name__) @@ -86,18 +67,6 @@ async def async_setup(hass, config): def do_setup(hass, config, account): """Run the setup after we have everything configured.""" - if config.get(CONF_CALENDARS, None): - _LOGGER.warning( - "Configuring calendars through configuration.yaml has been deprecated, " - "and will be removed in a future release. Please see the docs for how " - "to proceed:" - "\nhttps://github.com/PTST/O365-HomeAssistant/tree/master#calendar-configuration" - ) - warnings.warn( - "Configuring calendars through configuration.yaml has been deprecated, " - "and will be removed in a future release. Please see the docs for how to proceed", - FutureWarning, - ) email_sensors = config.get(CONF_EMAIL_SENSORS, []) query_sensors = config.get(CONF_QUERY_SENSORS, []) status_sensors = config.get(CONF_STATUS_SENSORS, []) diff --git a/custom_components/o365/const.py b/custom_components/o365/const.py index 2c6cb22..6638cb8 100644 --- a/custom_components/o365/const.py +++ b/custom_components/o365/const.py @@ -55,7 +55,6 @@ class EventResponse(Enum): CONF_ALT_CONFIG = "alt_auth_flow" CONF_CACHE_PATH = "cache_path" CONF_CALENDAR_NAME = "calendar_name" -CONF_CALENDARS = "calendars" CONF_CLIENT_ID = "client_id" CONF_CLIENT_SECRET = "client_secret" # nosec CONF_DEVICE_ID = "device_id" @@ -139,14 +138,6 @@ class EventResponse(Enum): YAML_CALENDARS = f"{DOMAIN}_calendars.yaml" -CALENDAR_SCHEMA = vol.Schema( - { - vol.Required(CONF_CALENDAR_NAME): cv.string, - vol.Optional(CONF_NAME): cv.string, - vol.Optional(CONF_HOURS_FORWARD_TO_GET, default=24): int, - vol.Optional(CONF_HOURS_BACKWARD_TO_GET, default=0): int, - } -) EMAIL_SENSOR = vol.Schema( { vol.Required(CONF_NAME): cv.string, @@ -184,7 +175,6 @@ class EventResponse(Enum): vol.Optional(CONF_TRACK_NEW, default=True): bool, vol.Optional(CONF_ENABLE_UPDATE, default=True): bool, vol.Optional(CONF_ALT_CONFIG, default=False): bool, - vol.Optional(CONF_CALENDARS, default=[]): [CALENDAR_SCHEMA], vol.Optional(CONF_EMAIL_SENSORS): [EMAIL_SENSOR], vol.Optional(CONF_QUERY_SENSORS): [QUERY_SENSOR], vol.Optional(CONF_STATUS_SENSORS): [STATUS_SENSOR],