mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add Plex debug logging (#28665)
This commit is contained in:
parent
25f0b70966
commit
ef687a36ff
@ -102,7 +102,7 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
return await self.async_step_select_server()
|
return await self.async_step_select_server()
|
||||||
|
|
||||||
except Exception as error: # pylint: disable=broad-except
|
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")
|
return self.async_abort(reason="unknown")
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
|
@ -75,6 +75,7 @@ def _async_add_entities(
|
|||||||
hass, registry, config_entry, async_add_entities, server_id, new_entities
|
hass, registry, config_entry, async_add_entities, server_id, new_entities
|
||||||
):
|
):
|
||||||
"""Set up Plex media_player entities."""
|
"""Set up Plex media_player entities."""
|
||||||
|
_LOGGER.debug("New entities: %s", new_entities)
|
||||||
entities = []
|
entities = []
|
||||||
plexserver = hass.data[PLEX_DOMAIN][SERVERS][server_id]
|
plexserver = hass.data[PLEX_DOMAIN][SERVERS][server_id]
|
||||||
for entity_params in new_entities:
|
for entity_params in new_entities:
|
||||||
@ -142,6 +143,7 @@ class PlexMediaPlayer(MediaPlayerDevice):
|
|||||||
"""Run when about to be added to hass."""
|
"""Run when about to be added to hass."""
|
||||||
server_id = self.plex_server.machine_identifier
|
server_id = self.plex_server.machine_identifier
|
||||||
|
|
||||||
|
_LOGGER.debug("Added %s [%s]", self.entity_id, self.unique_id)
|
||||||
unsub = async_dispatcher_connect(
|
unsub = async_dispatcher_connect(
|
||||||
self.hass,
|
self.hass,
|
||||||
PLEX_UPDATE_MEDIA_PLAYER_SIGNAL.format(self.unique_id),
|
PLEX_UPDATE_MEDIA_PLAYER_SIGNAL.format(self.unique_id),
|
||||||
@ -152,6 +154,7 @@ class PlexMediaPlayer(MediaPlayerDevice):
|
|||||||
@callback
|
@callback
|
||||||
def async_refresh_media_player(self, device, session):
|
def async_refresh_media_player(self, device, session):
|
||||||
"""Set instance objects and trigger an entity state update."""
|
"""Set instance objects and trigger an entity state update."""
|
||||||
|
_LOGGER.debug("Refreshing %s [%s / %s]", self.entity_id, device, session)
|
||||||
self.device = device
|
self.device = device
|
||||||
self.session = session
|
self.session = session
|
||||||
self.async_schedule_update_ha_state(True)
|
self.async_schedule_update_ha_state(True)
|
||||||
|
@ -93,6 +93,7 @@ class PlexSensor(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update method for Plex sensor."""
|
"""Update method for Plex sensor."""
|
||||||
|
_LOGGER.debug("Refreshing sensor [%s]", self.unique_id)
|
||||||
now_playing = []
|
now_playing = []
|
||||||
for sess in self.sessions:
|
for sess in self.sessions:
|
||||||
user = sess.usernames[0]
|
user = sess.usernames[0]
|
||||||
|
@ -95,6 +95,7 @@ class PlexServer:
|
|||||||
def refresh_entity(self, machine_identifier, device, session):
|
def refresh_entity(self, machine_identifier, device, session):
|
||||||
"""Forward refresh dispatch to media_player."""
|
"""Forward refresh dispatch to media_player."""
|
||||||
unique_id = f"{self.machine_identifier}:{machine_identifier}"
|
unique_id = f"{self.machine_identifier}:{machine_identifier}"
|
||||||
|
_LOGGER.debug("Refreshing %s", unique_id)
|
||||||
dispatcher_send(
|
dispatcher_send(
|
||||||
self._hass,
|
self._hass,
|
||||||
PLEX_UPDATE_MEDIA_PLAYER_SIGNAL.format(unique_id),
|
PLEX_UPDATE_MEDIA_PLAYER_SIGNAL.format(unique_id),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user