mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Merge pull request #686 from balloob/sonos-fix
Have Sonos work nicer with discovery
This commit is contained in:
commit
587ef04560
@ -39,9 +39,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
""" Sets up the Sonos platform. """
|
""" Sets up the Sonos platform. """
|
||||||
import soco
|
import soco
|
||||||
|
|
||||||
|
if discovery_info:
|
||||||
|
add_devices([SonosDevice(hass, soco.SoCo(discovery_info))])
|
||||||
|
return True
|
||||||
|
|
||||||
players = soco.discover()
|
players = soco.discover()
|
||||||
|
|
||||||
if not players:
|
if not players:
|
||||||
_LOGGER.warning('No Sonos speakers found. Disabling: %s', __name__)
|
_LOGGER.warning('No Sonos speakers found.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
add_devices(SonosDevice(hass, p) for p in players)
|
add_devices(SonosDevice(hass, p) for p in players)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user