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

UniFi - Try to handle when UniFi erroneously marks offline client as wired #26960

Conversation

@Kane610
Copy link
Member

commented Sep 27, 2019

Breaking Change:

Description:

There is an issue with UniFi that when the client goes offline that it is marked as wired and with a different time stamp, this makes it hard to use the client tracker since it will look like the client is at home. This makes some improvements toto handle not creating faulty POE control switches.

Related issue (if applicable): fixes #25915 #25893

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

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.
@Kane610 Kane610 self-assigned this Sep 27, 2019
@project-bot project-bot bot added this to Needs review in Dev Sep 27, 2019
@MartinHjelmare MartinHjelmare moved this from Needs review to Incoming in Dev Sep 28, 2019
@Kane610 Kane610 marked this pull request as ready for review Oct 1, 2019
@MartinHjelmare MartinHjelmare moved this from Incoming to Needs review in Dev Oct 1, 2019
Kane610 added 2 commits Sep 27, 2019
@Kane610 Kane610 force-pushed the Kane610:unifi-handle-wireless-clients-becoming-wired branch from 239dcf0 to cba069a Oct 1, 2019
def update_data(self, data, config_entry):
"""Update data and schedule to save to file."""
controller_id = get_controller_id_from_config_entry(config_entry)
self.data[controller_id] = list(data)

This comment has been minimized.

Copy link
@balloob

balloob Oct 1, 2019

Member

Why would we not pass in a list already?

This comment has been minimized.

Copy link
@Kane610

Kane610 Oct 2, 2019

Author Member

data is a set from one specific controller containing all known wireless devices

@@ -128,6 +130,22 @@ def signal_options_update(self):
"""Event specific per UniFi entry to signal new options."""
return f"unifi-options-{CONTROLLER_ID.format(host=self.host, site=self.site)}"

def update_wireless_clients(self):
"""Update set of known to be wireless clients."""
wireless_clients = set()

This comment has been minimized.

Copy link
@balloob

balloob Oct 1, 2019

Member

If you prefer sets, just convert it to sets when you load the data and convert it to lists when you save it.

This comment has been minimized.

Copy link
@Kane610

Kane610 Oct 2, 2019

Author Member

This is just a local list to know which new wireless clients we see from last update

Kane610 added 2 commits Oct 2, 2019
@Kane610 Kane610 merged commit 09c5b9f into home-assistant:dev Oct 2, 2019
10 of 11 checks passed
10 of 11 checks passed
codecov/patch 90.47% of diff hit (target 94.31%)
Details
CI Build #20191002.87 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate 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
codecov/project 94.31% (target 90%)
Details
Dev automation moved this from Needs review to Done Oct 2, 2019
@Kane610 Kane610 deleted the Kane610:unifi-handle-wireless-clients-becoming-wired branch Oct 2, 2019
@lock lock bot locked and limited conversation to collaborators Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
3 participants
You can’t perform that action at this time.