Skip to content

Add monitored conditions for Unifi device_tracker#15888

Merged
MartinHjelmare merged 3 commits intohome-assistant:devfrom
cgarwood:unifi_monitored_conditions
Aug 13, 2018
Merged

Add monitored conditions for Unifi device_tracker#15888
MartinHjelmare merged 3 commits intohome-assistant:devfrom
cgarwood:unifi_monitored_conditions

Conversation

@cgarwood
Copy link
Copy Markdown
Member

@cgarwood cgarwood commented Aug 8, 2018

Description:

This PR supersedes #15711

Adds a monitored_conditions config option to the Unifi device_tracker to pick and chose what extended attributes to keep from the giant list returned by the Unifi controller. Defaults to no extra attributes.

This is technically a breaking change from the current behavior.

Related issue (if applicable): fixes #14745

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5977

Example entry for configuration.yaml (if applicable):

device_tracker:
  - platform: unifi
    host: 192.168.1.201
    verify_ssl: false
    username: !secret unifi_username
    password: !secret unifi_password
    monitored_conditions:
      - signal
      - mac
      - essid
    new_device_defaults:
      track_new_devices: true

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

vol.Optional(CONF_DETECTION_TIME, default=DEFAULT_DETECTION_TIME): vol.All(
cv.time_period, cv.positive_timedelta),
vol.Optional(CONF_MONITORED_CONDITIONS):
vol.All(cv.ensure_list, [cv.string]),
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.

There should be a list of accepted conditions that we validate against here. Please look at sensor platforms that use monitored conditions for examples.

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.

Added a list of available attributes as requested

Copy link
Copy Markdown
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 MartinHjelmare merged commit 39647a1 into home-assistant:dev Aug 13, 2018
@ghost ghost removed the in progress label Aug 13, 2018
@cgarwood cgarwood deleted the unifi_monitored_conditions branch August 13, 2018 22:11
@balloob balloob mentioned this pull request Aug 29, 2018
girlpunk pushed a commit to girlpunk/home-assistant that referenced this pull request Sep 4, 2018
* Add support for monitored_conditions for attributes

* Update unifi tests

* Add list of available attrs
@edif30
Copy link
Copy Markdown
Contributor

edif30 commented Sep 5, 2018

I know this has been merged but will this work with unifi_direct_ap?

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Sep 5, 2018
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 device_tracker filling up database

4 participants