* Added UniFi Uptime sensor
Added the UniFi uptime data as a sensor. Untested.
* Update sensor.py
Updated code as a result of the tests.
* Changed timestamp format and device class
Converted state to iso timestamp and changed device class to DEVICE_CLASS_TIMESTAMP.
* Updated unit of measurement to None
* Added import
* Update homeassistant/components/unifi/sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Removed whitespace
* Added the uptime sensors option to the config flow
* All the unit tests should be there now
* Whoops
* Fixed translation
* Properly formatted the code
* Flake8 really has angel eyes
* Black should also be satisfied now
* Should have satisfied all static code analysis tools
* Fixed add uptime sensor function
* Fixed overintendation
* Fixed unit tests
* Made a spelling mistake during editing of unit tests
* Test verifies if utc time is correct
* Converted to iso format
* Converted unit test to iso format
* Unit test sensor json had the wrong uptime name
* Added options_updated handler
* Fixed remove sensors unit test
* Update homeassistant/components/unifi/sensor.py
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
* Update homeassistant/components/unifi/sensor.py
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
* Update test_device_tracker.py
Removed uptime from the devices
* Fixed black formatting issue
* I think the code coverage should be good now
* Trying to add the sensors again
* Using signals to hopefully trigger the controller to add them again
* Forgot import
* Sorted components
* fixed isort comments
* Removed CLASS and DEVICE_CLASS
* Added TYPE again
* Removed double underscores
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
* Remove unnecessary exception re-wraps
* Preserve exception chains on re-raise
We slap "from cause" to almost all possible cases here. In some cases it
could conceivably be better to do "from None" if we really want to hide
the cause. However those should be in the minority, and "from cause"
should be an improvement over the corresponding raise without a "from"
in all cases anyway.
The only case where we raise from None here is in plex, where the
exception for an original invalid SSL cert is not the root cause for
failure to validate a newly fetched one.
Follow local convention on exception variable names if there is a
consistent one, otherwise `err` to match with majority of codebase.
* Fix mistaken re-wrap in homematicip_cloud/hap.py
Missed the difference between HmipConnectionError and
HmipcConnectionError.
* Do not hide original error on plex new cert validation error
Original is not the cause for the new one, but showing old in the
traceback is useful nevertheless.
* 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