home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.03k stars 28.27k forks source link

Avoid duplicate data fetch during Synologs DSM setup #116839

Closed mib1185 closed 1 week ago

mib1185 commented 1 week ago

Proposed change

we already setup the api in

https://github.com/home-assistant/core/blob/f5394dc3a3d023b3cb22dafc8d8435679fcda408/homeassistant/components/synology_dsm/__init__.py#L66-L69

so the first data fetch of the central coordinator is not needed and just leads to a duplicated fetch of all data at startup

prior this change:

2024-05-05 08:53:31.194 INFO (MainThread) [homeassistant.setup] Setting up synology_dsm
2024-05-05 08:53:32.106 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] State of Surveillance_station during setup of '21B0R2RQ4TNT0': False
2024-05-05 08:53:32.200 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable security api updates for '21B0R2RQ4TNT0'
2024-05-05 08:53:32.201 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable photos api updates for '21B0R2RQ4TNT0'
2024-05-05 08:53:32.201 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable storage api updates for '21B0R2RQ4TNT0'
2024-05-05 08:53:32.201 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable upgrade api updates for '21B0R2RQ4TNT0'
2024-05-05 08:53:32.201 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable system api updates for '21B0R2RQ4TNT0'
2024-05-05 08:53:32.201 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable utilisation api updates for '21B0R2RQ4TNT0'
2024-05-05 08:53:32.201 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Start data update for '21B0R2RQ4TNT0'
2024-05-05 08:53:32.201 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Entities not added yet, fetch all for '21B0R2RQ4TNT0'
2024-05-05 08:53:39.273 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Start data update for '21B0R2RQ4TNT0'
2024-05-05 08:53:39.273 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Entities not added yet, fetch all for '21B0R2RQ4TNT0'
2024-05-05 08:53:40.497 DEBUG (MainThread) [homeassistant.components.synology_dsm.coordinator] Finished fetching 192.168.100.200 SynologyDSMCentralUpdateCoordinator data in 1.224 seconds (success: True)

image

with this change

2024-05-05 09:10:07.376 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] State of Surveillance_station during setup of '21B0R2RQ4TNT0': False
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable security api updates for '21B0R2RQ4TNT0'
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable photos api updates for '21B0R2RQ4TNT0'
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable storage api updates for '21B0R2RQ4TNT0'
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable upgrade api updates for '21B0R2RQ4TNT0'
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable system api updates for '21B0R2RQ4TNT0'
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Enable utilisation api updates for '21B0R2RQ4TNT0'
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Start data update for '21B0R2RQ4TNT0'
2024-05-05 09:10:07.476 DEBUG (MainThread) [homeassistant.components.synology_dsm.common] Entities not added yet, fetch all for '21B0R2RQ4TNT0'

image

cc @bdraco

Type of change

Additional information

Checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

To help with the load of incoming pull requests:

home-assistant[bot] commented 1 week ago

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

Code owner commands Code owners of `synology_dsm` 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_dsm` 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.
bdraco commented 1 week ago

Looks right to me. Tagged since we are having timeout issues.

Will check on my production system shortly and approve if all is well

mib1185 commented 1 week ago

thanks for additional tests with using cameras 👍