Skip to content

Refactor services.py #253

Open
Open

Description

@steinmn

async_setup_services should be run in async_setup, not in async_setup_entry (https://developers.home-assistant.io/docs/core/integration-quality-scale/rules/action-setup/) and async_unload_services seems to have been dropped entirely (home-assistant/core#146048 (comment)). Haven't been able to find where the recommendation this comment refers to is, but I do see that `async_unload_services is no longer used anywhere in the core-repo.

Looking at some of the integrations in core that implement async_setup_services, they rarely contain more than hass.services.async_register-calls within the function itself.

Prerequisite:
Ensure good test coverage for services before refactoring to avoid introducing regressions.

Main tasks:

  • Move call to async_setup_services from async_setup_entry to async_setup
  • Move function definitions out of async_setup_services
  • Investigate if iter_objects can be simplified and/or makes more sense as a function inside ZaptecManager
  • remove async_unload_services

Activity

  1. added this to the next milestone on Aug 2, 2025
  2. removed this from the v0.8.2 milestone on Aug 17, 2025
  3. added this to the want milestone on Jul 24, 2026
  4. rhammen commented on Jul 24, 2026

    @rhammen
    Contributor

    @sveinse This issue will be fixed with open PR #402 . You can set the milestone you think is appropriate.

  5. added a commit that references this issue on Jul 28, 2026
    e1766d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions