Skip to content

Fix hvv_departures to pass config_entry explicitly to DataUpdateCoordinator#156794

Merged
joostlek merged 2 commits into
devfrom
copilot/fix-hvv-departure-contextvar-issue
Nov 18, 2025
Merged

Fix hvv_departures to pass config_entry explicitly to DataUpdateCoordinator#156794
joostlek merged 2 commits into
devfrom
copilot/fix-hvv-departure-contextvar-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 18, 2025

Breaking change

Proposed change

The hvv_departures integration's binary_sensor platform was relying on ContextVar to implicitly pass config_entry to DataUpdateCoordinator. This will break in Home Assistant 2026.8 when ContextVar support is removed.

Changes:

  • Added explicit config_entry=entry parameter to DataUpdateCoordinator initialization in binary_sensor.py
# Before
coordinator = DataUpdateCoordinator(
    hass,
    _LOGGER,
    name="hvv_departures.binary_sensor",
    update_method=async_update_data,
    update_interval=timedelta(hours=1),
)

# After
coordinator = DataUpdateCoordinator(
    hass,
    _LOGGER,
    name="hvv_departures.binary_sensor",
    update_method=async_update_data,
    update_interval=timedelta(hours=1),
    config_entry=entry,
)

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Original prompt

This section details on the original issue you should resolve

<issue_title>HVV Departure relies on ContextVar, but should pass the config entry explicitly</issue_title>
<issue_description>### The problem

Detected that integration 'hvv_departures' relies on ContextVar, but should pass the config entry explicitly. at homeassistant/components/hvv_departures/binary_sensor.py, line 107: coordinator = DataUpdateCoordinator(. This will stop working in Home Assistant 2026.8, please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+hvv_departures%22

What version of Home Assistant Core has the issue?

core-2025.11.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HVV Departures

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hvv_departures/

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: joostlek <7083755+joostlek@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix HVV Departure to pass config entry explicitly Fix hvv_departures to pass config_entry explicitly to DataUpdateCoordinator Nov 18, 2025
Copilot AI requested a review from joostlek November 18, 2025 10:53
@home-assistant
Copy link
Copy Markdown
Contributor

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

Code owner commands

Code owners of hvv_departures can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign hvv_departures Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@joostlek joostlek marked this pull request as ready for review November 18, 2025 11:13
Copilot AI review requested due to automatic review settings November 18, 2025 11:13
@joostlek joostlek added this to the 2025.11.3 milestone Nov 18, 2025
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

This PR fixes a deprecation warning in the hvv_departures integration by explicitly passing the config_entry parameter to DataUpdateCoordinator instead of relying on ContextVar, which will be removed in Home Assistant 2026.8.

Key Changes:

  • Added explicit config_entry=entry parameter to DataUpdateCoordinator initialization in the binary_sensor platform

@joostlek joostlek merged commit 8c9b90a into dev Nov 18, 2025
41 of 64 checks passed
@joostlek joostlek deleted the copilot/fix-hvv-departure-contextvar-issue branch November 18, 2025 11:32
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 19, 2025
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.

HVV Departure relies on ContextVar, but should pass the config entry explicitly

5 participants