Skip to content

Make uses_http a readonly property of device config #1449

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

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

sdb9696
Copy link
Collaborator

@sdb9696 sdb9696 commented Jan 14, 2025

uses_http is not supposed to be set by consumers. For historical reasons it was a dataclass field so that HomeAssistant could persist and re-use the config dict. This is no longer the case as HA stores the uses_http from the DeviceConfig directly.

Making uses_http a readonly property simplifies the logic in try_connect_all. This PR also fixes try_connect_all to include SMART.TAPOROBOVAC and IOT.IPCAMERA as main device types.

Breaking info - consumers that relied on uses_http to be persisted with DeviceConfig.to_dict() will need to store the value separately.

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.56%. Comparing base (57f6c41) to head (f3494a3).
Report is 59 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1449      +/-   ##
==========================================
+ Coverage   92.55%   92.56%   +0.01%     
==========================================
  Files         133      133              
  Lines        8336     8344       +8     
  Branches      857      860       +3     
==========================================
+ Hits         7715     7724       +9     
+ Misses        455      454       -1     
  Partials      166      166              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

Nice cleanup! I'm wondering if we should mark this as breaking change?

@sdb9696 sdb9696 added the breaking change Breaking change label Jan 14, 2025
@sdb9696
Copy link
Collaborator Author

sdb9696 commented Jan 14, 2025

That's done

@sdb9696 sdb9696 merged commit be34dbd into master Jan 14, 2025
18 checks passed
@sdb9696 sdb9696 deleted the fix/try_connect_all branch January 14, 2025 14:20
@sdb9696 sdb9696 mentioned this pull request Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants