Skip to content
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

Keep SSH connection open? #1

Open
Lx opened this issue Dec 4, 2024 · 1 comment
Open

Keep SSH connection open? #1

Lx opened this issue Dec 4, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Lx
Copy link

Lx commented Dec 4, 2024

Is your feature request related to a problem? Please describe.
I am trying to increase the scan frequency for better presence detection (12 seconds at the moment). I am finding that unifi_ap spends a lot of time establishing and tearing down the SSH connection. I believe that this is a contributing factor to a warning occurring regularly in my logs:

WARNING (MainThread) [homeassistant.components.device_tracker] Updating device list from legacy took longer than the scheduled scan interval 0:00:12

Describe the solution you'd like
I would like to see unifi_ap set up the SSH connection once, keep it alive between its calls to mca-dump, and only re-establish the SSH connection when required (for example, due to unexpected connection losses). This would reduce burden on the AP and also the Home Assistant host while also reducing the overall time required to obtain new data.

Describe alternatives you've considered
I have considered these alternatives:

  • Reduce the scan frequency. However, it doesn't really reduce the amount of time spent doing SSH work per pass. A reduced frequency also makes it harder for me to achieve my goal.
  • Use the UniFi Network integration instead. However, this requires permanently running the UniFi Network application, which is resource-heavy and would cause avoidable degradation of my available resources.

Additional context
I live in a high-density area with bad GPS reception, making Home Assistant's traditional methods of home/away detection useless for me. I want Home Assistant to detect, as early as reasonably possible, when I am near my apartment. My phone connects to my home Wi-Fi from outside my apartment. I can therefore theoretically use the Home Assistant app to send a message to my Home Assistant host when my phone successfully connects to my home Wi-Fi. However, my UniFi setup is able to alert Home Assistant to my presence several seconds faster, so this is my preferred mechanism for generating an "I have arrived at home" event as it reduces the chance that I will need to wait several seconds at my front door for it to unlock.

@Lx Lx added the enhancement New feature or request label Dec 4, 2024
@tofuSCHNITZEL
Copy link
Owner

Thanks for the suggestion. This is a good point, definitely something to consider when giving the whole integration an overhaul.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants