Add support for device configuration URL to UniFi Controller (#58237)

This commit is contained in:
Robert Svensson 2021-10-22 20:04:25 +02:00 committed by GitHub
parent e5255cf21f
commit 9c1bee9c16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -40,6 +40,8 @@ from homeassistant.const import (
CONF_VERIFY_SSL,
CONTENT_TYPE_JSON,
)
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
@ -256,6 +258,14 @@ async def test_controller_mac(hass, aioclient_mock):
controller = hass.data[UNIFI_DOMAIN][config_entry.entry_id]
assert controller.mac == CONTROLLER_HOST["mac"]
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get_or_create(
config_entry_id=config_entry.entry_id,
connections={(CONNECTION_NETWORK_MAC, controller.mac)},
)
assert device_entry.configuration_url == controller.api.url
async def test_controller_not_accessible(hass):
"""Retry to login gets scheduled when connection fails."""