Bump aioshelly library to 0.3.0 (#39716)

This commit is contained in:
Maciej Bieniek 2020-09-06 17:34:51 +02:00 committed by GitHub
parent af47a94e70
commit f29154011e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 9 deletions

View File

@ -37,13 +37,18 @@ async def async_setup(hass: HomeAssistant, config: dict):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Shelly from a config entry."""
temperature_unit = "C" if hass.config.units.is_metric else "F"
options = aioshelly.ConnectionOptions(
entry.data[CONF_HOST],
entry.data.get(CONF_USERNAME),
entry.data.get(CONF_PASSWORD),
temperature_unit,
)
try:
async with async_timeout.timeout(5):
device = await aioshelly.Device.create(
entry.data[CONF_HOST],
aiohttp_client.async_get_clientsession(hass),
entry.data.get(CONF_USERNAME),
entry.data.get(CONF_PASSWORD),
options,
)
except (asyncio.TimeoutError, OSError) as err:
raise ConfigEntryNotReady from err

View File

@ -25,12 +25,13 @@ async def validate_input(hass: core.HomeAssistant, host, data):
Data has the keys from DATA_SCHEMA with values provided by the user.
"""
options = aioshelly.ConnectionOptions(
host, data.get(CONF_USERNAME), data.get(CONF_PASSWORD)
)
async with async_timeout.timeout(5):
device = await aioshelly.Device.create(
host,
aiohttp_client.async_get_clientsession(hass),
data.get(CONF_USERNAME),
data.get(CONF_PASSWORD),
options,
)
await device.shutdown()

View File

@ -3,7 +3,7 @@
"name": "Shelly",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/shelly2",
"requirements": ["aioshelly==0.2.1"],
"requirements": ["aioshelly==0.3.0"],
"zeroconf": ["_http._tcp.local."],
"codeowners": ["@balloob", "@bieniu"]
}

View File

@ -221,7 +221,7 @@ aiopvpc==2.0.2
aiopylgtv==0.3.3
# homeassistant.components.shelly
aioshelly==0.2.1
aioshelly==0.3.0
# homeassistant.components.switcher_kis
aioswitcher==1.2.1

View File

@ -131,7 +131,7 @@ aiopvpc==2.0.2
aiopylgtv==0.3.3
# homeassistant.components.shelly
aioshelly==0.2.1
aioshelly==0.3.0
# homeassistant.components.switcher_kis
aioswitcher==1.2.1