Only add visible sonos devices

Some Sonos devices (e.g SUB) does not have
a upnp media renderer, but are discovered as sonos
devices. Creating a SonosDevice object from such a
device will fail.
This commit is contained in:
Jan-Preben Mossin authored and Paulus Schoutsen committed 2016-04-17 16:45:16 -07:00
1 parent b45c0cd735
commit 5931bac695
1 file changed
+5 -2
@@ -39,8 +39,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
import soco
if discovery_info:
add_devices([SonosDevice(hass, soco.SoCo(discovery_info))])
return True
player = soco.SoCo(discovery_info)
if player.is_visible:
add_devices([SonosDevice(hass, player)])
return True
return False
players = None
hosts = config.get('hosts', None)