mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Remove unnecessary gethostbyname() from Shelly integration (#46483)
This commit is contained in:
parent
820a260252
commit
b8584cab5d
@ -2,7 +2,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from socket import gethostbyname
|
|
||||||
|
|
||||||
import aioshelly
|
import aioshelly
|
||||||
import async_timeout
|
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"
|
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(
|
options = aioshelly.ConnectionOptions(
|
||||||
ip_address,
|
entry.data[CONF_HOST],
|
||||||
entry.data.get(CONF_USERNAME),
|
entry.data.get(CONF_USERNAME),
|
||||||
entry.data.get(CONF_PASSWORD),
|
entry.data.get(CONF_PASSWORD),
|
||||||
temperature_unit,
|
temperature_unit,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Config flow for Shelly integration."""
|
"""Config flow for Shelly integration."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from socket import gethostbyname
|
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import aioshelly
|
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.
|
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(
|
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)
|
coap_context = await get_coap_context(hass)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user