Skip to content

Use all_devices in ViCare diagnostics for completeness#169429

Merged
joostlek merged 2 commits into
home-assistant:devfrom
lackas:vicare-diagnostics-all-devices
May 4, 2026
Merged

Use all_devices in ViCare diagnostics for completeness#169429
joostlek merged 2 commits into
home-assistant:devfrom
lackas:vicare-diagnostics-all-devices

Conversation

@lackas
Copy link
Copy Markdown
Contributor

@lackas lackas commented Apr 29, 2026

Proposed change

Switch ViCare diagnostics from client.devices (filtered by SUPPORTED_DEVICE_TYPES) to client.all_devices (unfiltered superset).

devices only includes devices whose deviceType is in PyViCare's supported list. Devices with new/unknown deviceType (e.g. Vitoset Aqua with domesticHotWater) are silently dropped, which makes it harder to debug and add support for new device types.

all_devices was added in PyViCare 2.60.0 (openviess/PyViCare#750) for exactly this use case: diagnostics show every device, while entity setup keeps using the safe filtered list (no behavior change there).

This is the follow-up promised in #169401 (PyViCare 2.60.1 bump).

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @CFenner, mind taking a look at this pull request as it has been labeled with an integration (vicare) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of vicare can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign vicare Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

@CFenner CFenner left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the ViCare integration’s diagnostics output to include all devices returned by PyViCare (including unsupported/unknown device types) to improve troubleshooting and future device support.

Changes:

  • Switch diagnostics device dump source from client.devices to client.all_devices.
  • Update the ViCare test mock to provide an all_devices attribute.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
homeassistant/components/vicare/diagnostics.py Use client.all_devices so diagnostics includes devices otherwise filtered out of client.devices.
tests/components/vicare/conftest.py Extend the PyViCare test mock with an all_devices attribute.

Comment on lines 22 to 27
def dump_devices() -> list[dict[str, Any]]:
"""Dump devices."""
return [
json.loads(device.dump_secure())
for device in entry.runtime_data.client.devices
for device in entry.runtime_data.client.all_devices
]
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

Add a test case that verifies all_devices can include extra (unsupported/unknown) devices and that diagnostics include them, since the current test setup makes all_devices identical to devices and won’t fail if this change regresses.

Copilot uses AI. Check for mistakes.
Comment thread tests/components/vicare/conftest.py Outdated
"Online",
)
)
self.all_devices = self.devices
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

Make the test mock’s all_devices differ from devices (e.g., include an extra unknown device type) so the diagnostics tests exercise the new behavior instead of keeping both lists identical.

Suggested change
self.all_devices = self.devices
self.all_devices = list(self.devices)
if fixtures:
self.all_devices.append(
PyViCareDeviceConfig(
MockViCareService(
"installation_unknown",
"gateway_unknown",
"device_unknown",
fixtures[0],
),
"deviceId_unknown",
"UnknownDevice",
"Online",
)
)

Copilot uses AI. Check for mistakes.
@lackas lackas requested a review from CFenner May 4, 2026 06:50
Copy link
Copy Markdown
Contributor

@CFenner CFenner left a comment

Choose a reason for hiding this comment

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

👍

It would be nice if this could go into 2026.05 as it is related to the version bump.

@joostlek joostlek added this to the 2026.5.0 milestone May 4, 2026
@joostlek joostlek merged commit 5858db1 into home-assistant:dev May 4, 2026
32 of 33 checks passed
rajlaud pushed a commit to rajlaud/home-assistant that referenced this pull request May 5, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants