4444from roborock import RoborockCommand
4545from roborock .data import RoborockBase , UserData
4646from roborock .data .b01_q10 .b01_q10_code_mappings import B01_Q10_DP
47- from roborock .data .code_mappings import SHORT_MODEL_TO_ENUM , RoborockProductNickname
47+ from roborock .data .code_mappings import SHORT_MODEL_TO_ENUM
4848from roborock .device_features import DeviceFeatures
4949from roborock .devices .cache import Cache , CacheData
5050from roborock .devices .device import RoborockDevice
@@ -861,7 +861,7 @@ def _parse_diagnostic_file(diagnostic_path: Path) -> dict[str, dict[str, Any]]:
861861 if not coordinators :
862862 return all_products_data
863863
864- for coordinator_id , coordinator_data in coordinators .items ():
864+ for coordinator_data in coordinators .values ():
865865 device_data = coordinator_data .get ("device" , {})
866866 product_data = coordinator_data .get ("product" , {})
867867
@@ -870,11 +870,11 @@ def _parse_diagnostic_file(diagnostic_path: Path) -> dict[str, dict[str, Any]]:
870870 continue
871871 # Derive product nickname from model
872872 short_model = model .split ("." )[- 1 ]
873- product_nickname = SHORT_MODEL_TO_ENUM .get (short_model , RoborockProductNickname . PEARLPLUS )
873+ product_nickname = SHORT_MODEL_TO_ENUM .get (short_model )
874874
875875 current_product_data : dict [str , Any ] = {
876- "Protocol Version " : device_data .get ("pv" ),
877- "Product Nickname " : product_nickname .name ,
876+ "protocol_version " : device_data .get ("pv" ),
877+ "product_nickname " : product_nickname .name if product_nickname else "Unknown" ,
878878 }
879879
880880 # Get feature info from the device_features trait (preferred location)
@@ -884,17 +884,17 @@ def _parse_diagnostic_file(diagnostic_path: Path) -> dict[str, dict[str, Any]]:
884884 # newFeatureInfo is the integer
885885 new_feature_info = device_features .get ("newFeatureInfo" )
886886 if new_feature_info is not None :
887- current_product_data ["New Feature Info " ] = new_feature_info
887+ current_product_data ["new_feature_info " ] = new_feature_info
888888
889889 # newFeatureInfoStr is the hex string
890890 new_feature_info_str = device_features .get ("newFeatureInfoStr" )
891891 if new_feature_info_str :
892- current_product_data ["New Feature Info Str " ] = new_feature_info_str
892+ current_product_data ["new_feature_info_str " ] = new_feature_info_str
893893
894894 # featureInfo is the list of feature codes
895895 feature_info = device_features .get ("featureInfo" )
896896 if feature_info :
897- current_product_data ["Feature Info " ] = feature_info
897+ current_product_data ["feature_info " ] = feature_info
898898
899899 # Build product dict from diagnostic product data
900900 if product_data :
@@ -904,7 +904,7 @@ def _parse_diagnostic_file(diagnostic_path: Path) -> dict[str, dict[str, Any]]:
904904 if key in product_data :
905905 product_dict [key ] = product_data [key ]
906906 if product_dict :
907- current_product_data ["Product " ] = product_dict
907+ current_product_data ["product " ] = product_dict
908908
909909 all_products_data [model ] = current_product_data
910910
@@ -965,17 +965,7 @@ async def get_device_info(ctx: click.Context, record: bool, device_info_file: st
965965
966966 click .echo (f"Found { len (all_products_data )} device(s) in diagnostic file." )
967967
968- # Filter out already recorded models if recording
969- if record :
970- all_products_data = {
971- model : data for model , data in all_products_data .items () if model not in existing_device_info
972- }
973- if not all_products_data :
974- click .echo ("No new device info to record (all models already exist)." )
975- return
976-
977968 else :
978- # Original behavior: connect to devices
979969 click .echo ("Discovering devices..." )
980970
981971 if record :
@@ -1000,16 +990,15 @@ async def get_device_info(ctx: click.Context, record: bool, device_info_file: st
1000990 click .echo (f" - Processing { device .name } ({ device .duid } )" )
1001991
1002992 model = device .product .model
1003- if record and model in existing_device_info :
1004- click .echo (f" - Device info already recorded for { model } " )
1005- continue
1006993 if model in all_products_data :
1007994 click .echo (f" - Skipping duplicate model { model } " )
1008995 continue
1009996
1010997 current_product_data = {
1011- "Protocol Version" : device .device_info .pv ,
1012- "Product Nickname" : device .product .product_nickname .name ,
998+ "protocol_version" : device .device_info .pv ,
999+ "product_nickname" : device .product .product_nickname .name
1000+ if device .product .product_nickname
1001+ else "Unknown" ,
10131002 }
10141003 if device .v1_properties is not None :
10151004 try :
@@ -1022,15 +1011,15 @@ async def get_device_info(ctx: click.Context, record: bool, device_info_file: st
10221011 init_status_result = result [0 ] if result else {}
10231012 current_product_data .update (
10241013 {
1025- "New Feature Info " : init_status_result .get ("new_feature_info" ),
1026- "New Feature Info Str " : init_status_result .get ("new_feature_info_str" ),
1027- "Feature Info " : init_status_result .get ("feature_info" ),
1014+ "new_feature_info " : init_status_result .get ("new_feature_info" ),
1015+ "new_feature_info_str " : init_status_result .get ("new_feature_info_str" ),
1016+ "feature_info " : init_status_result .get ("feature_info" ),
10281017 }
10291018 )
10301019
10311020 product_data = device .product .as_dict ()
10321021 if product_data :
1033- current_product_data ["Product " ] = product_data
1022+ current_product_data ["product " ] = product_data
10341023
10351024 all_products_data [model ] = current_product_data
10361025
@@ -1082,19 +1071,19 @@ def update_docs(data_file: str, output_file: str):
10821071 for model , data in product_data_from_yaml .items ():
10831072 # Reconstruct the DeviceFeatures object from the raw data in the YAML file
10841073 device_features = DeviceFeatures .from_feature_flags (
1085- new_feature_info = data .get ("New Feature Info " ),
1086- new_feature_info_str = data .get ("New Feature Info Str " ),
1087- feature_info = data .get ("Feature Info " ),
1088- product_nickname = data .get ("Product Nickname " ),
1074+ new_feature_info = data .get ("new_feature_info " ),
1075+ new_feature_info_str = data .get ("new_feature_info_str " ),
1076+ feature_info = data .get ("feature_info " ),
1077+ product_nickname = data .get ("product_nickname " ),
10891078 )
10901079 features_dict = asdict (device_features )
10911080
10921081 # This dictionary will hold the final data for the markdown table row
10931082 current_product_data = {
1094- "Product Nickname " : data .get ("Product Nickname " , "" ),
1095- "Protocol Version " : data .get ("Protocol Version " , "" ),
1096- "New Feature Info " : data .get ("New Feature Info " , "" ),
1097- "New Feature Info Str " : data .get ("New Feature Info Str " , "" ),
1083+ "product_nickname " : data .get ("product_nickname " , "" ),
1084+ "protocol_version " : data .get ("protocol_version " , "" ),
1085+ "new_feature_info " : data .get ("new_feature_info " , "" ),
1086+ "new_feature_info_str " : data .get ("new_feature_info_str " , "" ),
10981087 }
10991088
11001089 # Populate features from the calculated DeviceFeatures object
@@ -1103,7 +1092,7 @@ def update_docs(data_file: str, output_file: str):
11031092 if is_supported :
11041093 current_product_data [feature ] = "X"
11051094
1106- supported_codes = data .get ("Feature Info " , [])
1095+ supported_codes = data .get ("feature_info " , [])
11071096 if isinstance (supported_codes , list ):
11081097 for code in supported_codes :
11091098 feature_name = str (code )
@@ -1117,10 +1106,10 @@ def write_markdown_table(product_features: dict[str, dict[str, any]], all_featur
11171106 """Writes the data into a markdown table (products as columns)."""
11181107 sorted_products = sorted (product_features .keys ())
11191108 special_rows = [
1120- "Product Nickname " ,
1121- "Protocol Version " ,
1122- "New Feature Info " ,
1123- "New Feature Info Str " ,
1109+ "product_nickname " ,
1110+ "protocol_version " ,
1111+ "new_feature_info " ,
1112+ "new_feature_info_str " ,
11241113 ]
11251114 # Regular features are the remaining keys, sorted alphabetically
11261115 # We filter out the special rows to avoid duplicating them.
0 commit comments