mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Set configuration url to overseerr instance (#136085)
This commit is contained in:
parent
29b7d5c2e4
commit
3630c8b8ed
@ -4,6 +4,7 @@ from datetime import timedelta
|
|||||||
|
|
||||||
from python_overseerr import OverseerrClient, RequestCount
|
from python_overseerr import OverseerrClient, RequestCount
|
||||||
from python_overseerr.exceptions import OverseerrConnectionError
|
from python_overseerr.exceptions import OverseerrConnectionError
|
||||||
|
from yarl import URL
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT, CONF_SSL
|
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT, CONF_SSL
|
||||||
@ -30,13 +31,17 @@ class OverseerrCoordinator(DataUpdateCoordinator[RequestCount]):
|
|||||||
config_entry=entry,
|
config_entry=entry,
|
||||||
update_interval=timedelta(minutes=5),
|
update_interval=timedelta(minutes=5),
|
||||||
)
|
)
|
||||||
|
host = entry.data[CONF_HOST]
|
||||||
|
port = entry.data[CONF_PORT]
|
||||||
|
ssl = entry.data[CONF_SSL]
|
||||||
self.client = OverseerrClient(
|
self.client = OverseerrClient(
|
||||||
entry.data[CONF_HOST],
|
host,
|
||||||
entry.data[CONF_PORT],
|
port,
|
||||||
entry.data[CONF_API_KEY],
|
entry.data[CONF_API_KEY],
|
||||||
ssl=entry.data[CONF_SSL],
|
ssl=ssl,
|
||||||
session=async_get_clientsession(hass),
|
session=async_get_clientsession(hass),
|
||||||
)
|
)
|
||||||
|
self.url = URL.build(host=host, port=port, scheme="https" if ssl else "http")
|
||||||
|
|
||||||
async def _async_update_data(self) -> RequestCount:
|
async def _async_update_data(self) -> RequestCount:
|
||||||
"""Fetch data from API endpoint."""
|
"""Fetch data from API endpoint."""
|
||||||
|
@ -18,5 +18,6 @@ class OverseerrEntity(CoordinatorEntity[OverseerrCoordinator]):
|
|||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(DOMAIN, coordinator.config_entry.entry_id)},
|
identifiers={(DOMAIN, coordinator.config_entry.entry_id)},
|
||||||
entry_type=DeviceEntryType.SERVICE,
|
entry_type=DeviceEntryType.SERVICE,
|
||||||
|
configuration_url=coordinator.url,
|
||||||
)
|
)
|
||||||
self._attr_unique_id = f"{coordinator.config_entry.entry_id}-{key}"
|
self._attr_unique_id = f"{coordinator.config_entry.entry_id}-{key}"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
DeviceRegistryEntrySnapshot({
|
DeviceRegistryEntrySnapshot({
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
'config_entries': <ANY>,
|
'config_entries': <ANY>,
|
||||||
'configuration_url': None,
|
'configuration_url': 'http://overseerr.test',
|
||||||
'connections': set({
|
'connections': set({
|
||||||
}),
|
}),
|
||||||
'disabled_by': None,
|
'disabled_by': None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user