Ignore Sonos players with unknown hostnames (#11013)

This commit is contained in:
Anders Melchiorsen 2017-12-08 12:01:10 +01:00 committed by Pascal Vizeli
parent f892c3394b
commit 0a7e6ac222

View File

@ -140,7 +140,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
hosts = hosts.split(',') if isinstance(hosts, str) else hosts
players = []
for host in hosts:
try:
players.append(soco.SoCo(socket.gethostbyname(host)))
except OSError:
_LOGGER.warning("Failed to initialize '%s'", host)
if not players:
players = soco.discover(