PyChromecast 14.0.0__tar.gz → 14.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/PKG-INFO +1 -1
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/PyChromecast.egg-info/PKG-INFO +1 -1
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/const.py +2 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/homeassistant.py +29 -1
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/response_handler.py +4 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pyproject.toml +6 -1
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/LICENSE +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/MANIFEST.in +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/PyChromecast.egg-info/SOURCES.txt +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/PyChromecast.egg-info/dependency_links.txt +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/PyChromecast.egg-info/not-zip-safe +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/PyChromecast.egg-info/requires.txt +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/PyChromecast.egg-info/top_level.txt +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/README.rst +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/__init__.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/config.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/__init__.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/bbciplayer.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/bbcsounds.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/bubbleupnp.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/dashcast.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/homeassistant_media.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/media.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/multizone.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/nrkradio.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/nrktv.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/plex.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/receiver.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/shaka.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/supla.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/yleareena.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/controllers/youtube.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/dial.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/discovery.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/error.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/generated/authority_keys_pb2.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/generated/authority_keys_pb2.pyi +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/generated/cast_channel_pb2.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/generated/cast_channel_pb2.pyi +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/generated/logging_pb2.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/generated/logging_pb2.pyi +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/generated/readme.txt +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/models.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/quick_play.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/pychromecast/socket_client.py +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/requirements.txt +0 -0
- {PyChromecast-14.0.0 → PyChromecast-14.0.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyChromecast
|
|
3
|
-
Version: 14.0.
|
|
3
|
+
Version: 14.0.1
|
|
4
4
|
Summary: Python module to talk to Google Chromecast.
|
|
5
5
|
Author-email: Paulus Schoutsen <paulus@paulusschoutsen.nl>
|
|
6
6
|
Project-URL: Homepage, https://github.com/home-assistant-libs/pychromecast
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyChromecast
|
|
3
|
-
Version: 14.0.
|
|
3
|
+
Version: 14.0.1
|
|
4
4
|
Summary: Python module to talk to Google Chromecast.
|
|
5
5
|
Author-email: Paulus Schoutsen <paulus@paulusschoutsen.nl>
|
|
6
6
|
Project-URL: Homepage, https://github.com/home-assistant-libs/pychromecast
|
|
@@ -14,6 +14,7 @@ REQUEST_TIMEOUT = 10.0
|
|
|
14
14
|
|
|
15
15
|
MF_CANTON = "Canton Elektronik GmbH + Co. KG"
|
|
16
16
|
MF_GOOGLE = "Google Inc."
|
|
17
|
+
MF_HARMAN = "HARMAN International Industries"
|
|
17
18
|
MF_JBL = "JBL"
|
|
18
19
|
MF_LENOVO = "LENOVO"
|
|
19
20
|
MF_LG = "LG"
|
|
@@ -47,6 +48,7 @@ CAST_TYPES = {
|
|
|
47
48
|
"JBL Link 20": (CAST_TYPE_AUDIO, MF_JBL),
|
|
48
49
|
"JBL Link 300": (CAST_TYPE_AUDIO, MF_JBL),
|
|
49
50
|
"JBL Link 500": (CAST_TYPE_AUDIO, MF_JBL),
|
|
51
|
+
"JBL Link Portable": (CAST_TYPE_AUDIO, MF_HARMAN),
|
|
50
52
|
"lenovocd-24502f": (CAST_TYPE_AUDIO, MF_LENOVO),
|
|
51
53
|
"Lenovo Smart Display 7": (CAST_TYPE_CHROMECAST, MF_LENOVO),
|
|
52
54
|
"LG WK7 ThinQ Speaker": (CAST_TYPE_AUDIO, MF_LG),
|
|
@@ -4,6 +4,7 @@ Controller to interface with Home Assistant
|
|
|
4
4
|
|
|
5
5
|
from collections.abc import Callable
|
|
6
6
|
from functools import partial
|
|
7
|
+
import logging
|
|
7
8
|
import threading
|
|
8
9
|
from typing import Any
|
|
9
10
|
|
|
@@ -29,6 +30,8 @@ ERR_WRONG_INSTANCE = 20
|
|
|
29
30
|
ERR_NOT_CONNECTED = 21
|
|
30
31
|
ERR_FETCH_CONFIG_FAILED = 22
|
|
31
32
|
|
|
33
|
+
_LOGGER = logging.getLogger(__name__)
|
|
34
|
+
|
|
32
35
|
|
|
33
36
|
class HomeAssistantController(BaseController):
|
|
34
37
|
"""Controller to interact with Home Assistant."""
|
|
@@ -45,6 +48,7 @@ class HomeAssistantController(BaseController):
|
|
|
45
48
|
app_id: str = APP_HOMEASSISTANT_LOVELACE,
|
|
46
49
|
hass_connect_timeout: float = DEFAULT_HASS_CONNECT_TIMEOUT,
|
|
47
50
|
) -> None:
|
|
51
|
+
_LOGGER.debug("HomeAssistantController.__init__")
|
|
48
52
|
super().__init__(app_namespace, app_id)
|
|
49
53
|
self.hass_url = hass_url
|
|
50
54
|
self.hass_uuid = hass_uuid
|
|
@@ -77,16 +81,19 @@ class HomeAssistantController(BaseController):
|
|
|
77
81
|
def channel_connected(self) -> None:
|
|
78
82
|
"""Called when a channel has been openend that supports the
|
|
79
83
|
namespace of this controller."""
|
|
84
|
+
_LOGGER.debug("HomeAssistantController.channel_connected")
|
|
80
85
|
self.get_status()
|
|
81
86
|
|
|
82
87
|
def channel_disconnected(self) -> None:
|
|
83
88
|
"""Called when a channel is disconnected."""
|
|
89
|
+
_LOGGER.debug("HomeAssistantController.channel_disconnected")
|
|
84
90
|
self.status = None
|
|
85
91
|
self._hass_connecting_event.set()
|
|
86
92
|
|
|
87
93
|
def receive_message(self, _message: CastMessage, data: dict) -> bool:
|
|
88
94
|
"""Called when a message is received."""
|
|
89
95
|
if data.get("type") == "receiver_status":
|
|
96
|
+
_LOGGER.debug("HomeAssistantController.receive_message %s", data)
|
|
90
97
|
if data["hassUrl"] != self.hass_url or data["hassUUID"] != self.hass_uuid:
|
|
91
98
|
self.logger.info("Received status for another instance")
|
|
92
99
|
self.unregister()
|
|
@@ -96,6 +103,9 @@ class HomeAssistantController(BaseController):
|
|
|
96
103
|
self.status = data
|
|
97
104
|
|
|
98
105
|
if was_connected or not self.hass_connected:
|
|
106
|
+
_LOGGER.debug(
|
|
107
|
+
"HomeAssistantController.receive_message already connected"
|
|
108
|
+
)
|
|
99
109
|
return True
|
|
100
110
|
|
|
101
111
|
# We just got connected, call the callbacks.
|
|
@@ -104,6 +114,7 @@ class HomeAssistantController(BaseController):
|
|
|
104
114
|
return True
|
|
105
115
|
|
|
106
116
|
if data.get("type") == "receiver_error":
|
|
117
|
+
_LOGGER.debug("HomeAssistantController.receive_message %s", data)
|
|
107
118
|
if data.get("error_code") == ERR_WRONG_INSTANCE:
|
|
108
119
|
self.logger.info("Received ERR_WRONG_INSTANCE")
|
|
109
120
|
self.unregister()
|
|
@@ -113,14 +124,19 @@ class HomeAssistantController(BaseController):
|
|
|
113
124
|
|
|
114
125
|
def _call_on_connect_callbacks(self, msg_sent: bool) -> None:
|
|
115
126
|
"""Call on connect callbacks."""
|
|
127
|
+
_LOGGER.debug("HomeAssistantController._call_on_connect_callbacks %s", msg_sent)
|
|
116
128
|
while self._on_connect:
|
|
117
129
|
self._on_connect.pop()(msg_sent, None)
|
|
118
130
|
|
|
119
131
|
def _connect_hass(self, callback_function: CallbackType) -> None:
|
|
120
132
|
"""Connect to Home Assistant and call the provided callback."""
|
|
133
|
+
_LOGGER.debug("HomeAssistantController._connect_hass")
|
|
121
134
|
self._on_connect.append(callback_function)
|
|
122
135
|
|
|
123
136
|
if not self._hass_connecting_event.is_set():
|
|
137
|
+
_LOGGER.debug(
|
|
138
|
+
"HomeAssistantController._connect_hass _hass_connecting_event not set"
|
|
139
|
+
)
|
|
124
140
|
return
|
|
125
141
|
|
|
126
142
|
self._hass_connecting_event.clear()
|
|
@@ -135,6 +151,9 @@ class HomeAssistantController(BaseController):
|
|
|
135
151
|
}
|
|
136
152
|
)
|
|
137
153
|
except Exception: # pylint: disable=broad-except
|
|
154
|
+
_LOGGER.debug(
|
|
155
|
+
"HomeAssistantController._connect_hass failed to send connect message"
|
|
156
|
+
)
|
|
138
157
|
self._hass_connecting_event.set()
|
|
139
158
|
self._call_on_connect_callbacks(False)
|
|
140
159
|
raise
|
|
@@ -143,10 +162,10 @@ class HomeAssistantController(BaseController):
|
|
|
143
162
|
try:
|
|
144
163
|
if not self._hass_connecting_event.is_set():
|
|
145
164
|
self.logger.warning("_connect_hass failed for %s", self.hass_url)
|
|
165
|
+
self._call_on_connect_callbacks(False)
|
|
146
166
|
raise PyChromecastError() # pylint: disable=broad-exception-raised
|
|
147
167
|
finally:
|
|
148
168
|
self._hass_connecting_event.set()
|
|
149
|
-
self._call_on_connect_callbacks(False)
|
|
150
169
|
|
|
151
170
|
def show_demo(self) -> None:
|
|
152
171
|
"""Show the demo."""
|
|
@@ -154,6 +173,7 @@ class HomeAssistantController(BaseController):
|
|
|
154
173
|
|
|
155
174
|
def get_status(self, *, callback_function: CallbackType | None = None) -> None:
|
|
156
175
|
"""Get status of Home Assistant Cast."""
|
|
176
|
+
_LOGGER.debug("HomeAssistantController.get_status")
|
|
157
177
|
self._send_connected_message(
|
|
158
178
|
{
|
|
159
179
|
"type": "get_status",
|
|
@@ -171,6 +191,7 @@ class HomeAssistantController(BaseController):
|
|
|
171
191
|
callback_function: CallbackType | None = None,
|
|
172
192
|
) -> None:
|
|
173
193
|
"""Show a Lovelace UI."""
|
|
194
|
+
_LOGGER.debug("HomeAssistantController.show_lovelace_view")
|
|
174
195
|
self._send_connected_message(
|
|
175
196
|
{
|
|
176
197
|
"type": "show_lovelace_view",
|
|
@@ -186,10 +207,17 @@ class HomeAssistantController(BaseController):
|
|
|
186
207
|
self, data: dict[str, Any], callback_function: CallbackType | None
|
|
187
208
|
) -> None:
|
|
188
209
|
"""Send a message to a connected Home Assistant Cast"""
|
|
210
|
+
_LOGGER.debug("HomeAssistantController._send_connected_message %s", data)
|
|
189
211
|
if self.hass_connected:
|
|
212
|
+
_LOGGER.debug(
|
|
213
|
+
"HomeAssistantController._send_connected_message already connected"
|
|
214
|
+
)
|
|
190
215
|
self.send_message_nocheck(data, callback_function=callback_function)
|
|
191
216
|
return
|
|
192
217
|
|
|
218
|
+
_LOGGER.debug(
|
|
219
|
+
"HomeAssistantController._send_connected_message not yet connected"
|
|
220
|
+
)
|
|
193
221
|
self._connect_hass(
|
|
194
222
|
chain_on_success(
|
|
195
223
|
partial(self.send_message_nocheck, data), callback_function
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from collections.abc import Callable
|
|
6
|
+
import logging
|
|
6
7
|
import threading
|
|
7
8
|
from typing import Protocol
|
|
8
9
|
|
|
9
10
|
from .error import RequestFailed, RequestTimeout
|
|
10
11
|
|
|
12
|
+
_LOGGER = logging.getLogger(__name__)
|
|
13
|
+
|
|
11
14
|
CallbackType = Callable[[bool, dict | None], None]
|
|
12
15
|
"""Signature of optional callback functions supported by methods sending messages.
|
|
13
16
|
|
|
@@ -61,6 +64,7 @@ def chain_on_success(
|
|
|
61
64
|
|
|
62
65
|
def _callback(msg_sent: bool, response: dict | None) -> None:
|
|
63
66
|
if not msg_sent:
|
|
67
|
+
_LOGGER.debug("Not calling on_success %s", on_success)
|
|
64
68
|
if callback_function:
|
|
65
69
|
callback_function(msg_sent, response)
|
|
66
70
|
return
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "PyChromecast"
|
|
7
|
-
version = "14.0.
|
|
7
|
+
version = "14.0.1"
|
|
8
8
|
description = "Python module to talk to Google Chromecast."
|
|
9
9
|
readme = "README.rst"
|
|
10
10
|
authors = [
|
|
@@ -31,6 +31,11 @@ classifiers=[
|
|
|
31
31
|
[tool.black]
|
|
32
32
|
exclude = 'pb2'
|
|
33
33
|
|
|
34
|
+
[tool.rstcheck]
|
|
35
|
+
# README.rst has embedded python examples which show the interactive interpreter output
|
|
36
|
+
# that's not valid Python, so we disable the check
|
|
37
|
+
ignore_languages = ["python"]
|
|
38
|
+
|
|
34
39
|
[tool.setuptools]
|
|
35
40
|
platforms = ["any"]
|
|
36
41
|
zip-safe = false
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|