diff --git a/homeassistant/components/shelly/__init__.py b/homeassistant/components/shelly/__init__.py index 537caf9707f..d4423dc3a88 100644 --- a/homeassistant/components/shelly/__init__.py +++ b/homeassistant/components/shelly/__init__.py @@ -2,7 +2,6 @@ import asyncio from datetime import timedelta import logging -from socket import gethostbyname import aioshelly import async_timeout @@ -57,10 +56,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): temperature_unit = "C" if hass.config.units.is_metric else "F" - ip_address = await hass.async_add_executor_job(gethostbyname, entry.data[CONF_HOST]) - options = aioshelly.ConnectionOptions( - ip_address, + entry.data[CONF_HOST], entry.data.get(CONF_USERNAME), entry.data.get(CONF_PASSWORD), temperature_unit, diff --git a/homeassistant/components/shelly/config_flow.py b/homeassistant/components/shelly/config_flow.py index 026021a992f..b3a9b068ac4 100644 --- a/homeassistant/components/shelly/config_flow.py +++ b/homeassistant/components/shelly/config_flow.py @@ -1,7 +1,6 @@ """Config flow for Shelly integration.""" import asyncio import logging -from socket import gethostbyname import aiohttp import aioshelly @@ -33,10 +32,9 @@ async def validate_input(hass: core.HomeAssistant, host, data): Data has the keys from DATA_SCHEMA with values provided by the user. """ - ip_address = await hass.async_add_executor_job(gethostbyname, host) options = aioshelly.ConnectionOptions( - ip_address, data.get(CONF_USERNAME), data.get(CONF_PASSWORD) + host, data.get(CONF_USERNAME), data.get(CONF_PASSWORD) ) coap_context = await get_coap_context(hass)