Skip to content

Conversation

@wollew
Copy link
Contributor

@wollew wollew commented Oct 31, 2025

Breaking change

Proposed change

This PR adds a reboot button to the KLF 200 gateway device. This allows us to deprecate and eventually remove the velux.reboot_gateway service, making it more convenient for users to reboot their gateway (this was suggested in #155207 (comment) and sounds like a good idea).

The PR depends on #155434 which introduces the gateway as its own device, it it followed up by #155549 (adds the service deprecation issue).

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

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:

@home-assistant
Copy link

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

Code owner commands

Code owners of velux 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 velux 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.

@wollew wollew marked this pull request as draft October 31, 2025 11:04
@wollew
Copy link
Contributor Author

wollew commented Oct 31, 2025

draft until #155434 is merged

Copy link
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 adds a button entity to the Velux integration for rebooting the KLF 200 gateway and refactors the integration's data model to properly support device hierarchy. The main changes include introducing a VeluxData dataclass to store both the PyVLX instance and gateway device identifier, creating the gateway as a device in the device registry, and establishing proper device relationships (via_device) between child devices and the gateway.

Key changes:

  • Added button platform with gateway reboot functionality
  • Introduced VeluxData dataclass to wrap runtime data, replacing direct PyVLX storage
  • Created gateway device in device registry with proper metadata and version information
  • Updated all platform files to use new runtime data structure and pass full config_entry instead of just entry_id

Reviewed Changes

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

Show a summary per file
File Description
homeassistant/components/velux/__init__.py Introduces VeluxData dataclass, creates gateway device in registry, updates runtime_data structure
homeassistant/components/velux/button.py Adds new button entity for gateway reboot with proper error handling
homeassistant/components/velux/const.py Adds Platform.BUTTON to PLATFORMS list
homeassistant/components/velux/entity.py Updates VeluxEntity to accept full config_entry and set via_device for device hierarchy
homeassistant/components/velux/binary_sensor.py Updates to use new runtime_data structure and config_entry parameter
homeassistant/components/velux/cover.py Updates to use new runtime_data structure and config_entry parameter
homeassistant/components/velux/light.py Updates to use new runtime_data structure and config_entry parameter
homeassistant/components/velux/scene.py Updates to use new runtime_data structure
homeassistant/components/velux/strings.json Adds button entity translation and reboot_failed exception message, removes period from service description
tests/components/velux/conftest.py Adds setup_integration fixture for cleaner test setup
tests/components/velux/test_button.py Adds comprehensive tests for button entity setup and behavior
tests/components/velux/test_binary_sensor.py Adds test verification for via_device relationship to gateway
Comments suppressed due to low confidence (1)

homeassistant/components/velux/init.py:66

  • The async_reboot_gateway service handler is missing a docstring. According to the coding guidelines, all methods and functions require docstrings explaining their purpose.
    async def async_reboot_gateway(service_call: ServiceCall) -> None:
        await pyvlx.reboot_gateway()

Comment on lines +38 to +40
self._attr_device_info = {
"identifiers": {config_entry.runtime_data.gateway_device_id}
}
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

device_info should use the DeviceInfo class from homeassistant.helpers.device_registry instead of a plain dictionary for better type safety and consistency with the rest of the codebase.

Copilot uses AI. Check for mistakes.
@wollew wollew mentioned this pull request Oct 31, 2025
21 tasks
Co-authored-by: Copilot <[email protected]>
@epenet epenet changed the title Velux: Add reboot button to gateway device Add reboot button to velux gateway device Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant