Skip to content

Fix auth error on BRP069 when API key is provided#131

Open
fredrike wants to merge 3 commits into
masterfrom
brp069_auth
Open

Fix auth error on BRP069 when API key is provided#131
fredrike wants to merge 3 commits into
masterfrom
brp069_auth

Conversation

@fredrike

@fredrike fredrike commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Description

Some BRP069 units also use keys to auth.
If treated as a BRP072 we won't be able to connect, since this will force https on a unit that expects
connection to port 80. We do a preliminary attempt at initialization to catch connection errors and then
fallback to the following cases.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test coverage improvement

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this with real Daikin hardware (if applicable)

Code Quality

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Pre-commit hooks pass (run pre-commit run --all-files)

String Formatting (New Code)

  • If this PR adds new Python files, I've used double quotes (") for strings following Python conventions

Note: An automated check will highlight single quotes in new code. We're planning to migrate to standard string normalization in the future. New code should prefer double quotes (") over single quotes (') to ease this transition.

Documentation

  • I have updated the documentation accordingly (if needed)
  • I have updated the CHANGELOG (if applicable)

Related Issues

Closes #

Additional Notes

valerioformato and others added 3 commits July 14, 2026 13:44
Extract the BRP072C key-auth fallback logic into a static
_try_brp072c() method. Narrow the broad 'except Exception' to
specific types (DaikinException, aiohttp.ClientError, TimeoutError,
OSError). Add import aiohttp.

Add test_factory_brp072c_success to cover the happy path.
@fredrike
fredrike marked this pull request as ready for review July 14, 2026 12:02
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.07%. Comparing base (9959918) to head (7dbd7b9).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pydaikin/factory.py 82.35% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
- Coverage   84.14%   84.07%   -0.07%     
==========================================
  Files          12       12              
  Lines        1198     1212      +14     
==========================================
+ Hits         1008     1019      +11     
- Misses        190      193       +3     

☔ View full report in Codecov by Harness.
📢 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.

@fredrike

Copy link
Copy Markdown
Owner Author

@valerioformato can you please test this version so we can add it to HomeAssistant?

@valerioformato

valerioformato commented Jul 14, 2026

Copy link
Copy Markdown

@valerioformato can you please test this version so we can add it to HomeAssistant?

Gladly, but it might have to wait for next week since I'm traveling right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants