Add device_tracker scanners to hass.config.components (#49063)

This commit is contained in:
Joakim Sørensen 2021-04-12 01:54:43 +02:00 committed by GitHub
parent 1145856c45
commit 9585defca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -250,21 +250,19 @@ class DeviceTrackerPlatform:
else:
raise HomeAssistantError("Invalid legacy device_tracker platform.")
if setup:
hass.config.components.add(full_name)
if scanner:
async_setup_scanner_platform(
hass, self.config, scanner, tracker.async_see, self.type
)
return
if not setup:
if not setup and not scanner:
LOGGER.error(
"Error setting up platform %s %s", self.type, self.name
)
return
hass.config.components.add(full_name)
except Exception: # pylint: disable=broad-except
LOGGER.exception(
"Error setting up platform %s %s", self.type, self.name