Commit graph

49 commits

Author SHA1 Message Date
Erik Montnemery 7539cf25be
Don't require passing identifiers to DeviceRegistry.async_get_device (#96479)
* Require keyword arguments to DeviceRegistry.async_get_device

* Update tests

* Update tests

* Don't enforce keyword arguments
2023-07-13 13:39:25 -04:00
Ville Skyttä ced67e5800
Import util.dt as dt_util in components/[a-d]* (#93756) 2023-05-30 00:02:06 +03:00
Patrick ZAJDA e748f0c623
Add entity name translations to Broadlink sensors (#90783)
* Add entity name translations to Broadlink sensors

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Update tests

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Apply suggestions from code review

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

---------

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-04-04 15:18:41 -04:00
epenet 853bd52a22
Adjust entity registry access in tests (1) (#88950) 2023-03-01 09:11:14 +01:00
Franck Nijhof 330e1c6cbb
Clean up unnecessary registry mocks from integration tests (#87763) 2023-02-09 10:43:45 +01:00
epenet 807c69f621
Add type hints to integration tests (b-c) (#87698) 2023-02-08 18:08:43 +01:00
Patrick ZAJDA a717ea8afc
Migrate Broadlink to new entity naming style (#80187)
* Migrate Broadlink to new entity naming style

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

* Add some tests

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>

Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>
2022-10-18 22:09:23 +02:00
Franck Nijhof d645e80ccd
Clean up async_update_entity helper usage (#68641) 2022-03-25 15:22:58 -07:00
epenet 8234625d30
Use Domain not Platform on test service calls (#65508)
* Adjust atag

* adjust broadlink

* Adjust onewire

* Adjust plex

* Adjust renault

* Adjust tasmota

* Adjust zha

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-03 14:16:35 +01:00
Erik Montnemery a8c14835b9
Add entity options to entity registry (#64350)
* Initial commit for entity options

* Tweak broadlink tests

* Add async_update_entity_options + test
2022-01-18 22:47:46 +01:00
Marc Mueller f57d42a9e8
Use platform enum (1) [A-D] (#60908)
* Use platform enum (1) [A-D]

* Fix imports

* Fix tests

* Use Platform even in tests
2021-12-03 08:51:30 -08:00
epenet 59547289b4
Use DhcpServiceInfo in broadlink (#59961)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-19 12:29:20 +01:00
L-I-Am 3727fb5288
Broadlink Integration add support for LB1 (#50953)
Co-authored-by: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com>
2021-10-26 21:20:11 -05:00
Felipe Martins Diel 6f0a7d2921
Add to the Broadlink integration support for voltage, current, overload and total consumption sensors (#53628) 2021-10-18 11:38:51 -10: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
Erik Montnemery 4684ea2d14
Prevent 3rd party lib from opening sockets in broadlink tests (#55636) 2021-09-03 10:13:35 +02:00
Erik Montnemery cabb9c0ea4
Prevent 3rd party lib from opening sockets in broadlink tests (#55593) 2021-09-02 19:03:24 +02:00
Felipe Martins Diel fca79237c3
Create dataclass to mock entry setup in Broadlink tests (#50134) 2021-06-14 13:28:57 +02:00
Erik Montnemery 73d7a754e8
Mark temperature sensors as STATE_CLASS_MEASUREMENT (#50889)
* Mark temperature sensors as STATE_CLASS_MEASUREMENT

* Fix broadlink tests

* Tweak Hue changes
2021-05-21 11:44:34 +02:00
Ville Skyttä 19d25cd901
Change config entry state to an enum (#49654)
* Change config entry state to an enum

* Allow but deprecate EntryState str equality comparison

* Test fixes

* Rename to ConfigEntryState

* Remove str comparability backcompat

* Update new occurrences of strs cropped up during review
2021-05-20 19:19:20 +02:00
Felipe Martins Diel 7350942e9e
Implement heartbeat in the Broadlink integration (#43878)
* Implement heartbeat in the Broadlink integration

* Rename INTERVAL to HEARTBEAT_INTERVAL

* Test that we log an error message when the heartbeat fails
2021-05-20 08:10:13 +02:00
Felipe Martins Diel a7ef3ec947
Fix RM pro temperature sensor (#50098) 2021-05-07 14:47:51 +02:00
Ville Skyttä 153d6e891e
Use config_entries.SOURCE_* constants (#49631) 2021-04-25 11:27:40 +02:00
Felipe Martins Diel e98f27ead6
Use broadlink.hello() for direct discovery (#49405) 2021-04-19 10:16:03 +02:00
Felipe Martins Diel 6a3832484c
Do not log error messages when discovering Broadlink devices (#49394) 2021-04-18 18:12:27 -10:00
J. Nick Koston 35a5f110bd
Update mac address in broadlink test to match mocked device (#48415)
* Update mac address in broadlink test to match mocked device

* Update tests/components/broadlink/test_config_flow.py
2021-03-27 20:47:47 +01:00
J. Nick Koston 388815b81a
Add broadlink dhcp discovery (#48408) 2021-03-27 08:40:19 -10:00
Felipe Martins Diel 9ca0cd5464
Bump broadlink from 0.16.0 to 0.17.0 (#47779) 2021-03-11 21:34:56 -08:00
Ville Skyttä 2fb3be50ab
Make DeviceRegistry.async_get_device connections arg optional (#44897)
* Make async_get_device connections Optional, default None

* Remove unnecessary async_get_device connections arg usages

Some of these were using an incorrect collection type, which didn't
cause issues mostly just due to luck.
2021-01-07 13:49:45 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Felipe Martins Diel 48e954e038
Change instructions for unlocking Broadlink devices (#42023) 2020-11-10 10:42:59 +01:00
Felipe Martins Diel 2f4aa35ca6
Bump python-broadlink to 0.15.0 (#39228)
* Rename DeviceOfflineError to NetworkTimeoutError

* Bump python-broadlink to 0.15
2020-09-26 10:46:02 -05:00
Felipe Martins Diel 2f7b6bfa2d
Fix RM mini 3 update manager (#40215) 2020-09-18 15:31:25 +02:00
Felipe Martins Diel 976d8f7abe
Handle an unsupported device in the Broadlink config flow (#40242) 2020-09-18 15:29:26 +02:00
Felipe Martins Diel a6d3ee90f0
Improve tests for Broadlink config flow (#39894) 2020-09-11 20:00:28 -05:00
Felipe Martins Diel 9f08955fef
Improve tests for Broadlink devices (#39898) 2020-09-11 19:57:07 -05:00
Chris Talkington 48cfbf8662
Improve broadlink sensor tests (#39632) 2020-09-03 20:01:15 -05:00
Felipe Martins Diel 353b40b28a
Add tests for Broadlink remotes (#39235)
* Add tests for Broadlink remotes

* Reformat the tests with Black

* Add a helper method for device setup

* Rename device.setup() to device.setup_entry()

* Apply suggestions from code review

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
2020-09-03 16:51:08 -05:00
Chris Talkington 4682de5ac1
Improve patching in broadlink sensor tests (#39366)
* improve patching in broadlink sensor tests

* Update test_sensors.py

* Update test_sensors.py
2020-08-28 21:26:19 -05:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Felipe Martins Diel e4d29bf3ec
Add tests for Broadlink sensors (#39230)
* Add tests for Broadlink sensors

* Remove sensor.py from .coveragerc
2020-08-26 22:43:17 -05:00
Felipe Martins Diel a2c1f08c8c
Implement config flow in the Broadlink integration (#36914)
* Implement config flow in the Broadlink integration

* General improvements to the Broadlink config flow

* Remove unnecessary else after return

* Fix translations

* Rename device to device_entry

* Add tests for the config flow

* Improve docstrings

* Test we do not accept more than one config entry per device

* Improve helpers

* Allow empty packets

* Allow multiple config files for switches related to the same device

* Rename mock_device to mock_api

* General improvements

* Make new attempts before marking the device as unavailable

* Let the name be the template for the entity_id

* Handle OSError

* Test network unavailable in the configuration flow

* Rename lock attribute

* Update manifest.json

* Import devices from platforms

* Test import flow

* Add deprecation warnings

* General improvements

* Rename deprecate to discontinue

* Test device setup

* Add type attribute to mock api

* Test we handle an update failure at startup

* Remove BroadlinkDevice from tests

* Remove device.py from .coveragerc

* Add tests for the config flow

* Add tests for the device

* Test device registry and update listener

* Test MAC address validation

* Add tests for the device

* Extract domains and types to a helper function

* Do not patch integration details

* Add tests for the device

* Set device classes where appropriate

* Set an appropriate connection class

* Do not set device class for custom switches

* Fix tests and improve code readability

* Use RM4 to test authentication errors

* Handle BroadlinkException in the authentication
2020-08-20 17:30:41 +02:00
Felipe Martins Diel 6464c94990
Fix connection problems in the Broadlink integration (#34670)
* Use helper functions for exception handling

* Create a separate class to handle communication with the device

* Update manifest

* Use coroutine for service setup

* Fix sensor update

* Update tests

* Fix MP1 switch

* Add device.py to .coveragerc

* Remove unnecessary blocking from test_learn_timeout

* Change access method for entries with default values

* Make the changes suggested by MartinHjelmare

* Remove dot from debug message

* Use underscore for unused variable
2020-05-13 10:36:32 +02:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Franck Nijhof 906385172a
String formatting improvements for tests (#33663) 2020-04-05 00:26:08 +02:00
Bas Nijholt bfa58f671a use isort to sort imports according to PEP8 for broadlink (#29690) 2019-12-09 11:48:52 +01:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Joakim Plate 7d5c1ede72 Broadlink fixup unintended breakage from service refactor (#23408)
* Allow host/ipv6 address for broadlink service

This matches switch config and is a regression fix

* Restore padding of packets for broadlink

* Drop unused import

* Fix comment on test
2019-04-25 21:33:05 -05:00
Joakim Plate 0a3e11aa12 Move Broadlink services to component (#21465)
* Register services in broadlink domain

* Add tests for broadlink services

* Resolve review comments

* One more review fix

* Restore auth retry

* Drop unused constants

* Fix flake8 errors
2019-04-12 20:11:36 +02:00