Bump plexwebsocket to 0.0.13 (#48330)

This commit is contained in:
jjlawren 2021-03-25 13:12:12 -05:00 committed by GitHub
parent ec1334099e
commit e42ca35c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 14 deletions

View File

@ -7,7 +7,6 @@ import plexapi.exceptions
from plexapi.gdm import GDM
from plexwebsocket import (
SIGNAL_CONNECTION_STATE,
SIGNAL_DATA,
STATE_CONNECTED,
STATE_DISCONNECTED,
STATE_STOPPED,
@ -158,9 +157,9 @@ async def async_setup_entry(hass, entry):
hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub)
@callback
def plex_websocket_callback(signal, data, error):
def plex_websocket_callback(msgtype, data, error):
"""Handle callbacks from plexwebsocket library."""
if signal == SIGNAL_CONNECTION_STATE:
if msgtype == SIGNAL_CONNECTION_STATE:
if data == STATE_CONNECTED:
_LOGGER.debug("Websocket to %s successful", entry.data[CONF_SERVER])
@ -178,7 +177,7 @@ async def async_setup_entry(hass, entry):
)
hass.async_create_task(hass.config_entries.async_reload(entry.entry_id))
elif signal == SIGNAL_DATA:
elif msgtype == "playing":
hass.async_create_task(plex_server.async_update_session(data))
session = async_get_clientsession(hass)

View File

@ -6,7 +6,7 @@
"requirements": [
"plexapi==4.5.1",
"plexauth==0.0.6",
"plexwebsocket==0.0.12"
"plexwebsocket==0.0.13"
],
"dependencies": ["http"],
"codeowners": ["@jjlawren"]

View File

@ -257,11 +257,7 @@ class PlexServer:
async def async_update_session(self, payload):
"""Process a session payload received from a websocket callback."""
try:
session_payload = payload["PlaySessionStateNotification"][0]
except KeyError:
await self.async_update_platforms()
return
session_payload = payload["PlaySessionStateNotification"][0]
state = session_payload["state"]
if state == "buffering":

View File

@ -1140,7 +1140,7 @@ plexapi==4.5.1
plexauth==0.0.6
# homeassistant.components.plex
plexwebsocket==0.0.12
plexwebsocket==0.0.13
# homeassistant.components.plugwise
plugwise==0.8.5

View File

@ -586,7 +586,7 @@ plexapi==4.5.1
plexauth==0.0.6
# homeassistant.components.plex
plexwebsocket==0.0.12
plexwebsocket==0.0.13
# homeassistant.components.plugwise
plugwise==0.8.5

View File

@ -1,7 +1,7 @@
"""Helper methods for Plex tests."""
from datetime import timedelta
from plexwebsocket import SIGNAL_CONNECTION_STATE, SIGNAL_DATA, STATE_CONNECTED
from plexwebsocket import SIGNAL_CONNECTION_STATE, STATE_CONNECTED
import homeassistant.util.dt as dt_util
@ -29,7 +29,7 @@ def websocket_connected(mock_websocket):
def trigger_plex_update(mock_websocket, payload=UPDATE_PAYLOAD):
"""Call the websocket callback method with a Plex update."""
callback = mock_websocket.call_args[0][1]
callback(SIGNAL_DATA, payload, None)
callback("playing", payload, None)
async def wait_for_debouncer(hass):