Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ac): correct attributes based on msg type #251

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

Necroneco
Copy link
Collaborator

@Necroneco Necroneco commented Jul 28, 2024

This reverts commit 75fbd8e

Fix #249

@linkser Can you help with a test?

Summary by CodeRabbit

  • New Features

    • Enhanced message handling in AC device control, allowing for a broader range of message types when setting attributes.
    • Improved handling of swing settings with refined checks based on message types, ensuring correct attribute modifications.
  • Bug Fixes

    • Fixed conditional logic in attribute setting, ensuring attributes are only set when appropriate message types are received.

Copy link
Contributor

coderabbitai bot commented Jul 28, 2024

Walkthrough

The recent changes to the set_attribute and set_swing methods in the Midea AC device class enhance the flexibility and robustness of message handling. By expanding the types of messages processed and refining the logic for setting device attributes, the updates ensure that the device responds accurately to varying message protocols, ultimately improving its overall functionality.

Changes

File Path Change Summary
midealocal/devices/ac/__init__.py Updated set_attribute and set_swing methods to handle MessageSubProtocolSet and refined logic for setting attributes.

Assessment against linked issues

Objective Addressed Explanation
KFR-72-T2/B3DN1-MXP(1) functionality

Poem

In the world of ACs, so cool and bright,
A rabbit hops in, with joy and delight.
With messages clear, attributes set right,
Our gadgets are smart, oh what a sight!
Hoppy days ahead, let's give a cheer,
For the changes we've made, bring comfort near! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Necroneco Necroneco changed the title Revert "chore: missing typing for AC (#85)" revert: "chore: missing typing for AC (#85)" Jul 28, 2024
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 35.33%. Comparing base (8f5ec79) to head (e1a428b).

Files Patch % Lines
midealocal/devices/ac/__init__.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #251      +/-   ##
==========================================
- Coverage   35.34%   35.33%   -0.01%     
==========================================
  Files          81       81              
  Lines        7184     7186       +2     
==========================================
  Hits         2539     2539              
- Misses       4645     4647       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8f5ec79 and e1a428b.

Files selected for processing (1)
  • midealocal/devices/ac/init.py (4 hunks)
Additional comments not posted (3)
midealocal/devices/ac/__init__.py (3)

288-292: Ensure proper type hinting.

The type hinting for the message variable is correct and enhances code readability.


Line range hint 362-375:
Conditional attribute setting is well-implemented.

The conditional check ensures that certain attributes are only set if the message is not of type MessageSubProtocolSet.


400-405: Enhanced message handling in set_swing.

The changes ensure that the correct attributes are modified based on the specific message type being processed.

@rokam rokam changed the title revert: "chore: missing typing for AC (#85)" revert: missing typing for AC (#85) Jul 28, 2024
@linkser
Copy link

linkser commented Jul 29, 2024

This reverts commit 75fbd8e

Fix #249

@linkser Can you help with a test?

Summary by CodeRabbit

  • New Features

    • Enhanced message handling in AC device control, allowing for a broader range of message types when setting attributes.
    • Improved handling of swing settings with refined checks based on message types, ensuring correct attribute modifications.
  • Bug Fixes

    • Fixed conditional logic in attribute setting, ensuring attributes are only set when appropriate message types are received.

test passed

@rokam rokam added the bug Something isn't working label Jul 29, 2024
@rokam rokam changed the title revert: missing typing for AC (#85) fix(ac): correct attributes based on msg type Jul 29, 2024
@rokam rokam merged commit fada9bc into midea-lan:main Jul 29, 2024
13 of 20 checks passed
@rokam rokam mentioned this pull request Jul 30, 2024
rokam added a commit that referenced this pull request Jul 30, 2024
🤖 I have created a release *beep* *boop*
---


## [2.5.0](v2.4.0...v2.5.0)
(2024-07-30)


### Features

* **40:** add `precision_halves` customization
([#248](#248))
([8f5ec79](8f5ec79))
* **b8:** first implementation
([#225](#225))
([259e4f2](259e4f2))


### Bug Fixes

* `break` the loop when connected
([#244](#244))
([536f975](536f975))
* **ac:** correct attributes based on msg type
([#251](#251))
([fada9bc](fada9bc))
* **cloud:** fix email obfuscation
([#245](#245))
([ad9f278](ad9f278))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
@Necroneco Necroneco deleted the revert-85 branch August 7, 2024 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KFR-72-T2/B3DN1-MXP(1) not working
4 participants