Merge UniFi device tracker to config entry (#24367)
* Move device tracker to use config entry * Remove monitored conditions attributes based on ADR0003 * Add support for import of device tracker config to be backwards compatible * Remove unnecessary configuration options from device tracker * Add component configuration support
This commit is contained in:
1 parent
3480e6229a
commit
01b890f426
11 files changed
+493
-449
No files matched your search
@@ -1,13 +1,41 @@
|
||||
"""Support for devices connected to UniFi POE."""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
|
||||
from .const import CONF_CONTROLLER, CONF_SITE_ID, CONTROLLER_ID, DOMAIN
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import (
|
||||
CONF_CONTROLLER, CONF_DETECTION_TIME, CONF_SITE_ID, CONF_SSID_FILTER,
|
||||
CONTROLLER_ID, DOMAIN, UNIFI_CONFIG)
|
||||
from .controller import UniFiController
|
||||
|
||||
CONF_CONTROLLERS = 'controllers'
|
||||
|
||||
CONTROLLER_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Required(CONF_SITE_ID): cv.string,
|
||||
vol.Optional(CONF_DETECTION_TIME): vol.All(
|
||||
cv.time_period, cv.positive_timedelta),
|
||||
vol.Optional(CONF_SSID_FILTER): vol.All(cv.ensure_list, [cv.string])
|
||||
})
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
DOMAIN: vol.Schema({
|
||||
vol.Required(CONF_CONTROLLERS):
|
||||
vol.All(cv.ensure_list, [CONTROLLER_SCHEMA]),
|
||||
}),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Component doesn't support configuration through configuration.yaml."""
|
||||
hass.data[UNIFI_CONFIG] = []
|
||||
|
||||
if DOMAIN in config:
|
||||
hass.data[UNIFI_CONFIG] = config[DOMAIN][CONF_CONTROLLERS]
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user