Add Plex debug logging (#28665)

pull/28674/head
jjlawren 2019-11-09 17:02:56 -06:00 committed by GitHub
parent 25f0b70966
commit ef687a36ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 1 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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]

View File

@ -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),