Skip to content

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

Merged
Kane610 merged 5 commits into
home-assistant:devfrom
Kane610:unifi-handle-wireless-clients-becoming-wired
Oct 2, 2019
Merged

UniFi - Try to handle when UniFi erroneously marks offline client as wired#26960
Kane610 merged 5 commits into
home-assistant:devfrom
Kane610:unifi-handle-wireless-clients-becoming-wired

Conversation

@Kane610
Copy link
Copy Markdown
Member

@Kane610 Kane610 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
@Kane610 Kane610 marked this pull request as ready for review October 1, 2019 06:07
@Kane610 Kane610 force-pushed the unifi-handle-wireless-clients-becoming-wired branch from 239dcf0 to cba069a Compare October 1, 2019 18:11
Comment thread homeassistant/components/unifi/__init__.py Outdated
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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why would we not pass in a list already?

Copy link
Copy Markdown
Member Author

@Kane610 Kane610 Oct 2, 2019

Choose a reason for hiding this comment

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

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


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

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

@Kane610 Kane610 merged commit 09c5b9f into home-assistant:dev Oct 2, 2019
@Kane610 Kane610 deleted the unifi-handle-wireless-clients-becoming-wired branch October 2, 2019 19:43
@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

None yet

Development

Successfully merging this pull request may close these issues.

Unifi: offline device shown as "home"

4 participants