Use dict[key] for required config keys (#28304)
* Use dict[key] for required config keys * Change CONF_NAME too because it has a defaultpull/28310/head
parent
a0f764cf6d
commit
5b96704c4a
|
@ -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])
|
||||
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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])
|
||||
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue