Commit 0f70bf9
authored
fix: Allow firmware version as an optional field (#670)
* fix: Allow firmware version as an optional field
This field may not be returned by the API, in particular when the device is offline.
```
2025-12-14 18:09:25.550 ERROR (MainThread) [roborock.data.containers] Failed to convert devices with value [{'duid': 'yyyyyy', 'name': 'S6 Pure', 'localKey': 'xxxxxx', 'productId': 'zzzzzz', 'activeTime': NNNNNNN, 'timeZoneId': 'Europe/Moscow', 'iconUrl': '', 'share': False, 'online': False, 'pv': '1.0', 'tuyaMigrated': False, 'extra': '{}', 'deviceStatus': {}, 'silentOtaSwitch': False, 'f': False}] to type list[roborock.data.containers.HomeDataDevice]
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/roborock/data/containers.py", line 122, in from_dict
result[key] = RoborockBase._convert_to_class_obj(field_type, value)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/roborock/data/containers.py", line 73, in _convert_to_class_obj
return [RoborockBase._convert_to_class_obj(sub_type, obj) for obj in value]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/roborock/data/containers.py", line 81, in _convert_to_class_obj
return class_type.from_dict(value)
~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/usr/local/lib/python3.13/site-packages/roborock/data/containers.py", line 127, in from_dict
return cls(**result)
TypeError: HomeDataDevice.__init__() missing 1 required positional argument: 'fv'
```
* chore: add test for example offline device1 parent 4b4e5aa commit 0f70bf9
File tree
3 files changed
+41
-11
lines changed- roborock/data
- tests
- devices/__snapshots__
3 files changed
+41
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
242 | 241 | | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| |||
0 commit comments