async def async_step_auth(self, user_input=None): """Handle a flow start.""" errors = {} description_placeholders = {"error_info": ""} data_schema = vol.Schema({ vol.Required(CONF_URL): str, vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str, }) if user_input is not None and CONF_URL in user_input: # test the connection try: fibaro_client = FibaroClient( user_input[CONF_URL], user_input[CONF_USERNAME], user_input[CONF_PASSWORD], ) login = fibaro_client.login.get() info = fibaro_client.info.get() return self.async_create_entry(title="Fibaro Hub", data=user_input) except Exception as e: errors = {CONF_URL: "auth_error"} description_placeholders = { "error_info": "Can not connect to Fibaro HC. Fibaro info: " + str(e) } return self.async_show_form( step_id="auth", errors=errors, description_placeholders=description_placeholders, data_schema=data_schema, )
def __init__(self, config): """Initialize the Fibaro controller.""" self._client = FibaroClient(config[CONF_URL], config[CONF_USERNAME], config[CONF_PASSWORD]) self._scene_map = None # Whether to import devices from plugins self._import_plugins = config[CONF_IMPORT_PLUGINS] self._room_map = None # Mapping roomId to room object self._device_map = None # Mapping deviceId to device object self.fibaro_devices = None # List of devices by type self._callbacks = {} # Update value callbacks by deviceId self._state_handler = None # Fiblary's StateHandler object self.hub_serial = None # Unique serial number of the hub self.name = None # The friendly name of the hub
def __init__(self, username, password, url, import_plugins, config): """Initialize the Fibaro controller.""" from fiblary3.client.v4.client import Client as FibaroClient self._client = FibaroClient(url, username, password) self._scene_map = None # Whether to import devices from plugins self._import_plugins = import_plugins self._device_config = config[CONF_DEVICE_CONFIG] self._room_map = None # Mapping roomId to room object self._device_map = None # Mapping deviceId to device object self.fibaro_devices = None # List of devices by type self._callbacks = {} # Update value callbacks by deviceId self._state_handler = None # Fiblary's StateHandler object self._excluded_devices = config.get(CONF_EXCLUDE, []) self.hub_serial = None # Unique serial number of the hub
def __init__(self, username, password, url, import_plugins): """Initialize the Fibaro controller.""" from fiblary3.client.v4.client import Client as FibaroClient self._client = FibaroClient(url, username, password)
def __init__(self, username, password, url, import_plugins): """Initialize the Fibaro controller.""" from fiblary3.client.v4.client import Client as FibaroClient self._client = FibaroClient(url, username, password) self._scene_map = None self.hub_serial = None # Unique serial number of the hub