core/homeassistant/components/ozw/config_flow.py

25 lines
815 B
Python
Raw Normal View History

2020-05-14 20:56:04 +00:00
"""Config flow for ozw integration."""
2020-05-03 00:54:16 +00:00
from homeassistant import config_entries
from .const import DOMAIN # pylint:disable=unused-import
2020-05-14 20:56:04 +00:00
TITLE = "OpenZWave"
2020-05-03 00:54:16 +00:00
class DomainConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
2020-05-14 20:56:04 +00:00
"""Handle a config flow for ozw."""
2020-05-03 00:54:16 +00:00
VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
async def async_step_user(self, user_input=None):
"""Handle the initial step."""
if self._async_current_entries():
return self.async_abort(reason="one_instance_allowed")
if "mqtt" not in self.hass.config.components:
return self.async_abort(reason="mqtt_required")
if user_input is not None:
return self.async_create_entry(title=TITLE, data={})
return self.async_show_form(step_id="user")