Fix speed detection for some fans. #174
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant changes to the
custom_components/dreo/pydreo/pydreofan.py
file and adds new tests and JSON responses to improve the functionality and testing of the Dreo fan component. The most important changes include refactoring the speed range parsing logic, adding new test cases, and including a new JSON response file for device state.Refactoring and Enhancements:
custom_components/dreo/pydreo/pydreofan.py
: Refactored theparse_speed_range
method to handle multiple configurations and added a helper methodparse_speed_range_from_control_node
to streamline the parsing logic.custom_components/dreo/pydreo/pydreofan.py
: Simplified theparse_preset_modes
method by removing unnecessary checks.Testing Improvements:
tests/pydreo/test_pydreofan.py
: Added a new test casetest_HTF005S
to verify the loading and command-sending functionality for the HTF005S fan model.tests/pydreo/api_responses/get_device_state_HTF005S_1.json
: Added a new JSON response file to mock the device state for the HTF005S fan model.