Migrate CONF_WEBHOOK_ID to homeassistant.const (#17460)

* Migrate CONF_WEBHOOK_ID to homeassistant.const

* Switch over all instances of webhook_id to the const

* Switch last instance of webhook_id to the const

* automation: conf constants for conf

* webhook: conf constants for conf
This commit is contained in:
Rohan Kapoor 2018-10-15 02:18:21 -07:00 committed by Paulus Schoutsen
parent 879924fea4
commit bd450ee9ff
3 changed files with 5 additions and 5 deletions

View File

@ -11,13 +11,12 @@ from aiohttp import hdrs
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import CONF_PLATFORM
from homeassistant.const import CONF_PLATFORM, CONF_WEBHOOK_ID
import homeassistant.helpers.config_validation as cv
DEPENDENCIES = ('webhook',)
_LOGGER = logging.getLogger(__name__)
CONF_WEBHOOK_ID = 'webhook_id'
TRIGGER_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): 'webhook',

View File

@ -14,6 +14,7 @@ import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant import config_entries
from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.util.network import is_local
REQUIREMENTS = ['pyfttt==0.3']
@ -29,7 +30,6 @@ ATTR_VALUE2 = 'value2'
ATTR_VALUE3 = 'value3'
CONF_KEY = 'key'
CONF_WEBHOOK_ID = 'webhook_id'
DOMAIN = 'ifttt'
@ -91,13 +91,13 @@ async def handle_webhook(hass, webhook_id, request):
async def async_setup_entry(hass, entry):
"""Configure based on config entry."""
hass.components.webhook.async_register(
entry.data['webhook_id'], handle_webhook)
entry.data[CONF_WEBHOOK_ID], handle_webhook)
return True
async def async_unload_entry(hass, entry):
"""Unload a config entry."""
hass.components.webhook.async_unregister(entry.data['webhook_id'])
hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID])
return True

View File

@ -146,6 +146,7 @@ CONF_URL = 'url'
CONF_USERNAME = 'username'
CONF_VALUE_TEMPLATE = 'value_template'
CONF_VERIFY_SSL = 'verify_ssl'
CONF_WEBHOOK_ID = 'webhook_id'
CONF_WEEKDAY = 'weekday'
CONF_WHITELIST = 'whitelist'
CONF_WHITELIST_EXTERNAL_DIRS = 'whitelist_external_dirs'