New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plex mark devices unavailable if they 'vanish' and clear media #12811
Conversation
@@ -407,6 +414,11 @@ def _set_media_image(self): | |||
|
|||
self._media_image_url = thumb_url | |||
|
|||
def set_availability(self,available): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
@@ -259,6 +265,7 @@ def __init__(self, config, device, session, plex_sessions, | |||
"""Initialize the Plex device.""" | |||
self._app_name = '' | |||
self._device = None | |||
self._is_device_available = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use self._available
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -189,6 +192,9 @@ def update_devices(): | |||
if new_plex_clients: | |||
add_devices_callback(new_plex_clients) | |||
|
|||
for cid in hass.data[PLEX_DATA].keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this could be moved.
@@ -154,11 +154,14 @@ def update_devices(): | |||
return | |||
|
|||
new_plex_clients = [] | |||
available_ids = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer available_client_ids
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would make more sense
Did you see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove all your code 😉 and use _is_player_available
as identifier for def available
. There is a bug somewhere. Please don't implement duplicated logic.
@syssi Removing all my code and using player available results in player IDLE not unavailable. |
Renamed '_is_device_available' to '_available' Renamed 'available_ids' to 'available_client_ids'
@@ -185,6 +188,9 @@ def update_devices(): | |||
# force devices to idle that do not have a valid session | |||
if client.session is None: | |||
client.force_idle() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
* Marks Devices unavailable if they 'vanish' and clears media * Fixed PEP8 complaint * Fixed Linting * Lint Fix * Fix redine of id * More lint fixes * Removed redundant loop for setting availability of client Renamed '_is_device_available' to '_available' Renamed 'available_ids' to 'available_client_ids' * removed whitespace per houndCI
Partial Fix for:
#10074
if a client vanishes it will persist in UI however it is marked Unavailable and media images are cleared