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

Merge UniFi device tracker to config entry #24367

Merged
merged 18 commits into from Jul 14, 2019

Conversation

@Kane610
Copy link
Contributor

commented Jun 7, 2019

Breaking Change:

Device tracker is now part of config entry. After initial import the unifi device tracker configuration is no longer needed. If configuring SSID filter or detection time you will need to use the new configuration from UniFi. See UniFi component documentation for details.

Description:

Allows migrate device tracker unifi configuration to config entry
Removes requirement to have an admin level account, controls are moved to the switch platform
Additional configuration handled from unifi: level.

Related issue (if applicable): fixes #24895, #23490, #21636, #19301, #14663

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#9847

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

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. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
@ghost

This comment has been minimized.

Copy link

commented Jun 7, 2019

Hey there @Kane610, mind taking a look at this pull request as its been labeled with a integration (unifi) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

@olbjan

This comment has been minimized.

Copy link

commented Jun 7, 2019

Pretty please let us filter which devices the tracker will pull off the unifi controller. The current tracker allows for filtering by site, ssid etc.- if you just import everything that will be a mess.

@Kane610

This comment has been minimized.

Copy link
Contributor Author

commented Jun 7, 2019

@olbjan when config entry options are supported in the front end, a lot of configuration is possible. Site is already part of the configuration, so a new config entry per site.

I will look into keeping the current configuration when importing to a config entry

@balloob

This comment has been minimized.

Copy link
Member

commented Jun 8, 2019

Why would it be a mess? You can just choose to not show the entities in the Lovelace UI?

@olbjan

This comment has been minimized.

Copy link

commented Jun 8, 2019

The UniFi controller can eg host multiple homes as different sites - or depending on the setup you may be tracking hundreds of devices even though they're not shown just to get the few that are actually interesting to you. We use HA at work for the office and I would eg not want it to track every cellphone connected to the guest wifi ssid whilst I may be interested in the devices on the IoT ssid.

@balloob

This comment has been minimized.

Copy link
Member

commented Jun 8, 2019

Seems like a valid use case 👍 Let's start with keeping that config in configuration.yaml and we can migrate it later to config flow options.

@Kane610 Kane610 force-pushed the Kane610:unifi-device-tracker-config-entry branch from 9ad1a28 to 164be49 Jun 9, 2019

@Kane610

This comment has been minimized.

Copy link
Contributor Author

commented Jun 9, 2019

@balloob should we define what data which is interesting for this entity type and make properties for them all? We got a possibility to shape up a lot of data here.

@balloob

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

Yes, but let' keep it rather simple. For now maybe just implement an entity that has it's own async_see function that mimics the old behavior?

@Kane610

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2019

Sure will look at that next

@Kane610 Kane610 force-pushed the Kane610:unifi-device-tracker-config-entry branch from 83ac745 to 59a379a Jun 11, 2019

@Kane610

This comment has been minimized.

Copy link
Contributor Author

commented Jun 11, 2019

@balloob isnät what you want just having each network device exposing a last_seen property?

@balloob

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

It's not just last seen. Each entity will have to schedule an update when the last seen property passes over the threshold that it is considered not home.

@Kane610

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

@balloob something like this?

@Kane610 Kane610 force-pushed the Kane610:unifi-device-tracker-config-entry branch 4 times, most recently from 5aeb9de to 533d9ff Jun 15, 2019

@balloob balloob referenced this pull request Jun 17, 2019

Merged

New scanner device tracker and ZHA device tracker support #24584

4 of 4 tasks complete

@Kane610 Kane610 force-pushed the Kane610:unifi-device-tracker-config-entry branch from 133e0df to e2e9ee3 Jul 1, 2019

@Kane610 Kane610 force-pushed the Kane610:unifi-device-tracker-config-entry branch from 113386d to 9d32e4a Jul 4, 2019

@Kane610 Kane610 marked this pull request as ready for review Jul 4, 2019

Kane610 added some commits Jul 4, 2019

@Kane610 Kane610 force-pushed the Kane610:unifi-device-tracker-config-entry branch from 8fac508 to 30b85c1 Jul 10, 2019

Kane610 added some commits Jul 11, 2019

@Kane610 Kane610 referenced this pull request Jul 13, 2019

Merged

UniFi device tracker part of config entry #9847

2 of 2 tasks complete
@MartinHjelmare
Copy link
Member

left a comment

Looks good!

@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Jul 14, 2019

From the breaking changes paragraph:

On how to configuring SSID filter or detection time you will need to use the new configuration from unifi.

This sentence sounds a bit weird. Should it start: "If configuring SSID filter or detection time you will need to..."?

@Kane610 Kane610 merged commit 01b890f into home-assistant:dev Jul 14, 2019

9 checks passed

CI Build #20190712.55 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pytlint) FullCheck Pytlint succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python35) Tests PyTest Python35 succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA

@Kane610 Kane610 deleted the Kane610:unifi-device-tracker-config-entry branch Jul 14, 2019

@balloob balloob referenced this pull request Aug 7, 2019

Merged

0.97.0 #25756

@theOrakle

This comment has been minimized.

Copy link

commented Aug 16, 2019

Are you planning on adding GPS coordinates? Ultimately, so I can track the same device with via the home assistant app on IOS... This is how I was doing it prior.

I see this in the logs when I update my location via IOS:
ERROR (MainThread) [homeassistant.components.device_tracker] The see service is not supported for this entity device_tracker.g1iphone

If not, I suppose I can make 2 devices for the same phone and tie them together via the person. Seems silly, but a pretty easy workaround.

@balloob

This comment has been minimized.

Copy link
Member

commented Aug 16, 2019

Tying things via person integration is the way forward.

Also, we should not discuss things on closed PRs.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Aug 16, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.