Commit graph

121 commits

Author SHA1 Message Date
Marc Mueller
4cb7718192
Update typing 16 (#48087) 2021-03-18 22:58:19 +01:00
Erik Montnemery
7b717bc437
Correct trace for repeat script actions (#48031) 2021-03-18 13:14:06 -07:00
Marc Mueller
6fb2e63e49
Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Erik Montnemery
1cde1074c9
Correct trace for choose and repeat script actions (#47973)
* Correct trace for choose and repeat script actions

* only choose-wrap the choices

* Update tests

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-03-16 08:49:16 +01:00
Erik Montnemery
f82e59c32a
Make it possible to list debug traces for a specific automation (#47744) 2021-03-15 16:51:04 -07:00
Erik Montnemery
a9a9e1f199
Tweak automation tracing (#47721) 2021-03-10 14:42:13 -08:00
Erik Montnemery
704000c049
Add support for breakpoints in scripts (#47632) 2021-03-09 21:23:11 -08:00
Erik Montnemery
ea4f3e31d5
Include changed variables in automation trace (#47549)
* Include changed variables in automation trace

* Deduplicate some code

* Tweak

* Apply suggestions from code review

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Fix format

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-03-08 22:48:36 +01:00
Erik Montnemery
2f9d03d115
Merge action and condition traces (#47373)
* Merge action and condition traces

* Update __init__.py

* Add typing to AutomationTrace

* Make trace_get prepare a new trace by default

* Correct typing of trace_cv

* Fix tests
2021-03-06 12:57:21 +01:00
tkdrob
3baeed3684
Clean up constants (#47323) 2021-03-05 19:08:04 +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
Anders Melchiorsen
d33a1a5ff8
Refine printing of ConditionError (#46838)
* Refine printing of ConditionError

* Improve coverage

* name -> type
2021-02-21 14:54:36 +01:00
Erik Montnemery
2d70806035
Add support for "alias" in script steps device, device_condition, and conditions (#46647)
Co-authored-by: Donnie <donniekarnsinsb@hotmail.com>
2021-02-20 19:21:09 -08:00
J. Nick Koston
aa061e5818
Fix variable name from script refactoring (#46503) 2021-02-14 10:52:18 -10:00
Ville Skyttä
a6358430b4
Fix deprecated asyncio.wait use with coroutines (#44981)
https://docs.python.org/3/library/asyncio-task.html#asyncio-example-wait-coroutine
2021-02-10 14:16:58 +01:00
Bram Kragten
4b493c5ab9
Add target to service call API (#45898)
* Add target to service call API

* Fix _async_call_service_step

* CONF_SERVICE_ENTITY_ID overrules target

* Move merging up before processing schema

* Restore services.yaml

* Add test
2021-02-10 12:42:28 +01:00
Ville Skyttä
82607977ef
Various type hint improvements (#46144) 2021-02-08 11:59:46 +01:00
Anders Melchiorsen
b9b1caf4d7
Raise ConditionError for numeric_state errors (#45923) 2021-02-08 10:47:57 +01:00
Erik Montnemery
8a7e0241ab
Fix race in script wait for trigger step (#46055)
* Fix race in script wait for trigger step

* Update script.py

* Update script.py
2021-02-06 10:01:30 +01:00
Marc Mueller
7673f57248
Add additional error handling for automation script run (#45613) 2021-01-28 09:26:41 +01:00
J. Nick Koston
a7741be9bb
Wait for all triggers when one fails to attach (#45361) 2021-01-20 22:13:21 +01:00
Ville Skyttä
3a88a4120e
Helpers type hint improvements (#44964) 2021-01-09 00:08:34 +01:00
J. Nick Koston
7c93a11aba
Fix wait_template incorrectly matching falsey values (#44938) 2021-01-08 13:07:50 +01:00
J. Nick Koston
2ef25e7414
Fix script wait templates with now/utcnow (#44717) 2021-01-01 13:03:34 +01:00
Paulus Schoutsen
ac2af69d26
Fix extracting entity and device IDs from scripts (#44048)
* Fix extracting entity and device IDs from scripts

* Fix extracting from data_template
2020-12-08 13:06:29 +01:00
J. Nick Koston
5ebf5996f1
Predetermine listener type for script change listeners (#41510) 2020-10-09 08:41:12 +02:00
Paulus Schoutsen
8ae3f575dd
Add extended validation for script repeat/choose (#41265) 2020-10-05 14:03:48 +02:00
Franck Nijhof
38d132addd
Fix referenced entity extraction when service call entity contains a template (#41107) 2020-10-03 20:55:59 +02:00
Thomas Lovén
f59e727f16
Set variable values in scripts (#39915)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-09-11 13:16:25 +02:00
Paulus Schoutsen
5117a16841
Extract variable rendering (#39934) 2020-09-11 12:24:16 +02:00
Paulus Schoutsen
aa9dff572e
Add default variables to script helper (#39895) 2020-09-10 20:41:42 +02:00
Paulus Schoutsen
63aa46369b
Copy instead of deepcopy the variables in a wait for trigger (#39796) 2020-09-08 15:23:38 +02:00
Franck Nijhof
a3c45a6f89
Add shorthand notation for Template conditions (#39705) 2020-09-06 16:55:06 +02:00
Phil Bruckner
4486251382
Add max_exceeded log level option to automations & scripts (#39448) 2020-09-02 11:05:14 +02:00
Phil Bruckner
b315df2118
Reduce automation state changes by using script helper's last_triggered attribute (#39323) 2020-08-28 14:51:15 -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
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Franck Nijhof
181709f3d2
Allow templates in data & service parameters (making data_template & service_template obsolete) (#39210) 2020-08-24 16:21:48 +02:00
Paulus Schoutsen
05d54a60b0
Deprecate optional script context (#39034)
Co-authored-by: Phil Bruckner <pnbruckner@gmail.com>
2020-08-21 14:17:47 +02:00
Phil Bruckner
76ead858cf
Add wait_for_trigger script action (#38075)
* Add wait_for_trigger script action

* Add tests

* Change script integration to use config validator
2020-08-21 11:38:25 +02:00
Phil Bruckner
580e229cf2
Create variable with result of wait_template and accept template for timeout option (#38634) 2020-08-12 13:42:06 -05:00
Phil Bruckner
716fa63e73
Update script helper constructor parameters (#38763)
Add domain and make it and name required.

Add optional running_description.
2020-08-12 11:39:05 -05:00
Phil Bruckner
c3a820c4a3
Fix queued script not updating current attribute when queuing (#38432) 2020-08-01 15:51:48 +02:00
Phil Bruckner
1158925b53
Fix repeat action when variables present (#38237) 2020-07-27 16:51:34 -05:00
Phil Bruckner
1a760c63d0
Fix parallel script containing repeat or choose action with max_runs > 10 (#38243) 2020-07-27 10:43:58 +02:00
Phil Bruckner
2f87da8aa9
Fix script repeat variable lifetime (#38124) 2020-07-23 23:11:21 -07:00
Phil Bruckner
65d1dfba62
Update automation logger to include object_id like scripts (#37948) 2020-07-22 10:55:49 -05:00
Ville Skyttä
aa1c5fc43d
Various type hint improvements (#37952) 2020-07-22 08:06:37 -07:00
Phil Bruckner
716cee6907
Fix automation & script restart mode bug (#37909) 2020-07-16 12:03:43 -07:00
Phil Bruckner
cf498b7beb
Stop running scripts at shutdown (#37858) 2020-07-15 09:28:32 -07:00