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
Paulus Schoutsen
5bc6ed4cef
Add logbook platforms ( #37078 )
...
* Add logbook platforms
* Fix logbook describe test
2020-06-24 18:14:50 -07:00
Erik Montnemery
280f49540e
Drop use of async_mock_mqtt_component ( #37011 )
2020-06-22 23:59:50 +02: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
e6fe34e64d
Migrate automation to use describe_event for logbook ( #36356 )
2020-06-01 17:18:40 -07:00
Franck Nijhof
1883b1d2a2
Add config reloaded events for automation and scene ( #34664 )
2020-06-01 15:19:00 -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
8c65062271
Several optimizations to automations ( #35007 )
2020-05-01 16:37:25 +02:00
Paulus Schoutsen
ec47216388
Use built-in test helpers on 3.8 ( #34901 )
2020-04-30 13:29:50 -07:00
Paulus Schoutsen
77443b3d09
Add Home Assistant Started event ( #34657 )
2020-04-24 14:13:39 -07:00
Franck Nijhof
bc5a2da7b7
Add transition support to scenes, cleanup blocking parameter ( #34434 )
2020-04-20 18:07:50 -07:00
springstan
eae21be5b9
Improve string formatting v6 ( #33698 )
2020-04-07 23:14:28 +02:00
Eugenio Panadero
fb22f6c301
Add Context support for async_entity removal ( #33209 )
...
* Add Context for async_remove
* Check context in state automation on entity removal
2020-03-24 09:59:17 -07:00
Eugenio Panadero
cd57b764ce
Fix state_automation_listener when new state is None ( #32985 )
...
* Fix state_automation_listener when new state is None (fix #32984 )
* Listen to EVENT_STATE_CHANGED instead of using async_track_state_change
and use the event context on automation trigger.
* Share `process_state_match` with helpers/event
* Add test for state change automation on entity removal
2020-03-23 16:05:21 -07:00
Paulus Schoutsen
4cf86262af
Numeric state trigger: validate that above is not above below ( #32421 )
...
* Numeric state trigger: validate that above is not above below
* Lint
2020-03-03 17:26:44 -08:00
Paulus Schoutsen
67680bcfa8
Automation device/entity extraction to include triggers + conditions ( #31474 )
...
* Add support for extracting triggers
* Add support for extracting triggers
* Fix test
2020-02-05 16:52:21 +01: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
Christian Clauss
1d537ad416
Fix typo: serivce --> service ( #31217 )
2020-01-27 19:56:26 +01:00
Ville Skyttä
5e2ba2eb77
Enable some more bandit checks ( #30857 )
...
* Enable B108 (hardcoded tmp dir), address findings
* Enable B602 (subprocess popen with shell), address findings
* Enable B604 (start process with shell), address findings
* Enable B306 (mktemp), B307 (eval), and B325 (tempnam), no issues to address
2020-01-20 18:44:55 +02: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
Santobert
3d7488d188
Trigger automation without skipping condition ( #28484 )
...
* Trigger automation without skipping condition
* [] instead of .get()
* Update __init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-01-08 10:36:11 +01:00
Paulus Schoutsen
9aa02e35a7
Entity Component to no longer generate automatic groups ( #23789 )
2020-01-07 17:30:53 +01:00
Ville Skyttä
5216477353
Be consistent with Home Assistant and Hass.io spelling ( #30500 )
...
* Be consistent with Home Assistant spelling
* Be consistent with Hass.io spelling
2020-01-05 14:09:17 +02:00
Ville Skyttä
e6388e186c
Remove unnecessary string literal concatenations ( #30360 )
2020-01-02 21:17:10 +02:00
Bas Nijholt
d3f67c3841
use isort to sort imports according to PEP8 for automation ( #29620 )
2019-12-08 21:59:39 +05:30
Alexei Chetroi
ccb0fd5e32
Register automation.reload service as an admin service. ( #29582 )
...
* homeassistant/components/automation/__init__.py
* Register automation.reload as an admin service.
2019-12-07 21:17:30 +01:00
Paulus Schoutsen
41440d4f1b
Fix litejet tests
2019-12-04 21:47:35 -08:00
Paulus Schoutsen
02d9ed5e36
Do not select all entities when omitting entity ID in service call ( #29178 )
...
* Do not select all entities when omitting entity ID
* Address comments Matthew
* Require either area_id or entity_id
* Fix tests
* Fix test
2019-12-02 16:23:12 -08:00
Erik Montnemery
42691b783e
Handle empty service in script action gracefully ( #27467 )
...
* Handle empty service in script action gracefully
* Add test
2019-10-12 12:28:47 -07:00
Santobert
cc1cca0a14
automation_reproduce_state ( #27222 )
2019-10-05 12:31:51 -07:00
Erik Montnemery
fad54cd6d8
Ensure sun conditions are using the right date ( #23664 )
...
* Ensure sun conditions are using the right date
2019-08-16 17:34:56 +02:00
Paulus Schoutsen
4de97abc3a
Black
2019-07-31 12:25:30 -07:00
Phil Bruckner
9944e675a5
Add template support to state trigger's for option ( #24912 )
2019-07-08 13:59:58 -07:00
Phil Bruckner
f9b9883aba
Add template support to numeric_state trigger's for option ( #24955 )
2019-07-08 13:58:50 -07:00
Phil Bruckner
8dca73d08e
Add missing trigger.for variable to template trigger ( #24893 )
2019-07-02 17:46:26 +02:00
Phil Bruckner
3f4ce70414
Fix 'same state' monitoring in state trigger ( #24904 )
2019-07-02 17:29:38 +02:00
Phil Bruckner
945afbc6d4
Fix 'same state' monitoring in numeric_state trigger ( #24910 )
2019-07-02 17:28:02 +02:00
Phil Bruckner
03e6a92cf3
Add template support to template trigger's for option ( #24810 )
2019-06-28 22:30:47 -07:00
Franck Nijhof
d648eb1e4f
Minor improvements to automation test suite ( #24424 )
...
* Minor improvements to automation test suite
* Removes unused asyncio imports
* Removes some vars that are not needed
2019-06-08 19:10:23 -05:00
Franck Nijhof
9235b52828
Restore automation last_triggered with initial_state override ( #24400 )
...
* Restore automation last_triggered with initial_state override
* Made test async/await
* Fixes linter warning
* Update test_init.py
2019-06-08 12:48:36 -07:00
Paulus Schoutsen
7887d6d6e4
Fix automation failing to restore state ( #24390 )
...
* Fix automation off
* Fix tests
2019-06-07 23:08:22 -07:00
Phil Bruckner
61dabae6ab
Add for option for template triggers ( #24330 )
2019-06-07 21:45:37 -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
Erik Montnemery
3c5abcc71a
Improve sun automation tests ( #23588 )
...
* Improve sun automation tests
* Lint
* Restore timezone after test
2019-05-02 09:46:32 +02:00
ActuallyRuben
df580b2322
Add URL query parameters to webhook trigger result data ( #23043 )
...
* Added query parameters to webhook data
* Added test for query webhook
* Add second blank line in new test for webhook trigger
2019-04-14 10:53:35 -07:00
Paulus Schoutsen
e48ef7f441
Fix broken platform components ( #22943 )
...
* Fix broken platform components
* Lint
2019-04-09 15:42:44 -07:00
Jason Hu
c82d2cb11c
Cherry pick test fix ( #22939 )
2019-04-09 13:59:15 -07:00
Paulus Schoutsen
52f337ef00
Allow chaining contexts ( #21028 )
...
* Allow chaining contexts
* Add stubbed out migration
2019-03-01 10:08:38 -08:00
emontnemery
ec5da05804
Add character encoding to MQTT automation. ( #20292 )
2019-01-24 22:43:56 -08:00
Adam Mills
336b6adc88
Split time_pattern triggers from time trigger ( #19825 )
...
* Split interval triggers from time trigger
* Default smaller interval units to zero
* Rename interval to schedule
* Rename schedule to time_pattern
2019-01-15 09:33:34 -08:00
Malte Franken
6d3343e4d1
Geo Location -> Geolocation (class names and unit test comments) ( #19877 )
...
* fixed geolocation naming in class names
* fixed geolocation naming in comments in unit test
2019-01-08 20:11:51 -08:00
Paulus Schoutsen
9d9e11372b
Make automations log errors ( #18965 )
2018-12-13 12:21:16 +01:00
Jason Hunter
b900005d1e
New Events and Context Fixes ( #18765 )
...
* Add new events for automation trigger and script run, fix context for image processing, add tests to ensure same context
* remove custom logbook entry for automation and add new automation event to logbook
* code review updates
2018-12-04 09:45:17 +01:00
Adam Mills
0d7cb54872
Update litejet automation tests to async ( #18287 )
2018-11-07 09:56:10 +01:00
Ville Skyttä
9c840f93f0
Use const.SUN_EVENT_* more ( #18039 )
2018-10-31 09:10:28 +01:00
Anders Melchiorsen
3de822a0e2
RFC: Static templates match no entities, not all ( #17991 )
...
* Static templates match no entities, not all
* Clean up test values
2018-10-30 12:03:27 +01:00
Paulus Schoutsen
e276e899cf
Convert automation tests to async ( #17794 )
...
* Convert automation tests to async
* Fix 8 last tests
* Lint
2018-10-26 11:31:14 +02:00
Paulus Schoutsen
08fe7c3ece
Pytest tests ( #17750 )
...
* Convert core tests
* Convert component tests to use pytest assert
* Lint 🤷♂️
* Fix test
* Fix 3 typos in docs
2018-10-24 12:10:05 +02:00
Malte Franken
75e42acfe7
Geo location trigger added ( #16967 )
...
* zone trigger supports entity id pattern
* fixed lint error
* fixed test code
* initial version of new geo_location trigger
* revert to original
* simplified code and added tests
* refactored geo_location trigger to be based on a source defined by the entity
* amended test cases
* small refactorings
2018-10-22 20:01:01 +02:00
Paulus Schoutsen
68472b8241
Add a webhook automation trigger ( #17246 )
2018-10-08 20:16:37 +02:00