Skip to content

Victron GX: bug fix for missing translation key#168461

Merged
joostlek merged 5 commits intohome-assistant:devfrom
tomer-w:victron_gx_bugfixes
Apr 30, 2026
Merged

Victron GX: bug fix for missing translation key#168461
joostlek merged 5 commits intohome-assistant:devfrom
tomer-w:victron_gx_bugfixes

Conversation

@tomer-w
Copy link
Copy Markdown
Contributor

@tomer-w tomer-w commented Apr 17, 2026

Proposed change

Fixing a bug I introduced while fixing CR comments. Main entities still need translation key so in the case of selects or enum sensor they will still have the list of options.

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:

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 Victron GX entity translation behavior for main_topic metrics (so state/option translations keep working) and updates device relationships to use the upstream parent/child device model.

Changes:

  • Ensure translation_key/placeholders are always set on Victron entities, including main_topic metrics, while still letting HA use the device name for the entity name.
  • Update device registry via_device mapping to use device.parent_device instead of hardcoding system_0.
  • Adjust/add tests to cover the corrected translation key behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
homeassistant/components/victron_gx/entity.py Always set translation_key/placeholders; keep main_topic entities device-named by forcing _attr_name=None.
homeassistant/components/victron_gx/hub.py Set via_device using the parent_device relationship.
tests/components/victron_gx/test_sensor.py Update regression assertion for main_topic sensor translation key behavior.
tests/components/victron_gx/test_select.py Add regression test ensuring main_topic selects still set translation_key.

Comment thread tests/components/victron_gx/test_select.py Outdated
@tomer-w tomer-w marked this pull request as ready for review April 21, 2026 09:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 21, 2026 09:58
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread homeassistant/components/victron_gx/hub.py Outdated
Comment thread homeassistant/components/victron_gx/entity.py
@joostlek joostlek added this to the 2026.5.0 milestone Apr 29, 2026
Copilot AI review requested due to automatic review settings April 30, 2026 05:53
@tomer-w tomer-w changed the title Victron GX: bug fixes Victron GX: bug fix for missing translation key Apr 30, 2026
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread tests/components/victron_gx/test_sensor.py
@joostlek joostlek merged commit 764075f into home-assistant:dev Apr 30, 2026
36 of 37 checks passed
@tomer-w tomer-w deleted the victron_gx_bugfixes branch April 30, 2026 10:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 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.

4 participants