Remove unnecessary gethostbyname() from Shelly integration (#46483)

This commit is contained in:
Maciej Bieniek 2021-02-13 12:27:54 +01:00 committed by GitHub
parent 820a260252
commit b8584cab5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View File

@ -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,

View File

@ -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)