33 Commits

Author SHA1 Message Date
Marc Mueller
ff3a801936
Add empty line after module docstring [a-d] (#112697) 2024-03-08 14:51:32 +01:00
J. Nick Koston
3877a56d23
Avoid creating tasks for automation and script validation (#111181)
These functions created tasks to run small validators, and the cost of
creating all the tasks was more expensive than running the validators
themselves. Since the code is unlikely to suspend its more efficient to
await them in series.
2024-02-23 13:41:36 -05:00
Erik Montnemery
95f7db1970
Move config_per_platform and extract_domain_configs to config.py (#104989) 2023-12-04 12:48:49 +01:00
Erik Montnemery
e18f7dffb0
Teach validate_config to validate lists of conditions (#95380)
* Teach validate_config to validate lists of conditions

* Update test
2023-06-27 19:44:23 +02:00
Erik Montnemery
17ac1a6d32
Set automations which fail validation unavailable (#94856) 2023-06-27 18:23:33 +02:00
Erik Montnemery
53637d486d
Improve error message when a script fails to validate (#84438) 2022-12-22 16:26:57 +01:00
Erik Montnemery
a6217ca9b9
Improve error message when an automation fails to validate (#83977) 2022-12-21 23:20:50 +01:00
epenet
5e338d2166
Improve type hints in automation (#78368)
* Improve type hints in automation

* Apply suggestion

* Apply suggestion

* Apply suggestion

* Add Protocol for IfAction

* Use ConfigType for IfAction

* Rename variable
2022-09-14 13:04:09 +02:00
Erik Montnemery
4a814405c2
Minor deduplication of condition validation code (#61170) 2021-12-07 11:55:16 -08:00
Paulus Schoutsen
8377b557da
Packages to support config platforms (#54085) 2021-08-05 13:11:01 -07:00
Ville Skyttä
470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Erik Montnemery
ce64690817
Make number of stored traces configurable (#49728) 2021-04-27 10:27:12 -07:00
Philip Allgaier
450f3740cd
Use consolidated constant for "description" (#48490) 2021-03-31 14:12:15 +02:00
Franck Nijhof
6932cf9534
Use contextlib.suppress where possible (#48189) 2021-03-23 14:36:43 +01:00
Erik Montnemery
17401cbc29
Initial automation tracing (#46755)
* Initial prototype of automation tracing

* Small fixes

* Lint

* Move trace helpers to its own file

* Improve trace for state and numeric_state conditions

* Tweaks + apply suggestions from code review

* Index traces by automation_id, trace while script is running

* Refactor condition tracing

* Improve WS API to get traces for single automation

* Add tests

* Fix imports

* Fix imports

* Address review comments

* Cap logging of loops

* Remove unused ContextVar action_config
2021-03-04 14:16:24 +01:00
Erik Montnemery
047f16772f
Support templating MQTT triggers (#45614)
* Add support for limited templates (no HASS access)

* Pass variables to automation triggers

* Support templates in MQTT triggers

* Spelling

* Handle trigger referenced by variables

* Raise on unsupported function in limited templates

* Validate MQTT trigger schema in MQTT device trigger

* Add trigger_variables to automation config schema

* Don't print stacktrace when setting up trigger throws

* Make pylint happy

* Add trigger_variables to variables

* Add debug prints, document limited template

* Add tests

* Validate MQTT trigger topic early when possible

* Improve valid_subscribe_topic_template
2021-02-08 10:50:38 +01:00
tkdrob
bcefbe2dca
Use core constants for automation (#46016) 2021-02-04 21:41:43 -05:00
Paulus Schoutsen
594e905742
Remove invalidation_version from deprecated (#44156)
* Remove invalidation_version from deprecated. We don't follow up and just hurts releases

* Revert change to ZHA
2020-12-12 22:24:16 +01:00
Franck Nijhof
6f326a7ea4
Add support for multiple event triggers in automation (#43097)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-11-12 11:58:28 +01:00
Paulus Schoutsen
0fb587727c
Add initial blueprint support (#42469)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2020-11-02 15:00:13 +01:00
Paulus Schoutsen
8ae3f575dd
Add extended validation for script repeat/choose (#41265) 2020-10-05 14:03:48 +02:00
Phil Bruckner
ca9dd0c833
Reorganize trigger code (#38655) 2020-08-17 11:54:56 -05:00
Phil Bruckner
63e55bff52
Remove legacy script mode and simplify remaining modes (#37729) 2020-07-10 17:00:57 -07:00
Phil Bruckner
91271f388c
Add new repeat loop for scripts and automations (#37589) 2020-07-10 13:37:19 -05:00
Phil Bruckner
f7c4900d5c
Enhance automation integration to use new features in script helper (#37479) 2020-07-05 09:25:15 -05:00
Franck Nijhof
8c65062271
Several optimizations to automations (#35007) 2020-05-01 16:37:25 +02:00
springstan
524a1a7587
Use f-strings in integrations starting with "A" (#32110)
* Use f-strings in integrations starting with A

* Use f-strings in tests for integrations starting with A

* Fix pylint by renaming variable

* Fix nested for loop in f-string for aprs device_tracker

* Break long lines into multiple short lines

* Break long lines into multiple short lines v2
2020-02-23 13:38:05 -08:00
Bas Nijholt
d3f67c3841 use isort to sort imports according to PEP8 for automation (#29620) 2019-12-08 21:59:39 +05:30
Erik Montnemery
fdf4f398a7
Support async validation of device trigger (#27333) 2019-10-09 21:04:11 +02:00
Erik Montnemery
e27051aa61 Fix validation when automation is saved from frontend (#27195) 2019-10-04 10:17:57 -07: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
5a1da72d5e Improve validation of device action config (#27029) 2019-10-01 20:35:36 -07: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