1 """Support for BT Home Hub 5."""
3 from __future__
import annotations
7 import bthomehub5_devicelist
8 import voluptuous
as vol
11 DOMAIN
as DEVICE_TRACKER_DOMAIN,
12 PLATFORM_SCHEMA
as DEVICE_TRACKER_PLATFORM_SCHEMA,
20 _LOGGER = logging.getLogger(__name__)
22 CONF_DEFAULT_IP =
"192.168.1.254"
24 PLATFORM_SCHEMA = DEVICE_TRACKER_PLATFORM_SCHEMA.extend(
25 {vol.Optional(CONF_HOST, default=CONF_DEFAULT_IP): cv.string}
30 hass: HomeAssistant, config: ConfigType
31 ) -> BTHomeHub5DeviceScanner |
None:
32 """Return a BT Home Hub 5 scanner if successful."""
35 return scanner
if scanner.success_init
else None
39 """Class which queries a BT Home Hub 5."""
42 """Initialise the scanner."""
44 self.
hosthost = config[CONF_HOST]
48 data = bthomehub5_devicelist.get_devicelist(self.
hosthost)
52 """Scan for new devices and return a list with found device IDs."""
55 return (device
for device
in self.
last_resultslast_results)
58 """Return the name of the given device or None if we don't know."""
69 """Ensure the information from the BT Home Hub 5 is up to date."""
71 _LOGGER.debug(
"Scanning")
73 data = bthomehub5_devicelist.get_devicelist(self.
hosthost)
76 _LOGGER.warning(
"Error scanning devices")
def get_device_name(self, device)
def __init__(self, config)
BTHomeHub5DeviceScanner|None get_scanner(HomeAssistant hass, ConfigType config)
web.Response get(self, web.Request request, str config_key)