Commit Graph

30 Commits (27e3ff9c694abbcad74f1da1779539b04aa2da71)

Author SHA1 Message Date
epenet 8af37235ec
Use EntityFeature enum in components (b**) (#69336) 2022-04-05 23:53:45 +02:00
Erik Montnemery 03593aa21b
Import persistent notification (part 2) (#63899) 2022-01-13 08:42:50 +01:00
Marc Mueller 1b32385ab2
Use const imports [a-e] (#63467) 2022-01-05 16:44:13 +01:00
epenet 2aa8a86126
Add basic type hints to broadlink (#62879)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-02 17:21:37 +01:00
Robert Hillis 7919960570
Remove deprecated yaml config from broadlink (#62341) 2021-12-19 17:42:30 -06:00
Felipe Martins Diel 93bc88be16
Simplify requests in the Broadlink integration (#58850) 2021-11-01 12:49:00 +01:00
Felipe Martins Diel 3f61ff4f96
Make general code quality improvements in the Broadlink integration (#58848)
* Create DEVICE_TYPES constant

* Rename _auth_fetch_firmware() to _get_firmware_version()

* Rename dev_type to device_type

* Use SOURCE_REAUTH from config_entries namespace

* Fix unidiomatic imports
2021-11-01 00:01:11 +01:00
Felipe Martins Diel 43d3b6c2a2
Move the coordinator logic to the BroadlinkEntity class (#53571) 2021-07-27 13:53:29 -05:00
Robert Hillis 800f7fe3a5
Use entity class attributes for Broadlink (#53058)
* Clanup broadlink

* rework

* tweak

* fix using wrong attribute

* tweak

* revert device info
2021-07-21 15:27:52 +02:00
Daniel Hjelseth Høyer 4abdeec36d
Use entity class vars in Broadlink (#52177) 2021-06-25 11:31:17 -10:00
J. Nick Koston 22c8afe637
Create a base class for broadlink entities (#52132)
* Create a base class for broadlink entities

* Update homeassistant/components/broadlink/entity.py

Co-authored-by: Daniel Hjelseth Høyer <mail@dahoiv.net>

* Update homeassistant/components/broadlink/entity.py

* Update homeassistant/components/broadlink/entity.py

Co-authored-by: Daniel Hjelseth Høyer <mail@dahoiv.net>

* black, remove unused

Co-authored-by: Daniel Hjelseth Høyer <mail@dahoiv.net>
2021-06-25 07:39:21 +02:00
Paulus Schoutsen a90d3a051f
prefer total_seconds over seconds (#49505) 2021-04-20 17:41:36 -07:00
J. Nick Koston 9737480742
Lazy load broadlink storage (#48391)
With many broadlink devices, the storage load overwhelmed the
executor at startup. Delay loading storage until it is needed.
2021-03-27 09:32:30 +01:00
Felipe Martins Diel 9ca0cd5464
Bump broadlink from 0.16.0 to 0.17.0 (#47779) 2021-03-11 21:34:56 -08:00
Felipe Martins Diel c225f4b4ea
Implement remote.delete_command in the Broadlink integration (#44041) 2021-01-27 10:14:11 +01:00
Felipe Martins Diel c620fa344e
Add support for learning RF commands with Broadlink remotes (#39671)
* Add support for learning RF codes with Broadlink remotes

* Rename INFRARED and RADIOFREQUENCY to COMMAND_TYPE_IR and COMMAND_TYPE_RF

* Rewrite if expression as normal if statement

* Use COMMAND_TYPE_IR directly and improve error messages
2020-11-12 19:10:29 +01:00
Felipe Martins Diel f9208634bd
Fix on/off button (#42443) 2020-10-30 18:08:37 +01:00
Joakim Plate 999eeb39b9
Indicate to user that remote was turned off when call was attempted (#40715)
* Indicate to user that remote was turned off when call was attempted

* Catch exception in test

* Switch to warning log

* Apply suggestions from code review

Add suggested change to loggin
2020-10-06 06:12:39 +02: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
Ville Skyttä b4bac0f7a0
Exception chaining and wrapping improvements (#39320)
* 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.
2020-08-28 13:50:32 +02: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 38bb8ef4d2
Clean up command learning in the Broadlink integration (#36318) 2020-06-09 14:15:46 +02:00
Felipe Martins Diel 3d253fa52a
Handle StorageError in the Broadlink integration (#35986) 2020-05-23 11:10:06 +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
Erik Montnemery aa60d362fd
Rename RemoteDevice to RemoteEntity (#34676) 2020-04-26 02:12:36 +02:00
Felipe Martins Diel a365f456fc
Add support to the new Broadlink RM Mini 3 and RM4 Series (#32523)
* Add device type

* Use snake_case for devtype

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Validate device type as positive int

* Add device type 0x5f36 to switch

* Use default type for sensors

* Add RM4 to switch platform

* Use snake_case for devtype

* Support multiple types of remote

* Validate ip address

* Improve code readability

* Add const.py to .coveragerc

* Use None for unknown device types

* Fix sensors and standardize platform schemas

* Fix if statement

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-04-19 01:16:49 +02:00
Franck Nijhof 6f1900c6f4
Replace OSError aliases with OSError (#33655) 2020-04-04 22:09:11 +02:00
springstan 9801810552
Use f-strings in integrations starting with "B"-"E" (#32121)
* Use f-strings in integrations starting with B

* Use f-strings in integrations starting with C

* Use f-strings in integrations starting with D

* Use f-strings in integrations starting with E

* Fix pylint errors

* Fix pylint errors v2

* Fix tests

* Fix tests v2
2020-02-24 08:47:52 -08:00
Christian Clauss df7d2b3aeb
Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Felipe Martins Diel 5a24dbf599 Broadlink remote (#26528)
* Add broadlink remote control platform

* Fix order of the imports

* Add remote.py to .coveragerc

* Optimize MAC address validation

* Use storage helper class and improve code readability

* Add me to the manifest as a code owner

* Fix dosctring

* Add me to the code owners

* Remove storage schemas, rename storage keys and improve readability
2019-12-02 13:20:36 -08:00