1 """Support for Cisco Mobility Express."""
3 from __future__
import annotations
7 from ciscomobilityexpress.ciscome
import CiscoMobilityExpress
8 import voluptuous
as vol
11 DOMAIN
as DEVICE_TRACKER_DOMAIN,
12 PLATFORM_SCHEMA
as DEVICE_TRACKER_PLATFORM_SCHEMA,
26 _LOGGER = logging.getLogger(__name__)
29 DEFAULT_VERIFY_SSL =
True
31 PLATFORM_SCHEMA = DEVICE_TRACKER_PLATFORM_SCHEMA.extend(
33 vol.Required(CONF_HOST): cv.string,
34 vol.Required(CONF_USERNAME): cv.string,
35 vol.Required(CONF_PASSWORD): cv.string,
36 vol.Optional(CONF_SSL, default=DEFAULT_SSL): cv.boolean,
37 vol.Optional(CONF_VERIFY_SSL, default=DEFAULT_VERIFY_SSL): cv.boolean,
42 def get_scanner(hass: HomeAssistant, config: ConfigType) -> CiscoMEDeviceScanner |
None:
43 """Validate the configuration and return a Cisco ME scanner."""
45 config = config[DEVICE_TRACKER_DOMAIN]
47 controller = CiscoMobilityExpress(
49 config[CONF_USERNAME],
50 config[CONF_PASSWORD],
52 config[CONF_VERIFY_SSL],
54 if not controller.is_logged_in():
60 """Scanner for devices associated to a Cisco ME controller."""
63 """Initialize the scanner."""
68 """Scan for new devices and return a list with found device IDs."""
71 return [device.macaddr
for device
in self.
last_resultslast_results]
74 """Return the name of the given device or None if we don't know."""
76 (result.clId
for result
in self.
last_resultslast_results
if result.macaddr == device),
81 """Get extra attributes of a device.
83 Some known extra attributes that may be returned in the device tuple
84 include SSID, PT (eg 802.11ac), devtype (eg iPhone 7) among others.
87 (result
for result
in self.
last_resultslast_results
if result.macaddr == device),
None
89 return device._asdict()
92 """Check the Cisco ME controller for devices."""
95 "Cisco Mobility Express controller returned: %s", self.
last_resultslast_results
def get_extra_attributes(self, device)
def get_device_name(self, device)
def __init__(self, controller)
CiscoMEDeviceScanner|None get_scanner(HomeAssistant hass, ConfigType config)