Commit Graph

234 Commits (16fd19f01af5cd7bee16278aff2016e539007d16)

Author SHA1 Message Date
Robert Svensson 3232fd0eaf
Improve UniFi config flow tests (#118587)
* Use proper fixtures in config flow tests

* Improve rest of config flow tests

* Small improvement

* Rename fixtures
2024-06-01 00:27:53 +02:00
Robert Svensson a7938091bf
Use fixtures to setup UniFi config entries (#118126) 2024-05-26 16:30:22 +02:00
Robert Svensson fa815234be
Make UniFi use runtime data (#117457) 2024-05-14 21:04:26 +02:00
Erik Montnemery 90a50c162d
Use MockConfigEntry in unifi tests (#117238) 2024-05-11 11:11:53 +02:00
wittypluck 7a10959e58
Use websocket client to test device removal in Unifi (#116309)
* Use websocket client to test device removal from registry

* Rename client to ws_client to avoid confusion with Unifi clients

* Use remove_device helper
2024-05-01 08:46:03 +02:00
Kim de Vos b69f589c30
Add bandwidth sensor for unifi device ports (#115362) 2024-04-22 22:39:46 +02:00
Robert Svensson 83370a5bde
Remove sensor exposing UniFi WLAN password (#115929) 2024-04-21 20:27:44 +02:00
wittypluck 1c0c0bb0bc
Allow manual delete of stale Unifi device from UI (#115267)
* Allow manual delete of stale device from UI

* Add unit tests for remove_config_entry_device
2024-04-21 11:08:39 +02:00
Kim de Vos f23e48f373
Add sensor for CPU and memory utilization for unifi device (#114986)
Add system stats to unifi device sensors
2024-04-08 19:29:54 +02:00
Joost Lekkerkerker f3ba713289
Use FlowResultType enum in config flow tests N-Z (#114682)
Use FlowResultType enum in config flow tests
2024-04-03 09:53:20 +02:00
Joost Lekkerkerker 2ef0521d3d
Use is in enum comparison in config flow tests U-Z (#114677)
* Use right enum expression U-Z

* Fix
2024-04-02 23:09:56 +02:00
Bruno Henrique 9f9a141112
Add UniFi WLAN Password sensor (#114419)
* Adding UniFi WLAN Password Sensor

* Adding UniFi WLAN Password Sensor

* Adding UniFi WLAN Password Sensor

* Adding UniFi WLAN Password Sensor

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

* Adding UniFi WLAN Password Sensor

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

* Adding UniFi WLAN Password Sensor

* Adding UniFi WLAN Password Sensor

* Adding UniFi WLAN Password Sensor

---------

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2024-03-30 19:49:33 +01:00
Bruno Henrique 53f262095c
Add UniFi WLAN regenerate password button (#114422)
* Adding UniFi WLAN Change Password Button

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

* Adding UniFi WLAN Regenerate Password Button

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

---------

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2024-03-30 15:53:23 +01:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
J. Nick Koston 4f18f0d902
Fix setup timings when config entry platform loads are not awaited (#113959)
* Move setup time logging into the context manager

We were fetching the time twice but since the context
manager already has the timing, move it there

* remove log setup assertions from integration test

* tweak logging to give us better data for tracking issues

* redundant

* adjust

* preen

* fixes

* adjust

* make api change internal so nobody uses it

* coverage

* fix test

* fix more tests

* coverage

* more tests assuming internal calls

* fix more

* adjust

* adjust

* fix axis tests

* fix broadlink -- it does not call async_forward_entry_setup

* missed some

* remove useless patch

* rename, detect it both ways

* clear

* debug

* try to fix

* handle phase finishing out while paused

* where its set does not need to know its late as that is an implemenation detail of setup

* where its set does not need to know its late as that is an implemenation detail of setup

* tweak

* simplify

* reduce complexity

* revert order change as it makes review harder

* revert naming changes as it makes review harder

* improve comment

* improve debug

* late dispatch test

* test the other way as well

* Update setup.py

* Update setup.py

* Update setup.py

* simplify

* reduce
2024-03-23 15:26:38 -04:00
Robert Svensson f2879e6f39
Break out UniFi platform registration to its own class (#112514) 2024-03-09 09:18:23 +01:00
Marc Mueller 32f3f46542
Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc Mueller 87165c0d6e
Add empty line after module docstring [tests t-z] (#112712) 2024-03-08 14:44:56 +01:00
Robert Svensson 7c9891fff9
Break out UniFi config handling to own class (#111325) 2024-03-05 21:36:26 +01:00
Robert Svensson ab4750c2ea
Remove unnecessary access to UniFi hub object in tests (#112275)
* Remove unnecessary access to UniFi hub object

* Split strings

* Skip + on concatenating f-strings

* Use single quotes inside double quotes
2024-03-05 08:23:17 +01:00
Robert Svensson efc89cd34f
Unifi websocket manager (#111041)
* Move hub into .hub.hub

* Move websocket to own module

* Minor shuffle
2024-02-24 16:20:59 -05:00
Robert Svensson 2f026ca963
Unifi rename controller to hub (#110976)
* Rename controller.py to hub.py

* Rename UniFiController to UnifiHub

* Rename controller instances into hub

* Rename controller to hub in tests

* Rename aiounifi Controller references to api

* Update strings

* Rename test_controller test_hub

* Narrow scope of test_remove_sensors
2024-02-20 08:51:22 +01:00
Jan-Philipp Benecke 22e62f42e6
Use entity & device registry fixtures in unifi tests (#110889) 2024-02-18 23:47:10 +01:00
wittypluck 7d24ae88e6
Mark Unifi bandwidth sensors as unavailable when client disconnects (#109812)
* Set sensor as unavailable instead of resetting value to 0 on disconnect

* Update unit test on unavailable bandwidth sensor
2024-02-06 18:33:10 +01:00
Marc Mueller 8b0c9d3d18
Use builtin TimeoutError [t-z] (#109683) 2024-02-05 12:20:36 +01:00
Robert Svensson f1392f8519
Try to reconnect to UniFi on 403 (#109067) 2024-01-29 21:39:15 +01:00
J. Nick Koston fb62b6f01e
Fix unifi test_tracked_clients test (#108638)
Fix unifi test_tracked_clients client

This test relied on the sensor platform getting set up and creating
the device before the device_tracker platform was setup since the
device_tracker platform will disable the entity because there is
not matching device entry for it via

4ee6735cbb/homeassistant/components/device_tracker/config_entry.py (L336)

There is no guarantee the sensor platform will get set up before
the device tracker platform so the test was subject to a race
where it would fail if the device tracker platform was setup first
2024-01-22 08:35:24 +01:00
wittypluck d94421e1a4
Reset UniFi bandwidth sensor when client misses heartbeat (#104522)
* Reset UniFi bandwidth sensor when client misses heartbeat

* Fix initialization sequence

* Code simplification: remove heartbeat_timedelta, unique_id and tracker logic

* Add unit tests

* Remove unused _is_connected attribute

* Remove redundant async_initiate_state

* Make is_connected_fn optional, heartbeat detection will only happen if not None

* Add checks on is_connected_fn
2024-01-14 15:19:43 +01:00
Joseph Block 1271f16385
Add Unifi device state for additional diagnostics (#105138)
* Add device state for additional diagnostics

* Add state test and fix existing tests

* Utilize IntEnum and dict for state lookup

* Update aiounifi to v68
2023-12-16 08:38:21 +01:00
Erik Montnemery 6908497c3d
Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
Jan-Philipp Benecke b5785003a3
Migrate unifi tests to use freezegun (#105343) 2023-12-09 12:55:40 +01:00
Robert Svensson 6271fe333d
Rework some UniFi unique IDs (#104390) 2023-11-24 11:18:55 +01:00
Robert Svensson d78c0bd948
Handle 403 errors in UniFi (#104387)
UniFi handle 403 error
2023-11-23 20:25:26 +01:00
Robert Svensson edf18df0e6
Add PoE power cycle button to UniFi integration (#104332) 2023-11-22 07:02:49 +01:00
Robert Svensson f1fd8a0d2b
Bump aiounifi to v66 (#104336) 2023-11-22 07:02:13 +01:00
Robert Svensson 40817dabbf
Bump aiounifi to v64 (#102700) 2023-10-24 20:27:42 -05:00
Robert Svensson 721c45b7a3
Rework UniFi client configuration (#99483) 2023-10-22 23:39:54 +02:00
wittypluck b79eae2e94
Update Unifi bandwidth sensors (#101598)
* Change bandwidth sensors device class, state class, unit of measurement, icon

* Reformat imports

* Reformat imports

* Revert suggested_unit_of_measurement. Add unit tests.
2023-10-22 17:14:49 +02:00
Robert Svensson 01b5854968
Rework UniFi websocket (#100614)
* Rework websocket management

* remove unnecessary fixture

* Remove controller from mock_unifi_websocket

* Mock api.login in reconnect method

* Remove unnecessary edits

* Minor clean up

* Bump aiounifi to v63

* Wait on task cancellation
2023-09-27 10:56:24 +02:00
Robert Svensson 7b00265cfe
Remove legacy UniFi PoE client clean up (#100318) 2023-09-13 20:14:03 +02:00
Robert Svensson d8445a79fc
UniFi streamline loading platforms (#100071)
* Streamline loading platforms

* Move platform registration logic to UnifiController class
2023-09-11 15:55:27 +02:00
Robert Svensson cf47a6c515
Add UniFi device uptime and temperature sensors (#99307)
* Add UniFi device uptime and temperature sensors

* Add native_unit_of_measurement to temperature
Remove seconds and milliseconds from device uptime
2023-09-09 11:12:44 +02:00
Robert Svensson b0e40d95ad
Bump aiounifi to v61 (#99686)
* Bump aiounifi to v61

* Alter a test to cover the upstream change
2023-09-05 21:13:28 +02:00
J. Nick Koston 80d2309896
Switch async_track_time_interval to use async_call_later internally (#99220) 2023-08-28 13:56:22 -05:00
Robert Svensson 5e5193eeb5
Rework UniFi Network Controller device and add software version (#99136)
Rework Network Controller device and add software version
2023-08-27 17:07:38 +02:00
Robert Svensson 71bf782b22
Improve UniFi PoE control by queueing commands together (#99114)
* Working draft without timer

* Clean up
Improve tests

* Use async_call_later
2023-08-27 16:58:48 +02:00
Robert Svensson 45efe29262
Bump aiounifi to v58 (#99103) 2023-08-26 18:27:45 -05:00
Marc Mueller 72e6f79086
Replace remaining utcnow calls + add ruff check (#97964) 2023-08-25 03:23:43 +02:00
Robert Svensson d0d160f11c
Unifi add port forward control to switch platform (#98309) 2023-08-21 22:01:44 +02:00
Robert Svensson 9e42451934
UniFi refactor using site data (#98549)
* Clean up

* Simplify admin verification

* Streamline using sites in config_flow

* Bump aiounifi
2023-08-18 22:44:59 +02:00