async def validate_input(data: dict[str, Any]) -> dict[str, str]: """Validate the user input allows us to connect.""" _LOGGER.debug("Attempting to connect to %s", data[CONF_HOST]) spa = BalboaSpaWifi(data[CONF_HOST]) connected = await spa.connect() _LOGGER.debug("Got connected = %d", connected) if not connected: raise CannotConnect task = asyncio.create_task(spa.listen()) await spa.spa_configured() mac_addr = format_mac(spa.get_macaddr()) model = spa.get_model_name() task.cancel() await spa.disconnect() return {"title": model, "formatted_mac": mac_addr}
async def validate_input(hass: core.HomeAssistant, data): """Validate the user input allows us to connect.""" _LOGGER.debug("Attempting to connect to %s", data[CONF_HOST]) spa = BalboaSpaWifi(data[CONF_HOST]) connected = await spa.connect() _LOGGER.debug("Got connected = %d", connected) if not connected: raise CannotConnect # send config requests, and then listen until we are configured. await spa.send_mod_ident_req() await spa.send_panel_req(0, 1) asyncio.create_task(spa.listen()) await spa.spa_configured() mac_addr = format_mac(spa.get_macaddr()) model = spa.get_model_name() await spa.disconnect() return {"title": model, "formatted_mac": mac_addr}