From ef687a36ff36de5a115a6be014909469ac372793 Mon Sep 17 00:00:00 2001 From: jjlawren Date: Sat, 9 Nov 2019 17:02:56 -0600 Subject: [PATCH] Add Plex debug logging (#28665) --- homeassistant/components/plex/config_flow.py | 2 +- homeassistant/components/plex/media_player.py | 3 +++ homeassistant/components/plex/sensor.py | 1 + homeassistant/components/plex/server.py | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/plex/config_flow.py b/homeassistant/components/plex/config_flow.py index c03b958b2da..cb79c08b16e 100644 --- a/homeassistant/components/plex/config_flow.py +++ b/homeassistant/components/plex/config_flow.py @@ -102,7 +102,7 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): return await self.async_step_select_server() except Exception as error: # pylint: disable=broad-except - _LOGGER.error("Unknown error connecting to Plex server: %s", error) + _LOGGER.exception("Unknown error connecting to Plex server: %s", error) return self.async_abort(reason="unknown") if errors: diff --git a/homeassistant/components/plex/media_player.py b/homeassistant/components/plex/media_player.py index 4c32c1e6376..1fe83928d29 100644 --- a/homeassistant/components/plex/media_player.py +++ b/homeassistant/components/plex/media_player.py @@ -75,6 +75,7 @@ def _async_add_entities( hass, registry, config_entry, async_add_entities, server_id, new_entities ): """Set up Plex media_player entities.""" + _LOGGER.debug("New entities: %s", new_entities) entities = [] plexserver = hass.data[PLEX_DOMAIN][SERVERS][server_id] for entity_params in new_entities: @@ -142,6 +143,7 @@ class PlexMediaPlayer(MediaPlayerDevice): """Run when about to be added to hass.""" server_id = self.plex_server.machine_identifier + _LOGGER.debug("Added %s [%s]", self.entity_id, self.unique_id) unsub = async_dispatcher_connect( self.hass, PLEX_UPDATE_MEDIA_PLAYER_SIGNAL.format(self.unique_id), @@ -152,6 +154,7 @@ class PlexMediaPlayer(MediaPlayerDevice): @callback def async_refresh_media_player(self, device, session): """Set instance objects and trigger an entity state update.""" + _LOGGER.debug("Refreshing %s [%s / %s]", self.entity_id, device, session) self.device = device self.session = session self.async_schedule_update_ha_state(True) diff --git a/homeassistant/components/plex/sensor.py b/homeassistant/components/plex/sensor.py index 287f0edf39a..2a994b08a7b 100644 --- a/homeassistant/components/plex/sensor.py +++ b/homeassistant/components/plex/sensor.py @@ -93,6 +93,7 @@ class PlexSensor(Entity): def update(self): """Update method for Plex sensor.""" + _LOGGER.debug("Refreshing sensor [%s]", self.unique_id) now_playing = [] for sess in self.sessions: user = sess.usernames[0] diff --git a/homeassistant/components/plex/server.py b/homeassistant/components/plex/server.py index 28380e714ac..5df55589bb4 100644 --- a/homeassistant/components/plex/server.py +++ b/homeassistant/components/plex/server.py @@ -95,6 +95,7 @@ class PlexServer: def refresh_entity(self, machine_identifier, device, session): """Forward refresh dispatch to media_player.""" unique_id = f"{self.machine_identifier}:{machine_identifier}" + _LOGGER.debug("Refreshing %s", unique_id) dispatcher_send( self._hass, PLEX_UPDATE_MEDIA_PLAYER_SIGNAL.format(unique_id),