Skip to content

Simplify updater, look for softwareVersion and firmwareVersion#700

Merged
jwillemsen merged 5 commits into
masterfrom
jwi-simplifyupdater
Jun 25, 2026
Merged

Simplify updater, look for softwareVersion and firmwareVersion#700
jwillemsen merged 5 commits into
masterfrom
jwi-simplifyupdater

Conversation

@jwillemsen

@jwillemsen jwillemsen commented Jun 25, 2026

Copy link
Copy Markdown
Owner
* custom_components/daikin_onecta/update.py:
* tests/snapshots/test_init.ambr:

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of firmware update entities appearing for compatible devices and management points.
    • Enhanced detection of available version details, so update status is shown when firmware or software version data is present.
  • Chores
    • Updated CI validation environment to use a slimmer Ubuntu runner image.

    * custom_components/daikin_onecta/update.py:
    * tests/snapshots/test_init.ambr:
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: abe21490-4483-47a9-bc5b-60d8b0b0ccc1

📥 Commits

Reviewing files that changed from the base of the PR and between 8027f14 and 962f2f0.

📒 Files selected for processing (2)
  • .github/workflows/hassfest.yaml
  • .github/workflows/validate.yml
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/hassfest.yaml
  • .github/workflows/validate.yml

Walkthrough

async_setup_entry now scans each device’s management points and creates firmware update entities when a point exposes firmwareVersion or softwareVersion. Two validation workflows also now run on ubuntu-slim.

Changes

Firmware update entity discovery

Layer / File(s) Summary
Management point scan for update entities
custom_components/daikin_onecta/update.py
async_setup_entry now iterates each device's managementPoints, reads managementPointType, and adds a DaikinFirmwareUpdateEntity when firmwareVersion or softwareVersion is present.

Workflow runner updates

Layer / File(s) Summary
Validation job runner image
.github/workflows/hassfest.yaml, .github/workflows/validate.yml
Both validate jobs switch their runner image from ubuntu-latest to ubuntu-slim.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • jwillemsen/daikin_onecta#652: Changes the same update-entity setup path to discover DaikinFirmwareUpdateEntity instances from management points and their version fields.
  • jwillemsen/daikin_onecta#654: Also adjusts firmware update entity creation based on firmwareVersion and softwareVersion on management points.
  • jwillemsen/daikin_onecta#696: Modifies async_setup_entry to create update entities only when a management point exposes firmwareVersion or softwareVersion.

Poem

🐰 I hopped through points both near and far,
and found the versions where they are.
One update hop, two workflow tweaks,
then thump-thump goes my rabbit cheeks!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main updater change and mentions the key version fields being checked.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jwi-simplifyupdater

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@custom_components/daikin_onecta/update.py`:
- Line 57: The management point parsing in async_setup_entry can crash if a
point is missing managementPointType. Update the management_point handling in
update.py to use management_point.get("managementPointType") instead of direct
indexing, and skip any invalid entries before they reach the setup flow. Use the
management_point variable and the async_setup_entry/update logic to locate the
fix.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 03e61f7a-5462-49f0-a9fb-3143ac5a9e90

📥 Commits

Reviewing files that changed from the base of the PR and between e6335a6 and 8027f14.

📒 Files selected for processing (2)
  • custom_components/daikin_onecta/update.py
  • tests/snapshots/test_init.ambr

break
management_points = device.daikin_data.get("managementPoints", [])
for management_point in management_points:
management_point_type = management_point["managementPointType"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard managementPointType access to avoid setup crashes.

Line 57 can raise KeyError if a malformed management point lacks managementPointType, which would fail async_setup_entry for the whole device batch. Use .get() and skip invalid points.

Proposed fix
     for device in onecta_data.devices.values():
         management_points = device.daikin_data.get("managementPoints", [])
         for management_point in management_points:
-            management_point_type = management_point["managementPointType"]
+            management_point_type = management_point.get("managementPointType")
+            if not management_point_type:
+                continue
             for field in required_version_fields:
                 if _get_value(management_point, field) is not None:
                     entities.append(DaikinFirmwareUpdateEntity(coordinator, device, management_point, management_point_type))
                     break
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
management_point_type = management_point["managementPointType"]
management_point_type = management_point.get("managementPointType")
if not management_point_type:
continue
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@custom_components/daikin_onecta/update.py` at line 57, The management point
parsing in async_setup_entry can crash if a point is missing
managementPointType. Update the management_point handling in update.py to use
management_point.get("managementPointType") instead of direct indexing, and skip
any invalid entries before they reach the setup flow. Use the management_point
variable and the async_setup_entry/update logic to locate the fix.

    * .github/workflows/hassfest.yaml:
    * .github/workflows/validate.yml:
    * .github/workflows/hassfest.yaml:
    * .github/workflows/validate.yml:
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.39%. Comparing base (e6335a6) to head (25dc6ca).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #700      +/-   ##
==========================================
- Coverage   97.44%   97.39%   -0.06%     
==========================================
  Files          17       17              
  Lines        1956     1955       -1     
==========================================
- Hits         1906     1904       -2     
- Misses         50       51       +1     

☔ 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.

@jwillemsen jwillemsen merged commit 79ec32d into master Jun 25, 2026
11 of 14 checks passed
@jwillemsen jwillemsen deleted the jwi-simplifyupdater branch June 25, 2026 09:56
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.

1 participant