@@ -43,30 +43,30 @@ async def get_or_create_session() -> UserParams:
4343async def main ():
4444 """Test Q10 vacuum commands."""
4545 print ("🔄 Initializing..." )
46-
46+
4747 try :
4848 user_params = await get_or_create_session ()
4949 cache = FileCache (CACHE_PATH )
50-
50+
5151 print ("🔄 Creating device manager..." )
5252 device_manager = await create_device_manager (user_params , cache = cache )
53-
53+
5454 print ("🔄 Getting devices..." )
5555 devices = await device_manager .get_devices ()
56-
56+
5757 print (f"\n 📱 Found { len (devices )} device(s)" )
58-
58+
5959 # List all devices with their properties
6060 for idx , device in enumerate (devices , 1 ):
6161 print (f"\n Device { idx } : { device .name } " )
6262 print (f" Product: { device .product .name } ({ device .product .model } )" )
6363 print (f" Has v1_properties: { device .v1_properties is not None } " )
6464 print (f" Has b01_q10_properties: { device .b01_q10_properties is not None } " )
65-
65+
6666 # Check what attributes the device has
67- attrs = [attr for attr in dir (device ) if not attr .startswith ('_' ) and ' properties' in attr .lower ()]
67+ attrs = [attr for attr in dir (device ) if not attr .startswith ("_" ) and " properties" in attr .lower ()]
6868 print (f" Available property APIs: { attrs } " )
69-
69+
7070 # Select device
7171 if len (devices ) == 1 :
7272 device = devices [0 ]
@@ -75,31 +75,33 @@ async def main():
7575 device_idx = int (input ("\n Select device number: " )) - 1
7676 device = devices [device_idx ]
7777 print (f"\n ✅ Selected device: { device .name } " )
78-
78+
7979 # Check if it's a Q10 device
8080 if device .b01_q10_properties is None :
8181 print ("\n ❌ This device doesn't have Q10 properties" )
8282 print (f" Product: { device .product .name } ({ device .product .model } )" )
8383 print ("\n 💡 Available properties:" )
8484 if device .v1_properties :
8585 print (" - v1_properties (V1 API)" )
86- if hasattr (device , ' b01_q7_properties' ) and device .b01_q7_properties :
86+ if hasattr (device , " b01_q7_properties" ) and device .b01_q7_properties :
8787 print (" - b01_q7_properties (Q7 API)" )
8888 await cache .flush ()
8989 return
90-
91- print (f "\n ✅ Device has Q10 properties!" )
92-
90+
91+ print ("\n ✅ Device has Q10 properties!" )
92+
9393 # Check if vacuum trait exists
94- if not hasattr (device .b01_q10_properties , ' vacuum' ):
94+ if not hasattr (device .b01_q10_properties , " vacuum" ):
9595 print ("\n ❌ Q10 properties don't have 'vacuum' trait" )
96- print (f" Available traits: { [attr for attr in dir (device .b01_q10_properties ) if not attr .startswith ('_' )]} " )
96+ print (
97+ f" Available traits: { [attr for attr in dir (device .b01_q10_properties ) if not attr .startswith ('_' )]} "
98+ )
9799 await cache .flush ()
98100 return
99-
101+
100102 vacuum = device .b01_q10_properties .vacuum
101103 print (f"✅ Vacuum trait found: { vacuum } " )
102-
104+
103105 print ("\n 🤖 Q10 Vacuum Trait Test Menu" )
104106 print ("=" * 50 )
105107 print ("1. Start cleaning" )
@@ -109,11 +111,11 @@ async def main():
109111 print ("5. Return to dock" )
110112 print ("0. Exit" )
111113 print ("=" * 50 )
112-
114+
113115 while True :
114116 try :
115117 choice = input ("\n Enter your choice (0-5): " ).strip ()
116-
118+
117119 if choice == "0" :
118120 print ("👋 Exiting..." )
119121 break
@@ -145,13 +147,15 @@ async def main():
145147 except Exception as e :
146148 print (f"❌ Error: { e } " )
147149 import traceback
150+
148151 traceback .print_exc ()
149-
152+
150153 await cache .flush ()
151-
154+
152155 except Exception as e :
153156 print (f"\n ❌ Fatal error: { e } " )
154157 import traceback
158+
155159 traceback .print_exc ()
156160
157161
0 commit comments