python-roborock 2.41.0__tar.gz → 2.41.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.
- {python_roborock-2.41.0 → python_roborock-2.41.1}/PKG-INFO +1 -1
- {python_roborock-2.41.0 → python_roborock-2.41.1}/pyproject.toml +1 -1
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/v1_channel.py +8 -4
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/v1_rpc_channel.py +13 -14
- {python_roborock-2.41.0 → python_roborock-2.41.1}/LICENSE +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/README.md +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/__init__.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/api.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/b01_containers.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/broadcast_protocol.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/callbacks.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/clean_modes.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/cli.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/cloud_api.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/code_mappings.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/command_cache.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/const.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/containers.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/device_features.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/README.md +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/__init__.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/a01_channel.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/b01_channel.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/cache.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/channel.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/device.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/device_manager.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/local_channel.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/mqtt_channel.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/traits/b01/__init__.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/traits/b01/props.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/traits/dnd.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/traits/dyad.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/traits/status.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/traits/trait.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/devices/traits/zeo.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/exceptions.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/mqtt/__init__.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/mqtt/roborock_session.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/mqtt/session.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/protocol.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/protocols/a01_protocol.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/protocols/b01_protocol.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/protocols/v1_protocol.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/py.typed +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/roborock_future.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/roborock_message.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/roborock_typing.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/util.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_1_apis/__init__.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_1_apis/roborock_client_v1.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_1_apis/roborock_local_client_v1.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_1_apis/roborock_mqtt_client_v1.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_a01_apis/__init__.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_a01_apis/roborock_client_a01.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_a01_apis/roborock_mqtt_client_a01.py +0 -0
- {python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/web_api.py +0 -0
|
@@ -22,7 +22,7 @@ from .cache import Cache
|
|
|
22
22
|
from .channel import Channel
|
|
23
23
|
from .local_channel import LocalChannel, LocalSession, create_local_session
|
|
24
24
|
from .mqtt_channel import MqttChannel
|
|
25
|
-
from .v1_rpc_channel import V1RpcChannel,
|
|
25
|
+
from .v1_rpc_channel import PickFirstAvailable, V1RpcChannel, create_local_rpc_channel, create_mqtt_rpc_channel
|
|
26
26
|
|
|
27
27
|
_LOGGER = logging.getLogger(__name__)
|
|
28
28
|
|
|
@@ -60,7 +60,11 @@ class V1Channel(Channel):
|
|
|
60
60
|
self._mqtt_rpc_channel = create_mqtt_rpc_channel(mqtt_channel, security_data)
|
|
61
61
|
self._local_session = local_session
|
|
62
62
|
self._local_channel: LocalChannel | None = None
|
|
63
|
-
self.
|
|
63
|
+
self._local_rpc_channel: V1RpcChannel | None = None
|
|
64
|
+
# Prefer local, fallback to MQTT
|
|
65
|
+
self._combined_rpc_channel = PickFirstAvailable(
|
|
66
|
+
[lambda: self._local_rpc_channel, lambda: self._mqtt_rpc_channel]
|
|
67
|
+
)
|
|
64
68
|
self._mqtt_unsub: Callable[[], None] | None = None
|
|
65
69
|
self._local_unsub: Callable[[], None] | None = None
|
|
66
70
|
self._callback: Callable[[RoborockMessage], None] | None = None
|
|
@@ -84,7 +88,7 @@ class V1Channel(Channel):
|
|
|
84
88
|
@property
|
|
85
89
|
def rpc_channel(self) -> V1RpcChannel:
|
|
86
90
|
"""Return the combined RPC channel prefers local with a fallback to MQTT."""
|
|
87
|
-
return self._combined_rpc_channel
|
|
91
|
+
return self._combined_rpc_channel
|
|
88
92
|
|
|
89
93
|
@property
|
|
90
94
|
def mqtt_rpc_channel(self) -> V1RpcChannel:
|
|
@@ -160,7 +164,7 @@ class V1Channel(Channel):
|
|
|
160
164
|
except RoborockException as e:
|
|
161
165
|
self._local_channel = None
|
|
162
166
|
raise RoborockException(f"Error connecting to local device {self._device_uid}: {e}") from e
|
|
163
|
-
self.
|
|
167
|
+
self._local_rpc_channel = create_local_rpc_channel(self._local_channel)
|
|
164
168
|
return await self._local_channel.subscribe(self._on_local_message)
|
|
165
169
|
|
|
166
170
|
def _on_mqtt_message(self, message: RoborockMessage) -> None:
|
|
@@ -88,16 +88,15 @@ class BaseV1RpcChannel(V1RpcChannel):
|
|
|
88
88
|
raise NotImplementedError
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
class
|
|
92
|
-
"""A V1 RPC channel that
|
|
91
|
+
class PickFirstAvailable(BaseV1RpcChannel):
|
|
92
|
+
"""A V1 RPC channel that tries multiple channels and picks the first that works."""
|
|
93
93
|
|
|
94
94
|
def __init__(
|
|
95
|
-
self,
|
|
95
|
+
self,
|
|
96
|
+
channel_cbs: list[Callable[[], V1RpcChannel | None]],
|
|
96
97
|
) -> None:
|
|
97
|
-
"""Initialize the
|
|
98
|
-
self.
|
|
99
|
-
self._local_rpc_channel = local_rpc_channel
|
|
100
|
-
self._mqtt_rpc_channel = mqtt_channel
|
|
98
|
+
"""Initialize the pick-first-available channel."""
|
|
99
|
+
self._channel_cbs = channel_cbs
|
|
101
100
|
|
|
102
101
|
async def _send_raw_command(
|
|
103
102
|
self,
|
|
@@ -106,9 +105,10 @@ class CombinedV1RpcChannel(BaseV1RpcChannel):
|
|
|
106
105
|
params: ParamsType = None,
|
|
107
106
|
) -> Any:
|
|
108
107
|
"""Send a command and return a parsed response RoborockBase type."""
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
for channel_cb in self._channel_cbs:
|
|
109
|
+
if channel := channel_cb():
|
|
110
|
+
return await channel.send_command(method, params=params)
|
|
111
|
+
raise RoborockException("No available connection to send command")
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
class PayloadEncodedV1RpcChannel(BaseV1RpcChannel):
|
|
@@ -170,11 +170,10 @@ def create_mqtt_rpc_channel(mqtt_channel: MqttChannel, security_data: SecurityDa
|
|
|
170
170
|
)
|
|
171
171
|
|
|
172
172
|
|
|
173
|
-
def
|
|
174
|
-
"""Create a V1 RPC channel
|
|
175
|
-
|
|
173
|
+
def create_local_rpc_channel(local_channel: LocalChannel) -> V1RpcChannel:
|
|
174
|
+
"""Create a V1 RPC channel using a local channel."""
|
|
175
|
+
return PayloadEncodedV1RpcChannel(
|
|
176
176
|
"local",
|
|
177
177
|
local_channel,
|
|
178
178
|
lambda x: x.encode_message(RoborockMessageProtocol.GENERAL_REQUEST),
|
|
179
179
|
)
|
|
180
|
-
return CombinedV1RpcChannel(local_channel, local_rpc_channel, mqtt_rpc_channel)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_1_apis/roborock_client_v1.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_1_apis/roborock_mqtt_client_v1.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_roborock-2.41.0 → python_roborock-2.41.1}/roborock/version_a01_apis/roborock_client_a01.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|