Chris Browet
e961d92b5e
Allow service data template to return a dict ( #57105 )
2021-10-23 21:10:30 +02:00
Richard T. Schaefer
9e219d9b6e
Add this variable for use by automation and script templates ( #52774 )
2021-07-28 09:09:13 +02:00
Erik Montnemery
b01b33c304
Add trigger condition ( #51710 )
...
* Add trigger condition
* Tweaks, add tests
2021-06-11 15:05:57 +02:00
Erik Montnemery
2c8b7c56f5
Fix race when restarting script ( #49247 )
2021-04-16 09:03:34 +02:00
Paulus Schoutsen
a59460a233
Test that we do not initialize bad configuration ( #48872 )
...
* Test that we do not initialize bad configuration
* Simplify test as we are not calling a service
2021-04-08 22:04:39 +02:00
Erik Montnemery
a49989241a
Refactor tracing: Move trace support to its own integration ( #48224 )
2021-03-22 19:19:38 +01:00
Erik Montnemery
272dffc384
Improve script tracing ( #48100 )
...
* Improve script tracing
* Fix test
2021-03-22 13:15:45 +01:00
Paulus Schoutsen
f67e8b4369
Populate trigger variable when manually triggering automation ( #48202 )
...
* Populate trigger variable when manually triggering automation
* Update tests/components/automation/test_init.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-03-22 08:22:32 +01:00
Franck Nijhof
8a56dbf587
Add flake8 comprehensions checks to pre-commit & CI ( #48111 )
2021-03-19 13:41:09 +01:00
Paulus Schoutsen
f1c274b3dd
Add run_id to automation logbook event ( #47980 )
2021-03-16 14:37:26 -07:00
Klaas Schoute
0097169dd3
Add aliases to actions in automation blueprints ( #47940 )
2021-03-16 17:14:07 +01:00
Erik Montnemery
9647eeb2e0
Add custom JSONEncoder for automation traces ( #47942 )
...
* Add custom JSONEncoder for automation traces
* Add tests
* Update default case to include type
* Tweak
* Refactor
* Tweak
* Lint
* Update websocket_api.py
2021-03-16 14:21:05 +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
Paulus Schoutsen
2a22c54fcb
Store the correct context in the trace ( #47785 )
2021-03-12 08:12:26 +01:00
Erik Montnemery
a9a9e1f199
Tweak automation tracing ( #47721 )
2021-03-10 14:42:13 -08:00
Ville Skyttä
dc880118a4
Lint suppression cleanups ( #47248 )
...
* Unused pylint suppression cleanups
* Remove outdated pylint bug references
* Add flake8-noqa config and note to run it every now and then
* Add codes to noqa's
* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
Paulus Schoutsen
7c2545af6e
Use async_capture_events to avoid running in executor ( #47111 )
2021-02-26 13:28:52 -08:00
Anders Melchiorsen
48002f47f4
Use caplog fixture for log capturing ( #46214 )
2021-02-08 14:33:57 +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
Anders Melchiorsen
b9b1caf4d7
Raise ConditionError for numeric_state errors ( #45923 )
2021-02-08 10:47:57 +01:00
Marc Mueller
7673f57248
Add additional error handling for automation script run ( #45613 )
2021-01-28 09:26:41 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest ( #44746 )
2021-01-01 22:31:56 +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
Paulus Schoutsen
ff4897a09e
Fix using execute on the notify_leaving_zone ( #43858 )
2020-12-02 16:21:00 +01:00
Paulus Schoutsen
6c9c280bbb
Migrate notify-leaving-zone to use mobile app device action ( #43832 )
2020-12-02 13:07:04 +01:00
Paulus Schoutsen
648f9e100d
Use light turn on service ( #43847 )
2020-12-02 10:53:26 +01:00
Paulus Schoutsen
dd513147a5
Add a service target ( #43725 )
2020-11-28 23:33:32 +01:00
Paulus Schoutsen
b3be708db6
Add default config if not there ( #43321 )
...
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-11-25 15:10:04 +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
Franck Nijhof
8837ed35cd
Use direct service calls in tests instead of automation common ( #40623 )
...
* Use direct service calls in tests instead of automation common
* Remove automation common test helpers
2020-09-26 19:28:26 +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
Franck Nijhof
a3c45a6f89
Add shorthand notation for Template conditions ( #39705 )
2020-09-06 16:55:06 +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
Phil Bruckner
e6141ae558
Add description of what caused an automation trigger to fire ( #39251 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-28 17:02:12 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 ( #39287 )
2020-08-27 13:56:20 +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
ca9dd0c833
Reorganize trigger code ( #38655 )
2020-08-17 11:54:56 -05:00
Phil Bruckner
192fe58fc8
Time trigger can also accept an input_datetime Entity ID ( #38698 )
2020-08-11 15:16:28 -05:00
Phil Bruckner
9e12e3f96c
Allow automation to be turned off without stopping actions ( #38436 )
2020-08-01 21:31:47 -05:00
Franck Nijhof
fa9866db96
Add support for multiple time triggers in automations ( #37975 )
...
* Add support for multiple time triggers in automations
* Attach with single callback
* Patch time in tests
* Improve test coverage
* Adjusting my facepalm moment
2020-07-29 14:51:30 -10:00
Phil Bruckner
bbc8748e3b
Stop automation runs when turned off or reloaded ( #38174 )
...
* Add automation turn off / reload test
* Stop automation runs when turned off or reloaded
2020-07-25 12:19:55 +02:00
Eugenio Panadero
8cfffd00d6
Fix state automation trigger ( #38014 ) ( #38032 )
...
for scenarios of enabling/disabling (~ creating/removing) entities,
so it does not trigger in removal if a `to: xxx` is defined, and also
does not trigger in creation if a `from: xxx` is present.
2020-07-23 14:17:11 -05:00
J. Nick Koston
4015991622
Update tests that track time to account for microsecond precision ( #38044 )
2020-07-21 14:22:55 -07:00
J. Nick Koston
60009ec2f9
Use event loop scheduling for tracking time patterns ( #38021 )
...
* Use event loop scheduling for tracking time patterns
* make patching of time targetable
* patch time tests since time can tick to match during the test
* fix more tests
* time can only move forward
* time can only move forward
* back to 100% coverage
* simplify since the event loop time cannot move backwards
* simplify some more
* revert simplify
* Revert "revert simplify"
This reverts commit bd42f232f6
.
* Revert "simplify some more"
This reverts commit 2a6c57d514
.
* Revert "simplify since the event loop time cannot move backwards"
This reverts commit 3b13714ef4
.
* Attempt another simplify
* time does not move backwards in the last two
* remove next_time <= now check
* fix previous merge error
2020-07-20 20:18:31 -10:00
Pascal Vizeli
f4c3f5d074
Revert breaking change for Automation ( #37885 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-07-15 20:38:29 +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
f7c4900d5c
Enhance automation integration to use new features in script helper ( #37479 )
2020-07-05 09:25:15 -05:00
J. Nick Koston
89a9634d35
Use eventloop for scheduling ( #37184 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-29 09:39:24 -07:00