mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Unique IDs for Plex Clients (#12799)
* Unique IDs for Clients * HoundCI cleanup * debug output removal * Updates from feedback * More Updates from feedback * More Updates from feedback * Lint Fixes
This commit is contained in:
parent
53078f3069
commit
a60712d826
@ -6,6 +6,7 @@ https://home-assistant.io/components/media_player.plex/
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -47,9 +48,14 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
cv.boolean,
|
cv.boolean,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
PLEX_DATA = "plex"
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||||
"""Set up the Plex platform."""
|
"""Set up the Plex platform."""
|
||||||
|
if PLEX_DATA not in hass.data:
|
||||||
|
hass.data[PLEX_DATA] = {}
|
||||||
|
|
||||||
# get config from plex.conf
|
# get config from plex.conf
|
||||||
file_config = load_json(hass.config.path(PLEX_CONFIG_FILE))
|
file_config = load_json(hass.config.path(PLEX_CONFIG_FILE))
|
||||||
|
|
||||||
@ -130,7 +136,7 @@ def setup_plexserver(
|
|||||||
|
|
||||||
_LOGGER.info('Connected to: %s://%s', http_prefix, host)
|
_LOGGER.info('Connected to: %s://%s', http_prefix, host)
|
||||||
|
|
||||||
plex_clients = {}
|
plex_clients = hass.data[PLEX_DATA]
|
||||||
plex_sessions = {}
|
plex_sessions = {}
|
||||||
track_utc_time_change(hass, lambda now: update_devices(), second=30)
|
track_utc_time_change(hass, lambda now: update_devices(), second=30)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user