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
|
from miio import WifiRepeater, DeviceException
|
||||||
|
|
||||||
scanner = None
|
scanner = None
|
||||||
host = config[DOMAIN].get(CONF_HOST)
|
host = config[DOMAIN][CONF_HOST]
|
||||||
token = config[DOMAIN].get(CONF_TOKEN)
|
token = config[DOMAIN][CONF_TOKEN]
|
||||||
|
|
||||||
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
_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:
|
if DATA_KEY not in hass.data:
|
||||||
hass.data[DATA_KEY] = {}
|
hass.data[DATA_KEY] = {}
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config[CONF_HOST]
|
||||||
name = config.get(CONF_NAME)
|
token = config[CONF_TOKEN]
|
||||||
token = config.get(CONF_TOKEN)
|
name = config[CONF_NAME]
|
||||||
model = config.get(CONF_MODEL)
|
model = config.get(CONF_MODEL)
|
||||||
|
|
||||||
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
_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:
|
if DATA_KEY not in hass.data:
|
||||||
hass.data[DATA_KEY] = {}
|
hass.data[DATA_KEY] = {}
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config[CONF_HOST]
|
||||||
name = config.get(CONF_NAME)
|
token = config[CONF_TOKEN]
|
||||||
token = config.get(CONF_TOKEN)
|
name = config[CONF_NAME]
|
||||||
model = config.get(CONF_MODEL)
|
model = config.get(CONF_MODEL)
|
||||||
|
|
||||||
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
_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."""
|
"""Set up the Xiaomi IR Remote (Chuangmi IR) platform."""
|
||||||
from miio import ChuangmiIr, DeviceException
|
from miio import ChuangmiIr, DeviceException
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config[CONF_HOST]
|
||||||
token = config.get(CONF_TOKEN)
|
token = config[CONF_TOKEN]
|
||||||
|
|
||||||
# Create handler
|
# Create handler
|
||||||
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
_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:
|
if DATA_KEY not in hass.data:
|
||||||
hass.data[DATA_KEY] = {}
|
hass.data[DATA_KEY] = {}
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config[CONF_HOST]
|
||||||
name = config.get(CONF_NAME)
|
token = config[CONF_TOKEN]
|
||||||
token = config.get(CONF_TOKEN)
|
name = config[CONF_NAME]
|
||||||
|
|
||||||
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
_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:
|
if DATA_KEY not in hass.data:
|
||||||
hass.data[DATA_KEY] = {}
|
hass.data[DATA_KEY] = {}
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config[CONF_HOST]
|
||||||
name = config.get(CONF_NAME)
|
token = config[CONF_TOKEN]
|
||||||
token = config.get(CONF_TOKEN)
|
name = config[CONF_NAME]
|
||||||
model = config.get(CONF_MODEL)
|
model = config.get(CONF_MODEL)
|
||||||
|
|
||||||
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
_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:
|
if DATA_KEY not in hass.data:
|
||||||
hass.data[DATA_KEY] = {}
|
hass.data[DATA_KEY] = {}
|
||||||
|
|
||||||
host = config.get(CONF_HOST)
|
host = config[CONF_HOST]
|
||||||
name = config.get(CONF_NAME)
|
token = config[CONF_TOKEN]
|
||||||
token = config.get(CONF_TOKEN)
|
name = config[CONF_NAME]
|
||||||
|
|
||||||
# Create handler
|
# Create handler
|
||||||
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])
|
||||||
|
|
Loading…
Reference in New Issue