Use dict[key] for required config keys (#28304)

* Use dict[key] for required config keys

* Change CONF_NAME too because it has a default
pull/28310/head
Sebastian Muszynski 2019-10-29 01:45:22 +01:00 committed by Teemu R
parent a0f764cf6d
commit 5b96704c4a
7 changed files with 19 additions and 19 deletions

View File

@ -26,8 +26,8 @@ def get_scanner(hass, config):
from miio import WifiRepeater, DeviceException
scanner = None
host = config[DOMAIN].get(CONF_HOST)
token = config[DOMAIN].get(CONF_TOKEN)
host = config[DOMAIN][CONF_HOST]
token = config[DOMAIN][CONF_TOKEN]
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])

View File

@ -434,9 +434,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config.get(CONF_HOST)
name = config.get(CONF_NAME)
token = config.get(CONF_TOKEN)
host = config[CONF_HOST]
token = config[CONF_TOKEN]
name = config[CONF_NAME]
model = config.get(CONF_MODEL)
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])

View File

@ -121,9 +121,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config.get(CONF_HOST)
name = config.get(CONF_NAME)
token = config.get(CONF_TOKEN)
host = config[CONF_HOST]
token = config[CONF_TOKEN]
name = config[CONF_NAME]
model = config.get(CONF_MODEL)
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])

View File

@ -75,8 +75,8 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
"""Set up the Xiaomi IR Remote (Chuangmi IR) platform."""
from miio import ChuangmiIr, DeviceException
host = config.get(CONF_HOST)
token = config.get(CONF_TOKEN)
host = config[CONF_HOST]
token = config[CONF_TOKEN]
# Create handler
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])

View File

@ -42,9 +42,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config.get(CONF_HOST)
name = config.get(CONF_NAME)
token = config.get(CONF_TOKEN)
host = config[CONF_HOST]
token = config[CONF_TOKEN]
name = config[CONF_NAME]
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])

View File

@ -107,9 +107,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config.get(CONF_HOST)
name = config.get(CONF_NAME)
token = config.get(CONF_TOKEN)
host = config[CONF_HOST]
token = config[CONF_TOKEN]
name = config[CONF_NAME]
model = config.get(CONF_MODEL)
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])

View File

@ -182,9 +182,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config.get(CONF_HOST)
name = config.get(CONF_NAME)
token = config.get(CONF_TOKEN)
host = config[CONF_HOST]
token = config[CONF_TOKEN]
name = config[CONF_NAME]
# Create handler
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])