Add configuration_url to AdGuard Home integration (#60356)
This commit is contained in:
parent
db0104c2c9
commit
7613c6fd4c
1 changed files with 10 additions and 1 deletions
|
@ -6,7 +6,7 @@ import logging
|
||||||
from adguardhome import AdGuardHome, AdGuardHomeConnectionError, AdGuardHomeError
|
from adguardhome import AdGuardHome, AdGuardHomeConnectionError, AdGuardHomeError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import SOURCE_HASSIO, ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -197,6 +197,14 @@ class AdGuardHomeDeviceEntity(AdGuardHomeEntity):
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return device information about this AdGuard Home instance."""
|
"""Return device information about this AdGuard Home instance."""
|
||||||
|
if self._entry.source == SOURCE_HASSIO:
|
||||||
|
config_url = "homeassistant://hassio/ingress/a0d7b954_adguard"
|
||||||
|
else:
|
||||||
|
if self.adguard.tls:
|
||||||
|
config_url = f"https://{self.adguard.host}:{self.adguard.port}"
|
||||||
|
else:
|
||||||
|
config_url = f"http://{self.adguard.host}:{self.adguard.port}"
|
||||||
|
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
entry_type=DeviceEntryType.SERVICE,
|
entry_type=DeviceEntryType.SERVICE,
|
||||||
identifiers={
|
identifiers={
|
||||||
|
@ -207,4 +215,5 @@ class AdGuardHomeDeviceEntity(AdGuardHomeEntity):
|
||||||
sw_version=self.hass.data[DOMAIN][self._entry.entry_id].get(
|
sw_version=self.hass.data[DOMAIN][self._entry.entry_id].get(
|
||||||
DATA_ADGUARD_VERSION
|
DATA_ADGUARD_VERSION
|
||||||
),
|
),
|
||||||
|
configuration_url=config_url,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue