Commit Graph

130 Commits (44befe5f11390365e2ff0a7ce03133c1edd838a9)

Author SHA1 Message Date
Robert Svensson 69ac59ce73
Redact host address in UniFi diagnostics (#65379) 2022-02-01 09:52:56 -08:00
Paulus Schoutsen b05b4c4b38
Simplify unifi cleanup logic (#65345) 2022-02-01 07:22:12 +01:00
Robert Svensson da355438aa
Reconnect client service tried to connect even if device didn't exist (#65082) 2022-01-28 08:33:31 -08:00
Robert Svensson 046f0a706f
Add outlets to UniFi switch platform (#64859)
* Add outlets to UniFi switch platform

* Outlet shouldn't have entity category set
2022-01-25 07:49:02 +01:00
Robert Svensson a15bdbbc4a
UniFi events aren't reliable for device tracker usage, use last_seen instead (#64147) 2022-01-24 15:11:33 +01:00
Robert Svensson 597fca9072
Make UniFi bandwidth sensors be about current transfer rather than total transfer (#64701) 2022-01-24 13:50:54 +01:00
Robert Svensson 7e20e555dd
Redact usernames in UniFi diagnostics (#64794) 2022-01-23 23:11:06 +01:00
Robert Svensson 20072140c6
Add diagnostics support to UniFi Network integration (#64640)
* Add diagnostics support to UniFi Network integration

* Remove system info

* Add test data before trying to redact sensitive information

* Redact sensitive information from config_entry.data

* Redact a lot of different parts of the device descriptions
Redact mac addresses in such a way its possible to still view topology
2022-01-23 13:44:43 +01:00
Robert Svensson 86d32b3440
Expose UniFi controller configuration url from discovered entry (#64514) 2022-01-20 09:34:54 +01:00
Robert Svensson bc7624b417
Fix UniFi remove client service if time stamps are not integers (#63998)
* Only calculate total time if first and last seen are ints, else remove client

* Update homeassistant/components/unifi/services.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/unifi/services.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-01-13 08:15:40 +01:00
Robert Svensson 59cea56e17
Fix reconnect rather than reauth when both HA and UniFi controller restarts at the same time (#63994) 2022-01-12 15:08:04 -08:00
Robert Svensson e37456fb36
Move DPI Group logic to UniFi switch platform (#58761)
* Library has normalized management of DPI apps and groups, move logic to UniFi integration

* Bump dependency to v29

* Use a generator instead of a list - Pylint

* Minor improvements

* Improve doc strings
2022-01-12 17:11:05 +01:00
Paulus Schoutsen 2b4bb49eb7
Make device tracker entities work better (#63328)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-01-04 23:16:43 -08:00
Robert Hillis 85c122f3e5
Use enums in unifi tests (#62151) 2021-12-17 11:12:43 +01:00
Christopher Bailey 5a72c9f7c3
Rename various usages of UniFi to better identify only UniFi Network (#59568)
* Renames various usages of UniFi to better indentify only UniFi Network

* Apply suggestions from code review

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>

* Missed renames

* Updates more locations

* Removes instances of application/controller

* Missed a spot

* Updates all UniFi Controller instances

* Fixes typo

* Reverts changes to translations

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2021-11-26 22:44:49 +01:00
epenet 9eed18f121
Use SsdpServiceInfo for ssdp tests (part 1) (#60320)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-25 14:35:19 +01:00
Paulus Schoutsen 442597928e
Store: copy pending data (#59934) 2021-11-18 15:56:22 -08:00
Robert Svensson f6e38fc4e2
Fix issue where UniFi DPI groups state wasn't being updated (#58502) 2021-10-27 10:35:44 +02:00
Robert Svensson 26c5f89207
Allow data sources to affect client tracker state after reconnecting to UniFi controller (#58269) 2021-10-26 22:04:16 +02:00
Robert Svensson 47f6313e5b
Add entity category to UniFi sensors and switches (#58484) 2021-10-26 20:23:20 +02:00
Ville Skyttä cc0c79ac9a
Use http.HTTPStatus in components/[tuv]* (#58325) 2021-10-24 11:27:17 +02:00
Robert Svensson 9c1bee9c16
Add support for device configuration URL to UniFi Controller (#58237) 2021-10-22 20:04:25 +02:00
Robert Svensson ed37d2a794
New service reconnect_client for UniFi integration (#57570)
* Initial proposal of a client reconnect service

* Slim setup and teardown of services

* Minor improvements

* Add tests
2021-10-18 08:06:06 +02:00
Paulus Schoutsen a4d9019ffc
Refactor persistent notification to no longer route all data via a service (#57157)
* Convert persistent notification tests to async

* Create/dismiss persistent notifications in exposed functions, not service calls

* Fix notify persistent_notification

* Remove setting up persistent_notification

* Drop more setups

* Empty methods

* Undeprecate sync methods because too big task

* Fix setup clearing notifications

* Fix a bunch of tests

* Fix more tests

* Uno mas

* Test persistent notification events

* Clean up stale comment

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-07 12:58:00 +02:00
Robert Svensson 0916322a43
Deduplicate controls of UniFi services (#56834)
* Fix left over comments from #56717 - no need to keep UNIFI_SERVICES if we control it is only called while UNIFI_DOMAIN is empty

* Fix late comments as well

* Improve service tests

* mock.called_with was not reliable
2021-10-01 15:59:29 +02:00
Robert Svensson d61a9e8b72
Service to remove clients from UniFi Controller (#56717) 2021-09-30 14:38:29 +02:00
Robert Svensson ca6b53c16d
Remove UniFi config entry reference from device when removing last entity of said device (#56501) 2021-09-27 12:04:29 +02:00
Robert Svensson d12110556f
More restrictive state updates of UniFi uptime sensor (#53111)
* More restrictive state updates of uptime sensor

* Remove commented out old version of uptime test
2021-07-19 10:54:31 +02:00
Paulus Schoutsen ee2c950716
Merge system options into pref properties (#51347)
* Make system options future proof

* Update tests

* Add types
2021-06-01 22:34:31 +02:00
Robert Svensson d579e3427f
Use last_step marker on UniFi options flow (#50053) 2021-05-04 08:54:45 +02:00
Franck Nijhof c68b259bd3
Cleanup of unused connection_class logic (#49865)
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
2021-04-29 23:12:58 +02:00
Ville Skyttä 153d6e891e
Use config_entries.SOURCE_* constants (#49631) 2021-04-25 11:27:40 +02:00
Robert Svensson 63616a9e36
Use config_entry.on_unload rather than local listener implementation in UniFi (#49496) 2021-04-20 08:50:42 -10:00
J. Nick Koston 4cd7f9bd8b
Raise ConfigEntryAuthFailed during setup or coordinator update to start reauth (#48962) 2021-04-09 19:41:29 -10:00
Marc Mueller 54d1e9985f
Update typing 15 (#48079) 2021-03-18 15:13:22 +01:00
Robert Svensson 597bf67f5a
UniFi has changed to not report uptime in epoch form (#47492) 2021-03-12 11:55:11 -08:00
Erik Montnemery b3fecb1c95
Update tests t-z to use async_get() instead of async_get_registry() (#47655) 2021-03-09 14:25:03 +01:00
Robert Svensson 48f1a55a28
Improve common structure in UniFi device tracker tests (#47526) 2021-03-07 13:20:04 +01:00
Robert Svensson 50d3aae418
Improve restoring UniFi POE entity state (#47148)
* Improve restoring data and better handling when the restore data is empty
Improve readability of some logic related to POE clients

* There is no need to check clients_all in Switch platform

* Add better tests when restoring state

* Port except handling shouldn't be needed anymore

* Walrusify get_last_state
2021-03-05 22:09:05 +01:00
Robert Svensson 793929f2ea
Increase test coverage of UniFi integration (#46347)
* Increase coverage of init

* Increase coverage of config_flow

* Improve coverage of controller

* Minor improvement to switch test

* Fix review comment

* Mock websocket class

* Replace the rest of the old websocket event tests

* Improve websocket fixture for cleaner tests

* Fix typing

* Improve connection state signalling based on Martins feedback

* Improve tests of reconnection_mechanisms based on Martins review comments

* Fix unload entry

* Fix isort issue after rebase

* Fix martins comment on not using caplog

* Fix wireless clients test

* Fix martins comments on wireless clients test
2021-03-05 21:28:41 +01:00
Quentame 198ecb0945
Uniformize platform setup (#47101)
* A platform is not a component

* Fix dynalite

* SUPPORTED_PLATFORMS --> PLATFORMS

* In tests

* In tests 2

* Fix SmartThings

* Fix ZHA test

* Fix Z-Wave

* Revert Z-Wave

* Use PLATFORMS const in ambient_station

* Fix ihc comment
2021-03-02 21:43:59 +01:00
J. Nick Koston c9df42b69a
Add support for pre-filtering events to the event bus (#46371) 2021-02-14 09:42:55 -10:00
Robert Svensson 618fcda821
Simplify UniFi entry configuration data (#45759)
* Simplify configuration structure by removing the controller key

* Fix flake8

* Fix review comments

* Don't use migrate_entry mechanism to flatten configuration
Keep legacy configuration when creating new entries as well
2021-02-06 21:32:18 +01:00
Robert Svensson 0d620eb7c3
Add unique id to UniFi config entries using the unique id of the site it is controlling (#45737)
* Add unique id to UniFi config entries using the unique id of the site it is controlling

* Fix failing test
2021-02-05 19:38:08 +01:00
Robert Svensson ae2c7e4c74
Improve UniFi tests (#45871) 2021-02-05 16:31:47 +01:00
Robert Svensson 83a75b02ea
Code quality improvements to UniFi integration (#45794)
* Do less inside try statements

* Replace controller id with config entry id since it doesn't serve a purpose anymore

* Improve how controller connection state is communicated in the client and device tracker
Remove the need to disable arguments-differ lint

* Remove broad exception handling from config flow
I'm not sure there ever was a reason for this more than to catch all exceptions

* Replace site string with constant for SSDP title_placeholders

* Unload platforms in the defacto way

* Noone reads the method descriptions

* Improve file descriptions
2021-02-01 17:55:16 +01:00
J. Nick Koston 88c4031e57
Fix exception when a unifi config entry is ignored (#45735)
* Fix exception when a unifi config entry is ignored

* Fix existing test
2021-01-30 16:45:46 +01:00
Robert Svensson 97fd05eb9f
Allow new UniFi flows to update existing entries if host and site match (#45668) 2021-01-29 18:14:39 +01:00
Robert Svensson 26764a805b
Don't parse previous messages when UniFi connection state change to available (#45544)
* Don't parse previous messages when connection state change to available

* Disable pylint for arguments-differ W0221 message
2021-01-26 16:41:28 +01:00
J. Nick Koston b68c287ff1
Add SSDP discovery to unifi (#45364) 2021-01-21 11:03:54 -06:00