Skip to content

Commit d56c5fe

Browse files
committed
chore: add comment describing the decorator check
1 parent 01026ab commit d56c5fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

roborock/devices/traits/v1/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ class PropertiesApi(Trait):
4646
def __init__(self, product: HomeDataProduct, rpc_channel: V1RpcChannel, mqtt_rpc_channel: V1RpcChannel) -> None:
4747
"""Initialize the V1TraitProps with None values."""
4848
self.status = StatusTrait(product)
49-
# self.status._rpc_channel = rpc_channel
5049
self.maps = MapsTrait(self.status)
51-
# self.maps._rpc_channel = mqtt_rpc_channel
5250

5351
# This is a hack to allow setting the rpc_channel on all traits. This is
5452
# used so we can preserve the dataclass behavior when the values in the
@@ -58,7 +56,9 @@ def __init__(self, product: HomeDataProduct, rpc_channel: V1RpcChannel, mqtt_rpc
5856
if (trait := getattr(self, item.name, None)) is None:
5957
trait = item.type()
6058
setattr(self, item.name, trait)
61-
if hasattr(trait, "mqtt_rpc_channel"): # @common.mqtt_rpc_channel
59+
# The decorator `@common.mqtt_rpc_channel` means that the trait needs
60+
# to use the mqtt_rpc_channel (cloud only) instead of the rpc_channel (adaptive)
61+
if hasattr(trait, "mqtt_rpc_channel"):
6262
trait._rpc_channel = mqtt_rpc_channel
6363
else:
6464
trait._rpc_channel = rpc_channel

0 commit comments

Comments
 (0)