mirror of
https://github.com/Andre0512/hon.git
synced 2025-05-27 21:24:11 -04:00
Add mypy check, add missing types and fix type issues
This commit is contained in:
parent
f0fb5742a4
commit
9d6b8297b2
19 changed files with 542 additions and 239 deletions
|
@ -1,7 +1,7 @@
|
|||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import voluptuous as vol
|
||||
import voluptuous as vol # type: ignore[import]
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
||||
from homeassistant.helpers import config_validation as cv, aiohttp_client
|
||||
|
@ -25,13 +25,15 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> None:
|
||||
session = aiohttp_client.async_get_clientsession(hass)
|
||||
if (config_dir := hass.config.config_dir) is None:
|
||||
raise ValueError("Missing Config Dir")
|
||||
hon = await Hon(
|
||||
entry.data["email"],
|
||||
entry.data["password"],
|
||||
session=session,
|
||||
test_data_path=Path(hass.config.config_dir),
|
||||
test_data_path=Path(config_dir),
|
||||
).create()
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
hass.data[DOMAIN][entry.unique_id] = hon
|
||||
|
@ -41,10 +43,10 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
|||
hass.async_create_task(
|
||||
hass.config_entries.async_forward_entry_setup(entry, platform)
|
||||
)
|
||||
return True
|
||||
return
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry: ConfigEntry) -> bool:
|
||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
||||
unload = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
if unload:
|
||||
if not hass.data[DOMAIN]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue