Skip to content

Commit 7cbb9ee

Browse files
Lash-Lallenporter
andauthored
chore: share duplicated code
Co-authored-by: Allen Porter <allen.porter@gmail.com>
1 parent c171ff8 commit 7cbb9ee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

roborock/devices/device_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,12 @@ def device_creator(home_data: HomeData, device: HomeDataDevice, product: HomeDat
197197
trait = a01.create(product, channel)
198198
case DeviceVersion.B01:
199199
channel = create_mqtt_channel(user_data, mqtt_params, mqtt_session, device)
200-
if "ss" in product.model.split(".")[-1]:
200+
model_part = product.model.split(".")[-1]
201+
if "ss" in model_part:
201202
raise NotImplementedError(
202203
f"Device {device.name} has unsupported version B01_{product.model.strip('.')[-1]}"
203204
)
204-
elif "sc" in product.model.split(".")[-1]:
205+
elif "sc" in model_part:
205206
# Q7 devices start with 'sc' in their model naming.
206207
trait = b01.q7.create(channel)
207208
else:

0 commit comments

Comments
 (0)