Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions homeassistant/components/plex/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ async def async_refresh_sensor(self, sessions):
_LOGGER.debug("Refreshing sensor [%s]", self.unique_id)

self.sessions = sessions
update_failed = False

@callback
def update_plex(_):
Expand All @@ -71,8 +72,8 @@ def update_plex(_):
_LOGGER.debug(
"Session temporarily incomplete, will try again: %s", sess
)
async_call_later(self.hass, 5, update_plex)
return
update_failed = True
continue
user = sess.usernames[0]
device = sess.players[0].title
now_playing_user = f"{user} - {device}"
Expand Down Expand Up @@ -111,6 +112,9 @@ def update_plex(_):

self.async_write_ha_state()

if update_failed:
async_call_later(self.hass, 5, update_plex)

@property
def name(self):
"""Return the name of the sensor."""
Expand Down