Commit Graph

57 Commits (dc5888ab4af85bf62d01a8dcd891a400232d6a99)

Author SHA1 Message Date
Erik Montnemery 0e3bc21d54
Teach state and numeric_state conditions about entity registry ids (#60841) 2021-12-02 14:55:12 -08:00
Erik Montnemery c85bb27d0d
Teach state trigger about entity registry ids (#60271)
* Teach state trigger about entity registry ids

* Tweak

* Add tests

* Tweak tests

* Fix tests

* Resolve entity ids during config validation

* Update device_triggers

* Fix mistake

* Tweak trigger validator to ensure we don't modify the original config

* Add index from entry id to entry

* Update scaffold

* Pre-compile UUID regex

* Address review comment

* Tweak mock_registry

* Tweak

* Apply suggestion from code review
2021-12-02 14:26:45 +01:00
Erik Montnemery caf5ee2fab
Remove optional validation when creating conditions (#60481) 2021-11-28 14:54:07 +01:00
Paulus Schoutsen 77d02d08bc
Validate device automation capablities WS calls (#58444) 2021-10-26 14:47:07 +02:00
Marc Mueller 12d1dfdaf9
Use assignment expressions 10 (#57791) 2021-10-15 21:36:03 +02:00
Marc Mueller 0700108278
Use NamedTuple for device_automation details (#55697) 2021-09-04 13:42:36 +02:00
Ville Skyttä b10fc89a6b
Automation trigger info type hint improvements (#55402)
* Make automation trigger info a TypedDict

* zwave_js trigger type hint fixes

* Remove redundant automation trigger info field presence checks

* Use async_initialize_triggers in mqtt and tasmota device_trigger tests
2021-09-04 02:25:51 +02:00
Paulus Schoutsen 7111fc47c4
Better handle invalid trigger config (#55637) 2021-09-03 10:15:57 -07:00
Paulus Schoutsen 418d6a6a41
Guard for unexpected exceptions in device automation (#55639)
* Guard for unexpected exceptions in device automation

* merge

Co-authored-by: J. Nick Koston <nick@koston.org>
2021-09-03 09:04:50 -07:00
Ville Skyttä 0095c6baeb
Improve device trigger type hinting (#54907) 2021-08-22 20:32:50 +02:00
Ville Skyttä debc6d632c
Improve device condition type hinting (#54906) 2021-08-20 22:21:40 +02:00
Ville Skyttä 4bb2c6e00f
Improve device action type hinting (#54850)
* Improve device action type hinting

* More precise _async_get_automations type hints

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-08-20 07:13:25 +03:00
J. Nick Koston 4bde4504ec
Add api to device_automation to return all matching devices (#53361) 2021-08-10 14:21:34 -05:00
Erik Montnemery 49bec86dae
Add base schema for triggers (#51727)
* Add base schema for triggers

* Tweak

* Make TRIGGER_BASE_SCHEMA a voluptuous schema

* Make state trigger BASE_SCHEMA a voluptuous schema
2021-06-11 09:51:12 +02:00
Erik Montnemery 76c3058d15
Rename device trigger base schema to DEVICE_TRIGGER_BASE_SCHEMA (#51719) 2021-06-10 19:11:38 +02:00
Marc Mueller c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Erik Montnemery b3b0904b94
Simplify device trigger code (#48507) 2021-03-30 13:54:27 +02:00
Marc Mueller 7c0734bdd5
Update typing 05 (#48038) 2021-03-17 23:43:55 +01:00
Philip Allgaier 625bbe6238
Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02: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
Phil Bruckner ca9dd0c833
Reorganize trigger code (#38655) 2020-08-17 11:54:56 -05:00
Paulus Schoutsen 8895f9b70a
Remove unused webhook dependency from device automation (#36946) 2020-06-20 09:11:17 +02:00
Jason Cheatham 3b246fb40a
Load integrations with requirements in device_automation (#33714)
* Load integrations with requirements in device_automation

- Split cached loader behavior out of async_get_integration
- Use cached loader for both async_get_integration and
  async_get_integration_with_requirements
- Use async_get_integration_with_requirements for device_automation

resolves #33104

* Duplicate caching logic in requirements, remove loader mods

* Update homeassistant/requirements.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-04-08 11:42:15 -07:00
Franck Nijhof 187b6525b4
Removal of extraneous parenthesis (#33637) 2020-04-04 20:08:55 +02:00
Paulus Schoutsen f1d3c0d19b
Remove unused manifest fields (#33595) 2020-04-03 12:58:19 -07:00
Paulus Schoutsen 5092971452
Add brightness light device actions (#31567) 2020-02-09 19:47:59 -08:00
Paulus Schoutsen 7127310f10
Catch device not found in device automations (#31401) 2020-02-02 07:13:07 -08:00
Paulus Schoutsen e9e44dbd97
Fix callback and async (#31281)
* Fix callback and async

* Fix a return

* Fix test

* Fix mqtt tests

* Fix some more callbacks
2020-01-29 13:59:45 -08:00
Franck Nijhof bfa0edaf92 Migrate Integration Quality Scale from docs to manifest: internal (#30551) 2020-01-07 20:58:49 +01:00
Franck Nijhof 345cc244ed
Correct names in manifests (C-L) (#30532) 2020-01-07 08:19:17 +01:00
Franck Nijhof a84741392b
Format all manifests with prettier (#30521) 2020-01-06 21:28:23 +01:00
Paulus Schoutsen b9aba30a6e
Extract Collection helper from Person integration (#30313)
* Add CRUD foundation

* Use collection helper in person integration

* Lint/pytest

* Add tests

* Lint

* Create notification
2020-01-03 21:37:11 +01:00
Bas Nijholt 2cd55bbb87 Sort imports according to PEP8 for device_automation (#29707) 2019-12-09 11:24:49 +01:00
Erik Montnemery 475b43500a
Add above and below to sensor condition extra_fields (#27364)
* Add above and below to sensor condition extra_fields

* Change unit_of_measurement to suffix in extra_fields

* Check if sensor has unit when getting capabilities

* Improve tests
2019-10-26 06:55:42 +08:00
Erik Montnemery 43c85c0549 Add device action support to the alarm_control_panel integration (#27616)
* Add device action support to the alarm_control_panel integration

* Improve tests
2019-10-16 21:34:56 -07:00
Ville Skyttä 759ad08930 Typing misc fixes (#27543)
* Make async_get_conditions return type hint more specific

* Exclude script/scaffold/templates/ from pre-commit mypy
2019-10-14 13:03:37 -07:00
Erik Montnemery 0ba4ee1398 Validate generated device actions (#27262)
* Validate generated actions

* Use hass.services.async_call instead of service.async_call_from_config
2019-10-08 10:06:17 -07:00
Erik Montnemery dabdf8b577 Validate generated device triggers (#27264)
* Validate generated trigger

* Update scaffold
2019-10-07 13:09:48 -07:00
Erik Montnemery 5d1dd6390d Validate generated condition (#27263) 2019-10-06 21:06:16 -07:00
Erik Montnemery cda7692f24 Add support for `for` to binary_sensor, light and switch device conditions (#27153)
* Add support for `for` to binary_sensor, light and switch device conditions

* Fix typing

* Fixup

* Fixup
2019-10-03 13:29:57 -07:00
Erik Montnemery 3e99743244
Add device trigger support to sensor entities (#27133)
* Add device trigger support to sensor entities

* Fix typing

* Fix tests, add test helper for comparing lists
2019-10-03 06:14:35 +02:00
Erik Montnemery c43eeee62f Improve validation of device condition config (#27131)
* Improve validation of device condition config

* Fix typing
2019-10-02 15:58:14 -07:00
Erik Montnemery 65ce3b49c1
Add support for `for` to binary_sensor, light and switch device triggers (#26658)
* Add support for `for` to binary_sensor, light and switch device triggers

* Add WS API device_automation/trigger/capabilities
2019-10-02 22:14:52 +02:00
Franck Nijhof c7da781efc Update documentation link URL for integrations in all manifests (#27114) 2019-10-02 09:25:44 -07:00
Ville Skyttä f259ff17d5
Type hint additions (#26831)
* Type hint additions

* Remove optional from sidebar_icon comment

Co-Authored-By: Franck Nijhof <frenck@frenck.nl>

* Remove optional from sidebar_title comment

Co-Authored-By: Franck Nijhof <frenck@frenck.nl>

* Fix issues after rebase and mypy 0.730
2019-09-29 20:07:49 +03:00
Erik Montnemery e57e7e8449
Improve validation of device trigger config (#26910)
* Improve validation of device trigger config

* Remove action and condition checks

* Move config validation to own file

* Fix tests

* Fixes

* Fixes

* Small tweak
2019-09-27 17:48:48 +02:00
Paulus Schoutsen 6fdff9ffab
Reorg device automation (#26880)
* async_trigger -> async_attach_trigger

* Reorg device automations

* Update docstrings

* Fix types

* Fix extending schemas
2019-09-24 14:57:05 -07:00
Erik Montnemery 504b8c7685
Fix translation, adjust trigger names (#26635) 2019-09-17 21:55:01 +02:00
Robert Svensson c680c07c65 deCONZ device automations (#26366)
* Early draft

* Getting there

* Working fully with Hue dimmer remote

* Fix Balloobs comments

* No side effects in constructor

* Improve hue dimmer

* Add Ikea remote control

* Add xiaomi button support

* Refactor getting deconz event

* Added xiaomi devices and tradfri wireless dimmer

* Resolve unique id from device id

* Add Hue Tap and Tradfri on off switch

* More triggers for ikea on off switch and Aqara double wall switch

* Add support for Tradfri open close remote

* Fix changes after rebase

* Initial test

* Change id to event_id

* Fix translations and add subtypes

* Try if tests pass without the new tests

* Revert disabling tests
Add new exception InvalidDeviceAutomationConfig

* Ignore places calling remotes

* Enable all gateway tests

* Found the issue, now to identify which test creates it

* Remove block till done

* See if device automation test passes in azure

* Register event to device registry

* Enable test sensors

* Skip deconz event tests currently failing

* Added reason why skipping tests
2019-09-10 16:56:28 -07:00
Erik Montnemery 02ded7a4a8 Remove device from device action schema (#26536) 2019-09-09 10:40:22 -07:00