Fix for Sonos debug logging (#25064)

* Fix for Sonos debug logging

* Start logging messages with capital letters
This commit is contained in:
Anders Melchiorsen 2019-07-10 21:19:28 +02:00 committed by Paulus Schoutsen
parent 7d33b0a259
commit 1afa136fc0

View file

@ -77,7 +77,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
hass.data[DATA_SONOS] = SonosData(hass)
config = hass.data[SONOS_DOMAIN].get('media_player', {})
_LOGGER.debug("async_setup_entry, config=%s", config)
_LOGGER.debug("Reached async_setup_entry, config=%s", config)
advertise_addr = config.get(CONF_ADVERTISE_ADDR)
if advertise_addr:
@ -90,22 +90,22 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
def _discovered_player(soco):
"""Handle a (re)discovered player."""
try:
_LOGGER.debug("_discovered_player, soco=%s", soco)
_LOGGER.debug("Reached _discovered_player, soco=%s", soco)
entity = _get_entity_from_soco_uid(hass, soco.uid)
if not entity:
_LOGGER.debug("adding new entity")
_LOGGER.debug("Adding new entity")
hass.add_job(async_add_entities, [SonosEntity(soco)])
else:
_LOGGER.debug("seen %s", entity)
_LOGGER.debug("Seen %s", entity)
hass.add_job(entity.async_seen())
except SoCoException as ex:
_LOGGER.debug("SoCoException, ex=%s")
_LOGGER.debug("SoCoException, ex=%s", ex)
if hosts:
for host in hosts:
try:
_LOGGER.debug("testing %s", host)
_LOGGER.debug("Testing %s", host)
player = pysonos.SoCo(socket.gethostbyname(host))
if player.is_visible:
# Make sure that the player is available
@ -113,20 +113,20 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
_discovered_player(player)
except (OSError, SoCoException) as ex:
_LOGGER.debug("exception %s", ex)
_LOGGER.debug("Exception %s", ex)
if now is None:
_LOGGER.warning("Failed to initialize '%s'", host)
_LOGGER.debug("tested all hosts")
_LOGGER.debug("Tested all hosts")
hass.helpers.event.call_later(DISCOVERY_INTERVAL, _discovery)
else:
_LOGGER.debug("starting discovery thread")
_LOGGER.debug("Starting discovery thread")
pysonos.discover_thread(
_discovered_player,
interval=DISCOVERY_INTERVAL,
interface_addr=config.get(CONF_INTERFACE_ADDR))
_LOGGER.debug("adding discovery job")
_LOGGER.debug("Adding discovery job")
hass.async_add_executor_job(_discovery)
async def async_service_handle(service, data):