Cleanup implementation of new Sonos sensors (#49716)

This commit is contained in:
jjlawren 2021-04-26 16:59:04 -05:00 committed by GitHub
parent 9e7d83b2d5
commit dc50524f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 47 deletions

View file

@ -2,14 +2,16 @@
import pysonos
from homeassistant import config_entries
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
async def _async_has_devices(hass):
async def _async_has_devices(hass: HomeAssistant) -> bool:
"""Return if there are devices that can be discovered."""
return await hass.async_add_executor_job(pysonos.discover)
result = await hass.async_add_executor_job(pysonos.discover)
return bool(result)
config_entry_flow.register_discovery_flow(