apply small feedback suggestions from a previous PR that is already merged (#37551)
This commit is contained in:
parent
27ef8a1ced
commit
e5872cc0e4
3 changed files with 3 additions and 6 deletions
|
@ -2,7 +2,6 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from bond import Bond
|
from bond import Bond
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
|
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
|
||||||
|
@ -10,8 +9,6 @@ from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({DOMAIN: vol.Schema({})}, extra=vol.ALLOW_EXTRA)
|
|
||||||
|
|
||||||
PLATFORMS = ["cover"]
|
PLATFORMS = ["cover"]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
try:
|
try:
|
||||||
info = await validate_input(self.hass, user_input)
|
info = await validate_input(self.hass, user_input)
|
||||||
|
|
||||||
return self.async_create_entry(title=info["title"], data=user_input)
|
|
||||||
except CannotConnect:
|
except CannotConnect:
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
except InvalidAuth:
|
except InvalidAuth:
|
||||||
|
@ -60,6 +58,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.exception("Unexpected exception")
|
_LOGGER.exception("Unexpected exception")
|
||||||
errors["base"] = "unknown"
|
errors["base"] = "unknown"
|
||||||
|
else:
|
||||||
|
return self.async_create_entry(title=info["title"], data=user_input)
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
||||||
|
|
|
@ -64,7 +64,7 @@ class BondCover(CoverEntity):
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> Optional[Dict[str, Any]]:
|
def device_info(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Get a an HA device representing this cover."""
|
"""Get a an HA device representing this cover."""
|
||||||
return {ATTR_NAME: self.name, "identifiers": {(DOMAIN, self.unique_id)}}
|
return {ATTR_NAME: self.name, "identifiers": {(DOMAIN, self._device.device_id)}}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self):
|
def is_closed(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue