# Path: custom_components/senseme/const.py
# CONF_HOST_MANUAL = "IP Address"
# 
# CONF_INFO = "info"
# 
# DOMAIN = "senseme"


import ipaddress
import voluptuous as vol
from aiosenseme import async_get_device_by_ip_address, discover_all
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from .const import CONF_HOST_MANUAL, CONF_INFO, DOMAIN
                errors[CONF_HOST] = "invalid_host"
            else:
                device = await async_get_device_by_ip_address(host)
                if device is not None:
                    return await self._async_entry_for_device(device)

                errors[CONF_HOST] = "cannot_connect"

        return self.async_show_form(
            step_id="manual",
            data_schema=vol.Schema({vol.Required(CONF_HOST): str}),
            errors=errors,
        )

    async def async_step_user(self, user_input=None):
        """Handle a flow initialized by the user."""
        # start discovery the first time through
        if self._discovered_devices is None:
            self._discovered_devices = await discover_all(DISCOVER_TIMEOUT)

        current_ids = self._async_current_ids()
        device_selection = [
            device.name
            for device in self._discovered_devices
            if device.uuid not in current_ids
        ]

        if not device_selection:
            return await self.async_step_manual(user_input=None)


# Path: custom_components/senseme/const.py
# CONF_HOST_MANUAL = "IP Address"
# 
# CONF_INFO = "info"
# 
# DOMAIN = "senseme"


# Path: custom_components/senseme/config_flow.py
import ipaddress
import voluptuous as vol
from aiosenseme import async_get_device_by_ip_address, discover_all
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from .const import CONF_HOST_MANUAL, CONF_INFO, DOMAIN

                errors[CONF_HOST] = "invalid_host"
            else:
                device = await async_get_device_by_ip_address(host)
                if device is not None:
                    return await self._async_entry_for_device(device)

                errors[CONF_HOST] = "cannot_connect"

        return self.async_show_form(
            step_id="manual",
            data_schema=vol.Schema({vol.Required(CONF_HOST): str}),
            errors=errors,
        )

    async def async_step_user(self, user_input=None):
        """Handle a flow initialized by the user."""
        # start discovery the first time through
        if self._discovered_devices is None:
            self._discovered_devices = await discover_all(DISCOVER_TIMEOUT)

        current_ids = self._async_current_ids()
        device_selection = [
            device.name
            for device in self._discovered_devices
            if device.uuid not in current_ids
        ]

        if not device_selection:
            return await self.async_step_manual(user_input=None)


        device_selection.append(CONF_HOST_MANUAL)