Commit Graph
100 Commits
Author SHA1 Message Date
Bas NijholtandPaulus Schoutsen fb7af0384f bump aiokef to 0.2.10 (#36574)
0.2.9 generated a lot of calls on the event loop.
2020-06-09 12:39:07 -07:00
Bas NijholtandGitHub 5e2de4531f bump aiokef to 0.2.10 (#36574)
0.2.9 generated a lot of calls on the event loop.
2020-06-08 14:05:55 -07:00
dcb04acc65 Set automation last_triggered earlier (#35671)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-06-03 20:08:37 +02:00
Bas NijholtandGitHub e6065569ae Use Coerce(float) on service options for kef (#35659)
* use Coerce(float) on service options

* defer the type from options list
2020-05-24 12:10:15 +02:00
Bas NijholtandPaulus Schoutsen 81d006499e Pass an argument to kef.update_dsp for async_track_time_interval (#34310) 2020-04-16 17:45:24 -07:00
Bas NijholtandGitHub 8bd0fca751 Pass an argument to kef.update_dsp for async_track_time_interval (#34310) 2020-04-16 14:54:39 -07:00
Bas NijholtandPaulus Schoutsen 885cf20afa Fix kef DSP_SCAN_INTERVAL timedelta (#33825)
reported on https://community.home-assistant.io/t/kef-ls50-wireless/70269/134
2020-04-08 20:46:00 -07:00
Bas NijholtandGitHub ceb171974d Fix kef DSP_SCAN_INTERVAL timedelta (#33825)
reported on https://community.home-assistant.io/t/kef-ls50-wireless/70269/134
2020-04-08 12:48:46 -07:00
Bas NijholtandGitHub 588409c784 Fix isort problem in homeassistant/requirements.py (#33828) 2020-04-08 12:48:20 -07:00
Bas NijholtandGitHub 3e0ccd2e86 Add KEF services for DSP (#31967)
* add services for DSP

* add homeassistant/components/kef/const.py

* add services.yaml

* fix set_mode

* fix services

* media_player.py fixes

* bump aiokef to 0.2.9

* update requirements_all.txt

* add basic sensor.py

* add DSP settings as attributes

* add message about kef.update_dsp

* remove sensor.py

* fix pylint issues

* update_dsp inside async_added_to_hass

* use {...} instead of dict(...)

* get DSP settings when connecting to HA or once on update

* simplify condition

* do not get mode twice

* remove async_added_to_hass

* use async_register_entity_service

* remove entity_id from schema and prepend _value

* invalidate self._dsp after setting a DSP setting

* schedule update_dsp every hour

* subscribe and unsubscribe on adding and removing to HA

* don't pass hass and set _update_dsp_task_remover to None after removing
2020-03-30 10:45:24 -07:00
Bas NijholtandGitHub 8498ca37cd Fix moving average test for discrete derivative sensor (#31750)
* fix test_data_moving_average_for_discrete_sensor

After https://github.com/home-assistant/home-assistant/pull/31717 the test
didn't actually test anything anymore.

This fixes that.

* make the test faster
2020-02-12 09:53:06 -08:00
Bas NijholtandPaulus Schoutsen 10d5ce24f6 Keep track of the derivative for unit_time (#31397)
* keep track of the derivative for unit_time

In this way, you will get a better estimate of the derivate during
the timescale that is relavant to the sensor.

This solved a problem where sensors have a low output resolution.
For example a temperature sensor that can only be integer numbers.

It might report many values that are the same and then suddenly go up one value.
Only in that moment (with the current implementation) the derivative will be finite.

With my proposed implementation, this problem will not occur, because it takes the average
derivative of the last `unit_time`.

* only loop as much as needed

* treat the special case of 1 entry

* add option time_window

* use cv.time_period

* fix comment

* set time_window=0 by default

* rephrase comment

* use timedelta for time_window

* fix the "G" unit_prefix and add more prefixes

https://en.wikipedia.org/wiki/Unit_prefix

* add debugging lines

* simplify logic

* fix bug where the there was a division of unit_time instead of multiplication

* simplify tests

* add test_data_moving_average_for_discrete_sensor

* fix test_dataSet6

* improve readability of the tests

* better explain the test

* remove debugging log lines
2020-02-04 09:27:03 -08:00
Bas NijholtandGitHub 119566f280 Keep track of the derivative for unit_time (#31397)
* keep track of the derivative for unit_time

In this way, you will get a better estimate of the derivate during
the timescale that is relavant to the sensor.

This solved a problem where sensors have a low output resolution.
For example a temperature sensor that can only be integer numbers.

It might report many values that are the same and then suddenly go up one value.
Only in that moment (with the current implementation) the derivative will be finite.

With my proposed implementation, this problem will not occur, because it takes the average
derivative of the last `unit_time`.

* only loop as much as needed

* treat the special case of 1 entry

* add option time_window

* use cv.time_period

* fix comment

* set time_window=0 by default

* rephrase comment

* use timedelta for time_window

* fix the "G" unit_prefix and add more prefixes

https://en.wikipedia.org/wiki/Unit_prefix

* add debugging lines

* simplify logic

* fix bug where the there was a division of unit_time instead of multiplication

* simplify tests

* add test_data_moving_average_for_discrete_sensor

* fix test_dataSet6

* improve readability of the tests

* better explain the test

* remove debugging log lines
2020-02-03 14:22:47 -08:00
Bas NijholtandGitHub 3275987f17 Add play, pause, previous and next track to kef (#31373)
* KEF: add support for play, pause, next track, and previous track

* bump aiokef to 0.2.7

* run isort

* do not dynamically change the supported features
2020-02-01 17:38:36 +01:00
Bas NijholtandGitHub 89ae255de7 Bump pyhaversion to 3.2.0 (#31241)
* upgrade to pyhaversion=3.2.0

* bump to pyhaversion==3.2.0 in manifest.json
2020-01-29 08:54:21 +01:00
Bas NijholtandMartin Hjelmare a010577d6e Add kef supports_on option (#30937)
* add supports_on_off option

* modify support_kef inplace

* all speakers support turning off remotely
2020-01-20 14:24:13 +01:00
Bas NijholtandPaulus Schoutsen 9de800ab6a bump aiokef to 0.2.5 which uses locks (#30753) 2020-01-14 12:59:41 -08:00
Bas NijholtandPascal Vizeli a26fef38a2 bump aiokef to 0.2.5 which uses locks (#30753) 2020-01-14 17:41:52 +01:00
Bas NijholtandMartin Hjelmare 0d5486f772 Add KEF speakers integration (#28959)
* add KEF speakers platform for the integration

This will work with the KEF LS50 Wireless and KEF LSX speakers.
The development of this code happened on https://github.com/basnijholt/media_player.kef

* rename DATA_KEF -> DOMAIN

* use aiokef v0.2.0 and support LSX and new features

* sort imports

* fix @MartinHjelmare's suggestions

* remove _CONFIGURING

* change STATE_UNKNOWN to None

* use lat and long for unique_id

* bump aiokef to v0.2.2

* use config[ATTR] instead of config.get(ATTR)

* use getmac

* fix case when MAC is None

* use host as instance lifetime id

* fix requirements
2020-01-03 14:59:44 +01:00
Bas NijholtandPaulus Schoutsen de94afd090 add --show-diff-on-failure to pre-commit (#30097)
This makes the traceback on a failing CI pipeline much more useful.
2019-12-20 22:00:31 +01:00
Bas NijholtandPaulus Schoutsen c59bf0bff6 genericpath is an internal Python module and shouldn't be imported according to core Python devs. (see [this](https://bugs.python.org/msg358136) comment) (#29903)
For a reason unknown to me, @exxamalte introduced this in https://github.com/home-assistant/home-assistant/pull/14342.

The problem is that Linux and macOS implement `os.path` differently, one imports from [`ntpath.py`](https://github.com/python/cpython/blob/master/Lib/ntpath.py) and the other one from [`posixpath.py`](https://github.com/python/cpython/blob/master/Lib/posixpath.py), and both these files use `genericpath.py`.

Somehow, `isort` on macOS will see `genericpath` as a third party library and sort it accordingly.
Other Unix-based OSes will correctly treat `genericpath` as an internal library.

This problem led to a sorting sequence in the following commits:

- ca0fad2cbb
- f5d4878992
- 7d68e88d31
- 1fee400dcd

This supersedes https://github.com/home-assistant/home-assistant/pull/29893.
2019-12-13 09:47:09 +01:00
c58c10ab7c Add isort to CI and pre-commit (#29739)
* add isort to CI and pre-commit

* disable wrong-import-order in pylintrc

* ✏️ Tweak


Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2019-12-12 15:58:47 +01:00
Bas NijholtandFranck Nijhof 7d68e88d31 Sort import for tests/components/feedreader/test_init.py (#29878)
This unblocks https://github.com/home-assistant/home-assistant/pull/29739
2019-12-12 15:56:32 +01:00
Bas NijholtandFranck Nijhof 004af97699 Sort imports for requirements.py and its test using isort (#29836)
Unblocks https://github.com/home-assistant/home-assistant/pull/29739
2019-12-11 12:12:06 +01:00
Bas NijholtandFranck Nijhof 7f948594eb Sort imports according to PEP8 for google_assistant (#29633)
* sort imports and fix flake8 issue for google

* add isort:skip to EVENT_SYNC_RECEIVED
2019-12-09 20:00:14 +01:00
Bas NijholtandFranck Nijhof e37443f10c Sort imports according to PEP8 for components starting with "U" (#29779)
* use isort to sort imports for components starting with 'u'

* add 'pylint: disable=import-error' to the right place
2019-12-09 19:07:32 +01:00
Bas NijholtandFranck Nijhof 80c344d3a8 Sort imports according to PEP8 for huawei_lte (#29664) 2019-12-09 19:06:25 +01:00
Bas NijholtandFranck Nijhof 897522a82d Fix 'pytest.register_assert_rewrite("tests.common")' warning (#29797)
see https://github.com/home-assistant/home-assistant/pull/29791/files/fea243c035f117275fda1895720d30e7f977aa9c#r355533273
2019-12-09 19:04:38 +01:00
Bas NijholtandFranck Nijhof 080c702d4f Sort imports according to PEP8 for components starting with "C" (#29763) 2019-12-09 18:56:21 +01:00
Bas NijholtandFranck Nijhof 6cc75fc6f3 Sort imports according to PEP8 for components starting with "Z" (#29784)
* use isort to sort imports for components starting with 'z'

* add skip to end of zha/core/channels/__init__.py

* put 'pylint: disable=import-error' at the right place

* remove the import of config_flow in zha/__init__.py

According to @balloob it is no longer needed.

* revert previous commit

* isort:skip homeassistant/components/zha/__init__.py completely
2019-12-09 18:54:54 +01:00
Bas NijholtandFranck Nijhof 08f128e9c7 Sort imports according to PEP8 for components starting with "D" (#29764)
* use isort to sort imports for components starting with 'd'

* fix isort mistake
2019-12-09 17:42:00 +01:00
Bas NijholtandFranck Nijhof f60125b5c9 Sort imports according to PEP8 for 'tests' (#29791) 2019-12-09 16:52:24 +01:00
Bas NijholtandFranck Nijhof 67c56c860d Sort imports according to PEP8 for 'homeassistant' folder (#29789)
Components are already done
2019-12-09 16:42:10 +01:00
Bas NijholtandPascal Vizeli 29ec17d50d use isort to sort imports for "setup.py" (#29792) 2019-12-09 16:30:16 +01:00
Bas NijholtandFranck Nijhof 5cb6d1b21f Sort imports according to PEP8 for 'script' folder (#29790) 2019-12-09 16:24:03 +01:00
Bas NijholtandFranck Nijhof 96a6a44411 Sort imports according to PEP8 for components starting with "X" (#29782) 2019-12-09 14:58:51 +01:00
Bas NijholtandFranck Nijhof 9bcd4653e0 Sort imports according to PEP8 for components starting with "Y" (#29783) 2019-12-09 14:57:42 +01:00
Bas NijholtandFranck Nijhof 4035fda659 Sort imports according to PEP8 for components starting with "Q" (#29785) 2019-12-09 14:56:20 +01:00
Bas NijholtandFranck Nijhof fbf1836997 Sort imports according to PEP8 for components starting with "W" (#29781) 2019-12-09 14:47:53 +01:00
Bas NijholtandFranck Nijhof 1ab1808307 Sort imports according to PEP8 for components starting with "N" (#29773) 2019-12-09 14:46:24 +01:00
Bas NijholtandFranck Nijhof ee1cc3b3dd Sort imports according to PEP8 for components starting with "V" (#29780) 2019-12-09 14:42:53 +01:00
Bas NijholtandFranck Nijhof de915e1bf0 Sort imports according to PEP8 for components starting with "T" (#29778) 2019-12-09 14:41:48 +01:00
Bas NijholtandFranck Nijhof 485761bbaf Sort imports according to PEP8 for components starting with "R" (#29776) 2019-12-09 14:39:51 +01:00
Bas NijholtandFranck Nijhof 23b92b2a56 Sort imports according to PEP8 for components starting with "S" (#29777) 2019-12-09 14:38:01 +01:00
Bas NijholtandFranck Nijhof 21816eeed4 Sort imports according to PEP8 for components starting with "P" (#29775) 2019-12-09 14:29:39 +01:00
Bas NijholtandFranck Nijhof 5cdaff5405 Sort imports according to PEP8 for components starting with "O" (#29774) 2019-12-09 14:26:53 +01:00
Bas NijholtandFranck Nijhof c49e423c78 Sort imports according to PEP8 for components starting with "K" (#29770) 2019-12-09 14:25:18 +01:00
Bas NijholtandFranck Nijhof 1dea0c9e34 Sort imports according to PEP8 for components starting with "L" (#29771) 2019-12-09 14:22:30 +01:00
Bas NijholtandFranck Nijhof 14779ce3d0 Sort imports according to PEP8 for components starting with "I" (#29769) 2019-12-09 14:21:24 +01:00
Bas NijholtandFabian Affolter 710680d604 use isort to sort imports for components starting with 'm' (#29772) 2019-12-09 18:50:40 +05:30
Bas NijholtandFranck Nijhof 8b39957c56 Sort imports according to PEP8 for components starting with "H" (#29768) 2019-12-09 14:19:48 +01:00
Bas NijholtandFranck Nijhof d58e6e924a Sort imports according to PEP8 for components starting with "G" (#29767) 2019-12-09 14:17:36 +01:00
Bas NijholtandFranck Nijhof ca0fad2cbb Sort imports according to PEP8 for components starting with "F" (#29766) 2019-12-09 14:14:40 +01:00
Bas NijholtandFranck Nijhof f9e06ca2fd Sort imports according to PEP8 for components starting with "E" (#29765) 2019-12-09 14:10:04 +01:00
Bas NijholtandFranck Nijhof 96961b9bcc Sort imports according to PEP8 for components starting with "A" (#29761) 2019-12-09 13:57:24 +01:00
Bas NijholtandFranck Nijhof 73de69896b Sort imports according to PEP8 for components starting with "B" (#29762) 2019-12-09 13:52:18 +01:00
Bas NijholtandFranck Nijhof 9b27e5b86c Sort imports according to PEP8 for vultr (#29760) 2019-12-09 13:33:08 +01:00
Bas NijholtandFranck Nijhof c7cf1b820c Sort imports according to PEP8 for hue (#29757) 2019-12-09 13:25:04 +01:00
Bas NijholtandFranck Nijhof abfcc18004 Sort imports according to PEP8 for mobile_app (#29758) 2019-12-09 13:22:42 +01:00
Bas NijholtandFranck Nijhof 53012a548b Sort imports according to PEP8 for sleepiq (#29759) 2019-12-09 13:21:45 +01:00
Bas NijholtandFranck Nijhof 60e1789557 Sort imports according to PEP8 for emulated_roku (#29756) 2019-12-09 13:20:51 +01:00
Bas NijholtandFranck Nijhof 991834f337 Sort imports according to PEP8 for shopping_list (#29751) 2019-12-09 13:14:49 +01:00
Bas NijholtandFranck Nijhof d1b38c0c79 Sort imports according to PEP8 for plaato (#29747) 2019-12-09 13:14:08 +01:00
Bas NijholtandFranck Nijhof f281069c8c Sort imports according to PEP8 for vicare (#29754) 2019-12-09 13:13:33 +01:00
Bas NijholtandFranck Nijhof 76debf4c88 Sort imports according to PEP8 for scene (#29750) 2019-12-09 13:12:43 +01:00
Bas NijholtandFranck Nijhof 127d84edd1 Sort imports according to PEP8 for solarlog (#29752) 2019-12-09 13:11:37 +01:00
Bas NijholtandFranck Nijhof 3f469eac28 Sort imports according to PEP8 for yeelight (#29755) 2019-12-09 13:10:24 +01:00
Bas NijholtandFranck Nijhof f81e608cc1 Sort imports according to PEP8 for remote (#29749) 2019-12-09 13:09:16 +01:00
Bas NijholtandFranck Nijhof c4a6f265e8 Sort imports according to PEP8 for versasense (#29753) 2019-12-09 13:08:05 +01:00
Bas NijholtandFranck Nijhof e9b428781b Sort imports according to PEP8 for pushbullet (#29748) 2019-12-09 13:06:25 +01:00
Bas NijholtandFranck Nijhof 3df40c7a16 Sort imports according to PEP8 for websocket_api (#29657) 2019-12-09 12:30:23 +01:00
Bas NijholtandFranck Nijhof 16a7408f23 Sort imports according to PEP8 for zwave (#29658) 2019-12-09 12:29:12 +01:00
Bas NijholtandFranck Nijhof 41cd678f00 Sort imports according to PEP8 for deconz (#29659) 2019-12-09 12:25:35 +01:00
Bas NijholtandFranck Nijhof 2da3848f89 Sort imports according to PEP8 for unifi (#29656) 2019-12-09 12:19:33 +01:00
Bas NijholtandFranck Nijhof 3b0f29fe95 sort imports according to PEP8 for lock (#29663) 2019-12-09 12:19:11 +01:00
Bas NijholtandFranck Nijhof eb47c2b148 Sort imports according to PEP8 for media_player (#29665) 2019-12-09 12:17:41 +01:00
Bas NijholtandFranck Nijhof 01d651c67d Sort imports according to PEP8 for device_tracker (#29666) 2019-12-09 12:14:38 +01:00
Bas NijholtandFranck Nijhof 27bd6ca1db Sort imports according to PEP8 for emulated_hue (#29667) 2019-12-09 12:12:41 +01:00
Bas NijholtandFranck Nijhof 05daa817f5 Sort imports according to PEP8 for owntracks (#29672) 2019-12-09 12:11:27 +01:00
Bas NijholtandFranck Nijhof d62993c5af Sort imports according to PEP8 for pilight (#29673) 2019-12-09 12:10:38 +01:00
Bas NijholtandFranck Nijhof 04225ba802 Sort imports according to PEP8 for rest (#29674) 2019-12-09 12:09:49 +01:00
Bas NijholtandFranck Nijhof 186799794d Sort imports according to PEP8 for nest (#29670) 2019-12-09 12:08:51 +01:00
Bas NijholtandFranck Nijhof ad58e607df Sort imports according to PEP8 for somfy (#29675) 2019-12-09 12:07:10 +01:00
Bas NijholtandFranck Nijhof 69b113c539 Sort imports according to PEP8 for dyson (#29678) 2019-12-09 12:04:39 +01:00
Bas NijholtandFranck Nijhof 3d10bb3647 Sort imports according to PEP8 for http (#29679) 2019-12-09 11:59:38 +01:00
Bas NijholtandFranck Nijhof c7d61279bd Sort imports according to PEP8 for ring (#29680) 2019-12-09 11:58:40 +01:00
Bas NijholtandFranck Nijhof df85a50f3b Sort imports according to PEP8 for sensor (#29683) 2019-12-09 11:57:49 +01:00
Bas NijholtandFranck Nijhof 9cf3ff319e Sort imports according to PEP8 for iaqualink (#29681) 2019-12-09 11:56:51 +01:00
Bas NijholtandFranck Nijhof b54c8641b4 Sort imports according to PEP8 for vesync (#29684) 2019-12-09 11:56:02 +01:00
Bas NijholtandFranck Nijhof e4e4f78eb0 Sort imports according to PEP8 for utility_meter (#29710) 2019-12-09 11:54:56 +01:00
Bas NijholtandFranck Nijhof b6cd6135c2 Sort imports according to PEP8 for wemo (#29685) 2019-12-09 11:53:51 +01:00
Bas NijholtandFranck Nijhof 776d8cfdc9 Sort imports according to PEP8 for specific_devices (#29687) 2019-12-09 11:51:36 +01:00
Bas NijholtandDaniel Høyer Iversen c54135486e use isort to sort imports according to PEP8 for netatmo (#29682) 2019-12-09 11:50:59 +01:00
Bas NijholtandFranck Nijhof 4c5c34919d Sort imports according to PEP8 for camera (#29691) 2019-12-09 11:50:48 +01:00
Bas NijholtandFranck Nijhof 0b4ca9ecac Sort imports according to PEP8 for ambiclimate (#29689) 2019-12-09 11:49:35 +01:00
Bas NijholtandDaniel Høyer Iversen bfa58f671a use isort to sort imports according to PEP8 for broadlink (#29690) 2019-12-09 11:48:52 +01:00
Bas NijholtandFranck Nijhof 9c1236b6de Sort imports according to PEP8 for ffmpeg (#29693) 2019-12-09 11:48:22 +01:00
Bas NijholtandFranck Nijhof 38657c0055 Sort imports according to PEP8 for counter (#29692) 2019-12-09 11:47:35 +01:00
Bas NijholtandFranck Nijhof 2261bb60e0 Sort imports according to PEP8 for geofency (#29695) 2019-12-09 11:46:49 +01:00
Bas NijholtandFranck Nijhof 2511f5edb4 Sort imports according to PEP8 for ifttt (#29696) 2019-12-09 11:46:08 +01:00