Skip to content

Commit

Permalink
Remove the already deprecated YAML Calendar configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Feb 28, 2022
1 parent 8ceccff commit 6cb6310
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 50 deletions.
49 changes: 9 additions & 40 deletions custom_components/o365/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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, [])
Expand Down
10 changes: 0 additions & 10 deletions custom_components/o365/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 6cb6310

Please sign in to comment.