From 9111fb60d7d39cd103013467cb887c5786e292a5 Mon Sep 17 00:00:00 2001 From: jjlawren Date: Wed, 28 Jul 2021 12:19:09 -0500 Subject: [PATCH] Include advertise_addr in Sonos logs when used (#53617) --- homeassistant/components/sonos/entity.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sonos/entity.py b/homeassistant/components/sonos/entity.py index b670ab96f2f..dadec82a939 100644 --- a/homeassistant/components/sonos/entity.py +++ b/homeassistant/components/sonos/entity.py @@ -4,6 +4,7 @@ from __future__ import annotations import datetime import logging +import soco.config as soco_config from soco.core import SoCo from soco.exceptions import SoCoException @@ -65,10 +66,14 @@ class SonosEntity(Entity): async def async_poll(self, now: datetime.datetime) -> None: """Poll the entity if subscriptions fail.""" if not self.speaker.subscriptions_failed: + if soco_config.EVENT_ADVERTISE_IP: + listener_msg = f"{self.speaker.subscription_address} (advertising as {soco_config.EVENT_ADVERTISE_IP})" + else: + listener_msg = self.speaker.subscription_address _LOGGER.warning( - "%s cannot reach [%s], falling back to polling, functionality may be limited", + "%s cannot reach %s, falling back to polling, functionality may be limited", self.speaker.zone_name, - self.speaker.subscription_address, + listener_msg, ) self.speaker.subscriptions_failed = True await self.speaker.async_unsubscribe()