2020-07-13 21:24:28 +00:00
|
|
|
"""Config flow for RFXCOM RFXtrx integration."""
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from homeassistant import config_entries
|
|
|
|
|
|
|
|
from . import DOMAIN
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|
|
|
"""Handle a config flow for RFXCOM RFXtrx."""
|
|
|
|
|
|
|
|
VERSION = 1
|
|
|
|
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
|
|
|
|
|
|
|
|
async def async_step_import(self, import_config=None):
|
|
|
|
"""Handle the initial step."""
|
2020-07-25 17:13:10 +00:00
|
|
|
entry = await self.async_set_unique_id(DOMAIN)
|
|
|
|
if entry and import_config.items() != entry.data.items():
|
|
|
|
self.hass.config_entries.async_update_entry(entry, data=import_config)
|
|
|
|
return self.async_abort(reason="already_configured")
|
2020-09-19 11:08:14 +00:00
|
|
|
self._abort_if_unique_id_configured()
|
2020-07-13 21:24:28 +00:00
|
|
|
return self.async_create_entry(title="RFXTRX", data=import_config)
|