Remove deprecated rflink configs (#29972)

They've been deprecated and automatically replaced since July 2017
already, fe6a4b8ae5
This commit is contained in:
Ville Skyttä 2019-12-15 22:57:23 +02:00 committed by GitHub
parent 012c09ce00
commit d6f317c0a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 53 deletions

View file

@ -19,7 +19,6 @@ from homeassistant.const import (
from homeassistant.core import CoreState, callback
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.deprecation import get_deprecated
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
async_dispatcher_send,
@ -33,12 +32,9 @@ ATTR_EVENT = "event"
ATTR_STATE = "state"
CONF_ALIASES = "aliases"
CONF_ALIASSES = "aliasses"
CONF_GROUP_ALIASES = "group_aliases"
CONF_GROUP_ALIASSES = "group_aliasses"
CONF_GROUP = "group"
CONF_NOGROUP_ALIASES = "nogroup_aliases"
CONF_NOGROUP_ALIASSES = "nogroup_aliasses"
CONF_DEVICE_DEFAULTS = "device_defaults"
CONF_DEVICE_ID = "device_id"
CONF_DEVICES = "devices"
@ -563,18 +559,3 @@ class SwitchableRflinkDevice(RflinkCommand, RestoreEntity):
def async_turn_off(self, **kwargs):
"""Turn the device off."""
return self._async_handle_command("turn_off")
DEPRECATED_CONFIG_OPTIONS = [CONF_ALIASSES, CONF_GROUP_ALIASSES, CONF_NOGROUP_ALIASSES]
REPLACEMENT_CONFIG_OPTIONS = [CONF_ALIASES, CONF_GROUP_ALIASES, CONF_NOGROUP_ALIASES]
def remove_deprecated(config):
"""Remove deprecated config options from device config."""
for index, deprecated_option in enumerate(DEPRECATED_CONFIG_OPTIONS):
if deprecated_option in config:
replacement_option = REPLACEMENT_CONFIG_OPTIONS[index]
# generate deprecation warning
get_deprecated(config, replacement_option, deprecated_option)
# remove old config value replacing new one
config[replacement_option] = config.pop(deprecated_option)