Commit Graph

51 Commits (e43802eb0769fb8850f9533de873d94b260bc1e2)

Author SHA1 Message Date
Erik Montnemery 53637d486d
Improve error message when a script fails to validate (#84438) 2022-12-22 16:26:57 +01:00
Erik Montnemery f7694c0550
Only reload modified scripts (#80470)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-10-24 20:47:06 +02:00
Erik Montnemery 31a787558f
Ensure recorder test fixture is setup before hass fixture (#80528)
* Ensure recorder test fixture is setup before hass fixture

* Adjust more tests
2022-10-19 07:58:47 +02:00
Erik Montnemery 7f08dd851e
Make script entities register their own service (#79202) 2022-09-28 11:05:29 -04:00
Paulus Schoutsen d3f5ccfed8
Allow fetching script config (#79131) 2022-09-28 13:52:58 +02:00
Erik Montnemery 6ef33b1d39
Fix overriding a script's entity_id (#78765) 2022-09-28 10:37:34 +02:00
Erik Montnemery 5f2b4001f3
Separate recorder database schema from other classes (#72977)
* Separate recorder database schema from other classes

* fix logbook imports

* migrate new tests

* few more

* last one

* fix merge

Co-authored-by: J. Nick Koston <nick@koston.org>
2022-06-07 14:41:43 +02:00
Franck Nijhof c0da97b038
Clean up accessing service helpers via hass (#72013) 2022-05-17 10:56:57 -07:00
J. Nick Koston 24d7a464e1
Refactor logbook to reduce overhead and complexity (#71509) 2022-05-08 21:47:26 -07:00
Erik Montnemery 1df99badcf
Allow scripts to turn themselves on (#71289) 2022-05-04 15:54:37 +02:00
Franck Nijhof cad2ba4d44
Detect duplicate script objects in config validation (#70368) 2022-04-26 15:33:43 +02:00
Erik Montnemery 28ebab9c5a
Simplify waiting for recorder in tests (#70647) 2022-04-25 12:04:47 +02:00
Erik Montnemery 982e314de6
Use recorder_mock in tests (#70363)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-22 19:29:44 -10:00
Franck Nijhof d08b751a85
Add unique ID to scripts (#70345) 2022-04-21 20:04:02 +02:00
J. Nick Koston c3108b3899
Exclude attributes for automation and script domains (#70168) 2022-04-18 12:10:18 +02:00
Erik Montnemery 46f27fdefd
Don't prevent automations from triggering themselves (#68178) 2022-03-15 18:48:54 +01:00
Erik Montnemery 65fbcfa0ba
Prevent recursive script calls from deadlocking (#67861)
* Prevent recursive script calls from deadlocking

* Address review comments, improve tests

* Tweak comment
2022-03-10 19:28:00 +01:00
Marc Mueller d057850971
Update typing - collections.abc (3) (#63947) 2022-01-12 08:04:17 +01:00
Erik Montnemery 961ee717ef
Store automation and script traces (#56894)
* Store automation and script traces

* Pylint

* Deduplicate code

* Fix issues when no stored traces are available

* Store serialized data for restored traces

* Update WS API

* Update test

* Restore context

* Improve tests

* Add new test files

* Rename restore_traces to async_restore_traces

* Refactor trace.websocket_api

* Defer loading stored traces

* Lint

* Revert refactoring which is no longer needed

* Correct order when restoring traces

* Apply suggestion from code review

* Improve test coverage

* Apply suggestions from code review
2021-10-19 10:23:23 +02:00
Franck Nijhof 2cdaf632a4
Restore last_triggered state in scripts (#55071) 2021-08-23 11:05:29 -07:00
Richard T. Schaefer 9e219d9b6e
Add this variable for use by automation and script templates (#52774) 2021-07-28 09:09:13 +02:00
Zac West b8713774c8
Make confirmable notification blueprint use unique actions (#50706) 2021-05-15 22:50:24 -07:00
Franck Nijhof 89e7983ee0
Add Blueprint foundation to Scripts (#48621)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-04-27 15:15:38 -07:00
Philip Allgaier 6fe04f40a2
Ensure HA script and Python script services have a name (#47204)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-03-31 15:09:45 +02:00
Franck Nijhof 5a2b5fe7c5
Yoda assertion style removed is (#48142) 2021-03-20 13:55:10 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Franck Nijhof ee914366a8
Add native Python types support to templates (#41227)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-10-07 00:05:52 +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
J. Nick Koston 6b7a7939d2
Include the first seen context data in the logbook api (#39194)
* Include the context_entity_id in the logbook api

context_entity_id is the first entity seen during
a time period that includes the context

* update test

* more of them

* include friendly name

* pylint wants a ternary

* Refactor

* performance

* fix homekit context

* Fix self describing events

* Fix external_events
2020-08-24 12:44:40 -05: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 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 38210ebbc6
Enhance script integration to use new features in script helper (#37201) 2020-06-30 10:22:26 -07:00
Paulus Schoutsen 5bc6ed4cef
Add logbook platforms (#37078)
* Add logbook platforms

* Fix logbook describe test
2020-06-24 18:14:50 -07:00
J. Nick Koston 59e43ab6e4
Prefilter more logbook events in sql (#36958)
* Prefilter more logbook events in sql

Prefilter sensor events in _keep_event before humanify

Cache static attribute lookup

Reduces logbook execution time by ~35%

* fix mocking in benchmark

* Update tests for logbook users
2020-06-21 10:50:58 -07:00
J. Nick Koston 0a219081ea
Only process logbook timestamps for events we will keep (#36792)
* Only process logbook timestamps for events we will keep

Since we group by minute we were previously processing
every timestamp. We can avoid this by making all the
minute checks use the unprocessed datetime since
the groupings will be the same regardless of timezone.

This reduces the number of datetime object recreations
by at least an order of magnitude.
2020-06-15 14:54:20 -05:00
Franck Nijhof 238430136e
Migrate script to use describe_event for logbook (#36729) 2020-06-12 16:44:29 -07:00
Paulus Schoutsen c33edbe5bb
Use TestCase.addCleanup (#36560) 2020-06-08 12:26:40 -07: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
Paulus Schoutsen 1b7dd6c603
Add icons to scripts (#31899) 2020-02-17 08:44:36 -08:00
Paulus Schoutsen 424e15c7a7
Find related items scripts/automations (#31293)
* Find related items scripts/automations

* Update manifest
2020-01-29 16:19:13 -08:00
Paulus Schoutsen 5fdc60e067
Add Safe Mode (#30723)
* Store last working HTTP settings

* Add safe mode

* Fix tests

* Add cloud to safe mode

* Update logging text

* Fix camera tests leaving files behind

* Make emulated_hue tests not leave files behind

* Make logbook tests not leave files behind

* Make tts tests not leave files behind

* Make image_processing tests not leave files behind

* Make manual_mqtt tests not leave files behind
2020-01-14 13:03:02 -08:00
Paulus Schoutsen 9aa02e35a7
Entity Component to no longer generate automatic groups (#23789) 2020-01-07 17:30:53 +01:00
Bas Nijholt 23b92b2a56 Sort imports according to PEP8 for components starting with "S" (#29777) 2019-12-09 14:38:01 +01:00
Jeff Irion 7090970436 Add descriptive fields to script config (#26056)
* Add descriptive fields to script config

* Add script descriptions to hass.data["service_description_cache"]

* Import SERVICE_DESCRIPTION_CACHE

* Register script descriptions via async_set_service_schema

* Add scripts test for loading and reloading service descriptions

* Minor cleanup

* Clean up script schema
2019-08-21 14:08:46 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus Schoutsen 4e5b1ccde6
Fix calling empty script turn off (#24827) 2019-06-28 08:49:33 -07:00
Paulus Schoutsen de1fd5a7fa
WS: Improve service calling errors (#23840)
* WS: Improve service calling errors

* Docstyle

* Types

* Update text
2019-05-14 07:09:11 +02:00