mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Pass aiohttp clientsession to tedee integration (#107089)
* pass aiohttpsession * Update homeassistant/components/tedee/config_flow.py Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * Update homeassistant/components/tedee/__init__.py Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com> * move to coordinator --------- Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
This commit is contained in:
parent
fd3a546cd8
commit
34e6fa3328
@ -13,6 +13,7 @@ import voluptuous as vol
|
|||||||
from homeassistant.config_entries import ConfigEntry, ConfigFlow
|
from homeassistant.config_entries import ConfigEntry, ConfigFlow
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
|
||||||
from .const import CONF_LOCAL_ACCESS_TOKEN, DOMAIN, NAME
|
from .const import CONF_LOCAL_ACCESS_TOKEN, DOMAIN, NAME
|
||||||
|
|
||||||
@ -34,7 +35,11 @@ class TedeeConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
else:
|
else:
|
||||||
host = user_input[CONF_HOST]
|
host = user_input[CONF_HOST]
|
||||||
local_access_token = user_input[CONF_LOCAL_ACCESS_TOKEN]
|
local_access_token = user_input[CONF_LOCAL_ACCESS_TOKEN]
|
||||||
tedee_client = TedeeClient(local_token=local_access_token, local_ip=host)
|
tedee_client = TedeeClient(
|
||||||
|
local_token=local_access_token,
|
||||||
|
local_ip=host,
|
||||||
|
session=async_get_clientsession(self.hass),
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
local_bridge = await tedee_client.get_local_bridge()
|
local_bridge = await tedee_client.get_local_bridge()
|
||||||
except (TedeeAuthException, TedeeLocalAuthException):
|
except (TedeeAuthException, TedeeLocalAuthException):
|
||||||
|
@ -17,6 +17,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||||
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
from .const import CONF_LOCAL_ACCESS_TOKEN, DOMAIN
|
from .const import CONF_LOCAL_ACCESS_TOKEN, DOMAIN
|
||||||
@ -45,6 +46,7 @@ class TedeeApiCoordinator(DataUpdateCoordinator[dict[int, TedeeLock]]):
|
|||||||
self.tedee_client = TedeeClient(
|
self.tedee_client = TedeeClient(
|
||||||
local_token=self.config_entry.data[CONF_LOCAL_ACCESS_TOKEN],
|
local_token=self.config_entry.data[CONF_LOCAL_ACCESS_TOKEN],
|
||||||
local_ip=self.config_entry.data[CONF_HOST],
|
local_ip=self.config_entry.data[CONF_HOST],
|
||||||
|
session=async_get_clientsession(hass),
|
||||||
)
|
)
|
||||||
|
|
||||||
self._next_get_locks = time.time()
|
self._next_get_locks = time.time()
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
"dependencies": ["http"],
|
"dependencies": ["http"],
|
||||||
"documentation": "https://www.home-assistant.io/integrations/tedee",
|
"documentation": "https://www.home-assistant.io/integrations/tedee",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"requirements": ["pytedee-async==0.2.1"]
|
"requirements": ["pytedee-async==0.2.6"]
|
||||||
}
|
}
|
||||||
|
@ -2135,7 +2135,7 @@ pytankerkoenig==0.0.6
|
|||||||
pytautulli==23.1.1
|
pytautulli==23.1.1
|
||||||
|
|
||||||
# homeassistant.components.tedee
|
# homeassistant.components.tedee
|
||||||
pytedee-async==0.2.1
|
pytedee-async==0.2.6
|
||||||
|
|
||||||
# homeassistant.components.tfiac
|
# homeassistant.components.tfiac
|
||||||
pytfiac==0.4
|
pytfiac==0.4
|
||||||
|
@ -1635,7 +1635,7 @@ pytankerkoenig==0.0.6
|
|||||||
pytautulli==23.1.1
|
pytautulli==23.1.1
|
||||||
|
|
||||||
# homeassistant.components.tedee
|
# homeassistant.components.tedee
|
||||||
pytedee-async==0.2.1
|
pytedee-async==0.2.6
|
||||||
|
|
||||||
# homeassistant.components.motionmount
|
# homeassistant.components.motionmount
|
||||||
python-MotionMount==0.3.1
|
python-MotionMount==0.3.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user