Set configuration url to overseerr instance (#136085)

This commit is contained in:
Joost Lekkerkerker 2025-01-20 16:25:06 +01:00 committed by GitHub
parent 29b7d5c2e4
commit 3630c8b8ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -4,6 +4,7 @@ from datetime import timedelta
from python_overseerr import OverseerrClient, RequestCount
from python_overseerr.exceptions import OverseerrConnectionError
from yarl import URL
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT, CONF_SSL
@ -30,13 +31,17 @@ class OverseerrCoordinator(DataUpdateCoordinator[RequestCount]):
config_entry=entry,
update_interval=timedelta(minutes=5),
)
host = entry.data[CONF_HOST]
port = entry.data[CONF_PORT]
ssl = entry.data[CONF_SSL]
self.client = OverseerrClient(
entry.data[CONF_HOST],
entry.data[CONF_PORT],
host,
port,
entry.data[CONF_API_KEY],
ssl=entry.data[CONF_SSL],
ssl=ssl,
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:
"""Fetch data from API endpoint."""

View File

@ -18,5 +18,6 @@ class OverseerrEntity(CoordinatorEntity[OverseerrCoordinator]):
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, coordinator.config_entry.entry_id)},
entry_type=DeviceEntryType.SERVICE,
configuration_url=coordinator.url,
)
self._attr_unique_id = f"{coordinator.config_entry.entry_id}-{key}"

View File

@ -3,7 +3,7 @@
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'configuration_url': 'http://overseerr.test',
'connections': set({
}),
'disabled_by': None,