Commit Graph

57 Commits (b25bb789168d567bd0c3d3e4c13612806f71ad30)

Author SHA1 Message Date
J. Nick Koston f352c51990
Improve unifi device tracker performance (#37308)
* Improve unifi device tracker performance

The unifi websocket sends an update every second
which generates a significant amount of state
changed updates.

Avoid creating callback functions when they
are not going to be used.

* make _no_heartbeat/_make_disconnected instance methods

* remove extra empty line

* revert is_wired change

* remove extra line
2020-07-02 17:46:37 -05:00
Robert Svensson 3a83f4bdbe
Support guest events in UniFi device tracker (#37008) 2020-06-22 21:50:34 +02:00
Robert Svensson a3865fb383
UniFi - Increase time to mark UniFi devices as away (#36366) 2020-06-02 10:35:27 +02:00
Robert Svensson 648df6d984
UniFi - Fix disabled entities being enabled after a restart (#35819)
* Async remove call removed too much, resulting in disabled entities coming back after a restart

* Calling super().async_remove is no longer needed, changed to self.async_remove

* Yes, they should be sets...
2020-05-19 23:57:41 +02:00
Robert Svensson c71b6c8a71
UniFi - Update device registry after device has been upgraded (#35430)
* Update device registry if received event saying device has been updated

* Make sure event was the last updated
2020-05-10 17:14:45 +02:00
Robert Svensson b62c7abc5d
UniFi - Additional consolidation for cleanliness sake (#35395)
* Some additional consolidation for cleanliness sake

* Remove unnecessary mac property
2020-05-09 00:34:18 +02:00
Robert Svensson c8deae6445
UniFi - Make clients proper push based (#35273)
* Improve client tracker to be more comprehensible and streamlined
Improve block switches
Improve tests

* Small clean up

* Add descriptions on ssid test

* Improve test

* Make polling default off, only POE clients left to verify

* Minor improvements

* On removal cancel scheduled updates

* POE works without polling now

* Combine else and if to an elif
2020-05-08 22:19:27 +02:00
Robert Svensson 53f64bae09
UniFi - Make devices proper push based (#35152)
* Make devices proper push based

* Improve tests

* Bump dependency to v21
Update fix from #35295 to use library
2020-05-07 09:58:04 +02:00
Robert Svensson c5ce95ff06
UniFi - Improve signalling and handling of adding new entities (#34925)
* Change signalling and handling of adding devices

* Bump aiounifi to v19
Use the proper variable for roamradio
2020-05-04 19:29:49 +02:00
Robert Svensson 7b90cbd2b2
UniFi - Disconnected clients wrongfully marked as wired not created (#34986) 2020-04-30 21:06:16 -07:00
Robert Svensson b578a76efa
UniFi - Move some preloading of unavailable clients earlier in setup phase (#34599)
Improve readability of setting up switch platform
2020-04-23 21:29:38 +02:00
Robert Svensson c3689d7416
UniFi - Store controller in config_entry.entry_id (#34553)
* Store controller in config_entry.entry_id

* Clean up imports
2020-04-23 16:48:24 +02:00
Robert Svensson 867138ebb8
UniFi - Only match ssid filter if ssid is present, this will only affect recently disconnected clients and clients which have a previously created entry in entity registry (#34509) 2020-04-21 21:13:19 +02:00
Robert Svensson e004cd029a
UniFi - Improve handling of client tracker is connected to better respect configured delay (#34510) 2020-04-21 21:12:44 +02:00
Robert Svensson f12bd7ad99
UniFi - Logs spam with not adding disabled entity (#34479)
* Proposed solution, unfortunately this makes the implementation less pretty

* Clarify why mac is registered in init
2020-04-21 06:17:14 +02:00
Robert Svensson e5a861dc90
UniFi - refactor entity management (#34367)
* Move removal of sensor entities into a base class

* Fix martins comments on sensors

* Reflect sensor changes on device_tracker platform

* Reflect sensor changes on switch platform

* Improve layering

* Make sure to clean up entity and device registry when removing entities

* Fix martins comments
2020-04-19 21:30:06 +02:00
Robert Svensson 465eeab553
UniFi - Allow tracking of clients connected to third party APs (#34067)
* Allow disable wired bug work around

* Move small improvements from closed PR #34065

* Fix failing test

* Add new test

* Some extra logging

* Harmonize log outputs

* Add config flow string

* Fix Balloobs comments
2020-04-17 08:39:01 +02:00
Robert Svensson 374fe47809
UniFi - Support automatic removal of clients (#34307) 2020-04-16 15:08:53 -07:00
Robert Svensson 529656cf64
UniFi - Improve client tracker attributes based on connection (#32817)
* Improve client tracker attributes by setting them to None when client is disconnected

* Fix martins comment
2020-04-06 01:26:11 +02:00
Paulus Schoutsen aaa1d06809
Directly call async_write_ha_state (#33508)
* Directly call async_write_ha_state

* Address comments

* Fix tests
2020-04-01 14:19:51 -07:00
Robert Svensson fa63dc1e25
UniFi - Improve expected SSID filter behavior (#32785)
* Improve expected ssid filter behavior

* Fix tests
2020-03-16 12:10:45 +01:00
Robert Svensson 015e779d56
UniFi - Client tracker schedules update on disconnect event (#32655) 2020-03-11 09:24:52 -07:00
Robert Svensson f17462b159
UniFi - Temporary workaround to get device tracker to mark cli… (#32321) 2020-02-28 10:28:03 -08:00
Jens Nistler ecd076c5e4
Mark clients away if they have never been seen. (#32222) 2020-02-27 11:50:34 -08:00
Robert Svensson 4cac0443e2
UniFi - Change handling of updated options (#31762)
* Change handling of updated options

* Add tests
2020-02-12 16:15:08 -08:00
Robert Svensson 958a867c11
UniFi integration move to push messaging (#31086)
* Rewrite UniFi integration to use push messaging

* Add signalling for new clients/devices

* Update list of known wireless clients when we get events of them connecting

* Reconnection logic for websocket

* Fix failing tests

* Bump requirement to v12

* Add new tests

* Update homeassistant/components/unifi/controller.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>
2020-01-31 20:23:25 +01:00
Robert Svensson 41d2d1f309 Handle wired bug on restart (#30276) 2019-12-30 12:40:52 -06:00
Robert Svensson 856dd63680 Add more logging to help future debug situations (#29800) 2019-12-11 15:45:21 +01:00
Robert Svensson 99328bd4c1
UniFi - honor detection time when UniFi wire bug happens (#29820) 2019-12-10 20:05:18 +01:00
Robert Svensson db0baab692 Only update disabled_by when enabled default and entity enabled states differ (#29643) 2019-12-10 11:02:26 +01:00
Bas Nijholt 2da3848f89 Sort imports according to PEP8 for unifi (#29656) 2019-12-09 12:19:33 +01:00
Robert Svensson 6565c17828
UniFi - Improve controller tests (#27261)
* Improve controller tests and harmonize setup_unifi_integration to one
* Store listeners to dispatchers to be used during reset
2019-10-07 21:55:35 +02:00
Robert Svensson 09c5b9feb3
UniFi - Try to handle when UniFi erroneously marks offline client as wired (#26960)
* Add controls to catch when client goes offline and UniFi bug marks client as wired
* Device trackers shouldn't jump between going away and home
* POE control shouldn't add normally wireless clients as POE control switches
2019-10-02 21:43:14 +02:00
Robert Svensson e2d7a01d65 Remove last of device tracker scanner (#27082) 2019-09-30 21:19:51 -07:00
Robert Svensson 0221d136de Remove support of UniFi device tracker configuration import (#26587) 2019-09-11 13:35:30 -06:00
Franck Nijhof ef0e9431b6 Use literal string interpolation in integrations T-W (f-strings) (#26394) 2019-09-03 21:12:51 +02:00
Robert Svensson b5426761f4
UniFi - Simplify getting controller from config entry (#26335)
* Simplify getting controller from config entry

* Lint ignore no longer needed

* Fix tests
2019-09-01 17:57:25 +02:00
Robert Svensson d9ef92f6d2
UniFi - use entity registry disabled_by to control available entities (#26141)
* Move ignoring logic to entity registry enabled default

* Handle config to option import better

* Properly enable and disable entity registry entries on changes from config entry options

* Fix balloobs comments

* Fix some tests

* Fix tests

* Simplify updating disable on entities

* Simplify device tracker update function

* Local entity disabled replaced on rebase

* Only alter entities with changed options

* Proper tracking of changed options

* Back to straightforward updating of disabled
2019-08-31 22:04:04 +02:00
Robert Svensson 0d7326168e UniFi - dont schedule updates on disabled entities (#26278)
* Dont schedule updates on disabled entities

* Use entity enabled since it is available
2019-08-29 14:04:01 -07:00
Robert Svensson 588eac82c7
UniFi config entry options (#26113)
Introduce config entry options for Unifi integration
Allow configuration.yaml options to be imported to new options
2019-08-21 22:22:42 +02:00
Robert Svensson 5ca6c990cf
UniFi - add ap_mac to attributes (#26004) 2019-08-16 20:29:38 +02:00
Robert Svensson ab7db5fbd0
UniFi - Use state to know if device is online (#25876) 2019-08-11 22:40:44 +02:00
jjlawren 8f2f770837 Don't track unstable attributes (#25787) 2019-08-08 14:43:53 -05:00
Robert Svensson c76531a366 Fix last seen not available on certain devices (#25735) 2019-08-06 14:55:36 -07:00
Robert Svensson 7ff7c7b9f5
UniFi - handle device not having a name (#25713)
* Handle device not having a name
2019-08-06 07:00:06 +02:00
Robert Svensson 5a90b49e27
In some circumstances device.last_seen can be None (#25690) 2019-08-04 16:12:16 +02:00
Robert Svensson 93dfd613aa
Options to not track wired clients (#25669) 2019-08-02 23:51:06 +02:00
Robert Svensson 39257164a9
UniFi - allow configuration to not track clients or devices (#25642)
* Allow configuration to not track clients or devices
2019-08-02 10:13:00 +02:00
Robert Svensson ceac35797e
Handle disabled devices (#25625) 2019-08-01 17:22:08 +02:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00