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
Member

@Kane610 Kane610 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
Copy link

ghost 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
Copy link

olbjan 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
Copy link
Member Author

Kane610 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
Copy link
Member

balloob commented Jun 8, 2019

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

@olbjan
Copy link

olbjan 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
Copy link
Member

balloob 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 unifi-device-tracker-config-entry branch from 9ad1a28 to 164be49 Compare June 9, 2019 16:46
@Kane610
Copy link
Member Author

Kane610 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
Copy link
Member

balloob 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
Copy link
Member Author

Kane610 commented Jun 10, 2019

Sure will look at that next

@Kane610 Kane610 force-pushed the unifi-device-tracker-config-entry branch from 83ac745 to 59a379a Compare June 11, 2019 20:42
@Kane610
Copy link
Member Author

Kane610 commented Jun 11, 2019

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

@balloob
Copy link
Member

balloob 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
Copy link
Member Author

Kane610 commented Jun 12, 2019

@balloob something like this?

@Kane610 Kane610 force-pushed the unifi-device-tracker-config-entry branch 4 times, most recently from 5aeb9de to 533d9ff Compare June 15, 2019 15:46
@Kane610 Kane610 force-pushed the unifi-device-tracker-config-entry branch from 133e0df to e2e9ee3 Compare July 1, 2019 21:33
@Kane610 Kane610 force-pushed the unifi-device-tracker-config-entry branch from 113386d to 9d32e4a Compare July 4, 2019 18:20
@Kane610 Kane610 marked this pull request as ready for review July 4, 2019 18:35
@Kane610 Kane610 force-pushed the unifi-device-tracker-config-entry branch from 8fac508 to 30b85c1 Compare July 10, 2019 21:38
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good!

@MartinHjelmare
Copy link
Member

MartinHjelmare 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
@Kane610 Kane610 deleted the unifi-device-tracker-config-entry branch July 14, 2019 19:57
@balloob balloob mentioned this pull request Aug 7, 2019
@theOrakle
Copy link

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
Copy link
Member

balloob 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unifi component fails in 0.95
7 participants