Skip to content

Update synology_srm to ScannerEntity #145865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

noriega3
Copy link

@noriega3 noriega3 commented May 29, 2025

Breaking change

It's converting to a config_flow, so the existing configuration.yaml will no longer work, the UI appropriately says this and documentation will be updated.

Proposed change

As per @frenck, I've reduced the amount of changes to the minimum to update to ScannerEntity.

So that the upstream synology api still worked asynchronously, I added various polling options, including a setup function and config_flow so that it can work as a ScannerEntity. Prior changes (coordinator, string consts, and code quality improvements, more py tests) will come in a future PR.

I'm still new to the structure of the HA codebase, and open if there are better ways to update such things. I took references to mikrotik, asuswrt, freebox, and fritz to help understand ScannerEntity and router type integrations in general. I found limited documentation on the old DeviceScanner, as well as trying to understand a clear path to update DeviceScanner reserved function names to ScannerEntity.

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

  • 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.

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 @aerialls, mind taking a look at this pull request as it has been labeled with an integration (synology_srm) you are listed as a code owner for? Thanks!

Code owner commands

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

username=config[CONF_USERNAME],
password=config[CONF_PASSWORD],
https=config[CONF_SSL],
)
Copy link
Author

Choose a reason for hiding this comment

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

moved this to get_api, to share the usage for config flow


def get_extra_attributes(self, device) -> dict:
Copy link
Author

Choose a reason for hiding this comment

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

moved to ScannerEntity class under extra_state_attributes


def scan_devices(self):
Copy link
Author

Choose a reason for hiding this comment

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

this function exists on line 149

@noriega3 noriega3 marked this pull request as ready for review May 29, 2025 22:58
@noriega3 noriega3 force-pushed the feature/synology-srm-scanner-entity-upgrade branch 8 times, most recently from 86745aa to dcb5405 Compare June 6, 2025 16:47
@noriega3 noriega3 force-pushed the feature/synology-srm-scanner-entity-upgrade branch 2 times, most recently from 21b984d to 877b213 Compare June 9, 2025 16:50
@noriega3 noriega3 force-pushed the feature/synology-srm-scanner-entity-upgrade branch 3 times, most recently from 7a5f05f to aa0114c Compare June 18, 2025 20:01
@noriega3 noriega3 force-pushed the feature/synology-srm-scanner-entity-upgrade branch 2 times, most recently from ed7f3c5 to fa1ef1f Compare June 25, 2025 18:56
@noriega3 noriega3 force-pushed the feature/synology-srm-scanner-entity-upgrade branch from fa1ef1f to 86e8a9a Compare July 1, 2025 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant