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
cdce8p
fa98a27df7
Remove service helper (2) ( #16863 )
...
* alarm_control_panel
* automation
* camera
* climate
* counter
* fan
* Add legacy notes
* Fix tests
2018-09-26 09:49:55 +02:00
Paulus Schoutsen
746f4ac158
Add context to scripts and automations ( #16415 )
...
* Add context to script helper
* Update script component
* Add context to automations
* Lint
2018-09-04 21:16:24 +02:00
Ville Skyttä
dd9d53c83e
Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0 ( #14557 )
...
* Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0
* Pydocstyle D401 fixes
2018-08-24 10:28:43 +02:00
Ville Skyttä
dbd0763f83
Grammar and spelling fixes ( #16065 )
2018-08-19 22:29:08 +02:00
Andrey
140a874917
Add typing to homeassistant/*.py and homeassistant/util/ ( #15569 )
...
* Add typing to homeassistant/*.py and homeassistant/util/
* Fix wrong merge
* Restore iterable in OrderedSet
* Fix tests
2018-07-23 10:24:39 +02:00
Anders Melchiorsen
fcbc399809
Disallow automation.trigger without entity_id ( #14724 )
2018-06-01 10:27:12 -04:00
Ville Skyttä
843789528e
Remove extra quotes from docstrings ( #14431 )
2018-05-13 11:06:15 +02:00
Otto Winter
8dcfd35b8b
Spelling fixes ( #12041 )
...
* Spelling fixes
*Lots* of them.
* Spelling breaking changes
* Fix lint errors
2018-01-29 23:37:19 +01:00
Adam Mills
6918993c75
Fix state for trigger with forced updates ( #11595 )
2018-01-11 22:06:09 -08:00
Pascal Vizeli
ea6ca9252c
Bugfix trigger state with multible entities ( #10857 )
...
* Bugfix trigger state with multible entities
* Fix numeric state
* fix lint
* fix dict
* fix unsub
* fix logic
* fix name
* fix new logic
* add test for state
* add numeric state test for unsub
* add test for multible entities
* Update numeric_state.py
* Update numeric_state.py
* Update state.py
* Fix logic for triple match
* Add clear to numeric state
* clear for state trigger
2017-11-30 21:03:52 +01:00
Anders Melchiorsen
61ccbb59ce
Fire numeric_state action when first state change matches criteria ( #10125 )
...
* Fire numeric_state action when first state change matches criteria
* Remove lint
* Update numeric_state.py
2017-10-25 16:01:09 +02:00
Adam Mills
5f8eb08cd9
Additional event data tests to cover recent bugs
2017-10-23 19:44:07 -04:00
Adam Mills
4e7cc110d9
Fix no data event triggers ( #10049 )
...
* Test including extra data on a no data trigger
* Match any dicts for default schema for event data
* Fix indentation
* Only check schema if one was configured
2017-10-22 20:20:38 -04:00
cdce8p
be5c0b2d92
Wait_template - support for 'trigger.entity_id' and data_template values ( #9807 )
...
* *Added support for use of 'trigger.entity_id' and service->data_template->script in wait_template
* * Fixed style violations
* * Fixed regular expression (_RE_GET_POSSIBLE_ENTITIES)
* * combined 'extract_entities' and 'extract_entities_with_variables'
* fixed regular expression
* * Added first test for extract_entities_with_variables
* * Added Unittests (tests/helpers/test_template.py test_extract_entities_with_variables)
* * Added Unittests (tests/helpers/test_script.py test_wait_template_variables)
* * Added Unittests (tests/components/automation/test_template.py test_wait_template_with_trigger)
* * Added Unittests (tests/components/automation/test_state.py test_wait_template_with_trigger)
* * Added Unittests (tests/components/automation/test_numeric_state.py test_wait_template_with_trigger)
* * Fixed style violations
* * Fixed style violations
* * Fixed style violations
* * Fixed style violations
* * Fixed style violations
* * Fixed style violations
* * Updated regular expression and delete whitespaces
2017-10-12 16:57:18 +02:00
Adam Mills
4342d7aa17
Event trigger nested conditions ( #9732 )
...
* Test to supported nested event triggers
* Update event trigger to allow nested data tests
2017-10-07 13:13:32 -07:00
Pascal Vizeli
ed699896cb
Core track same state for a period / Allow on platforms ( #9273 )
...
* Core track state period / Allow on platforms
* Add tests
* fix lint
* fix tests
* add new tracker to automation state
* update schema
* fix bug
* revert validate string
* Fix bug
* Set arguments to async_check_funct
* add logic into numeric_state
* fix numeric_state
* Add tests
* fix retrigger state
* cleanup
* Add delay function to template binary_sensor
* Fix tests & lint
* add more tests
* fix lint
* Address comments
* fix test & lint
2017-09-05 02:01:01 +02:00
Anders Melchiorsen
b83ff739bc
Remove deprecated automation keywords ( #8510 )
...
* Remove deprecated automation keywords
* Remove retired test case
* Remove retired keyword
2017-07-17 22:24:05 +02:00
Paulus Schoutsen
7bf6ceafec
Split mock_service ( #8198 )
2017-06-25 10:53:15 -07:00
Pascal Vizeli
814834512a
Group service / dynamic handling ( #7971 )
...
* Add Service to group
* Finish service
* Add service functions
* fix lint
* Address paulus comments
* fix lint & cleanup
* fix lint
* fix lint
* fix lint p3
* add test for check group
* add more tests
* fix lint
* Update service.yaml
* Fix order for tests
* Fix comment
* Fix test
* Fix tests
* Fix name in tests
* Fix view
* Fix default value
* Fix lint
* Fix key error
* add name
* migrate component entity
* fix tests
* fix import
* migrate device tracker
* fix lint
* fix bug
* fix logic
* fix lint
* fix tests
* fix generator
* fix group
* fix other tests.
* Not need to load group on first stage anymore.
* fix service
* add more group depency
* fix tests
* Revert "fix tests"
This reverts commit 35a922b3a8
.
* Real fix
* fix test p2
* fix test p3
* fix test p4
* fix test p5
* fix test p6
* fix lint
* fix test p7
* Rename attribute
* fix group test
* fix bug
* fix flagy tests
* fix service.yaml
* fix lint
2017-06-16 00:52:28 +02:00
Adam Mills
beb8c05d91
Use expected behvaior for above/below ( #7857 )
2017-06-01 22:43:24 -07:00
Adam Mills
cf42303afb
Rename time trigger 'after' to 'at' ( #7846 )
2017-06-01 22:40:27 -07:00
Anders Melchiorsen
81f0826550
Ignore attribute changes in automation trigger from/to ( #7651 )
...
* Ignore attribute changes in automation trigger from/to
* Quote names in deprecation warnings
This makes it somewhat easier to read if the suggestion happens to be
named "to".
* Add test with same state, new attribute value
2017-05-20 15:18:59 -04:00
Paulus Schoutsen
e773133bcf
Fix automation failing to setup if no automations specified ( #7647 )
2017-05-17 21:57:50 -07:00
Adam Mills
e2e58e6acc
Automation State Change For timer attribute fix ( #7584 )
2017-05-15 00:34:30 -07:00
Adam Mills
40d27cde0e
Refactor sun component for correctness ( #7295 )
...
* Refactor sun component for correctness
* Convert datetimes to dates for astral
* Fix tests for updated code
* Fix times now that calcs are fixed
* Move sun functions to helpers
* Fix flake on new file
* Additional tweaks from review
* Update requirements
2017-05-09 00:03:34 -07:00
Paulus Schoutsen
9440ff881f
Remove listening to homeassistant_start with event automation ( #7474 )
2017-05-06 23:52:39 -07:00
Paulus Schoutsen
29f385ea76
Fix automations listening to HOMEASSISTANT_START ( #6936 )
...
* Fire EVENT_HOMEASSISTANT_START automations off right away while starting
* Actually have core state be set to 'starting' during boot
* Fix correct start implementation
* Test and deprecate event automation platform on start
* Fix doc strings
* Remove shutting down exception
* More strict when to mark an instance as finished
* Add automation platform to listen for start/shutdown
* When we stop we should wait till it's all done
* Fix testing
* Fix async bugs in tests
* Only set UVLOOP when hass starts from CLI
* This hangs normal asyncio event loop
* Clean up Z-Wave node entity test
2017-04-05 23:23:02 -07:00
Paulus Schoutsen
23645da74c
Automation: initial state > restore state ( #6911 )
...
* Automation: initial state > restore state
* Clean up code
* Ensure MQTT defaults are used.
* Ensure failed platforms always return None
* Automation: write state to state machine after start
2017-04-03 23:11:39 -07:00
Pascal Vizeli
f4e9466394
Bugfix automation fire on bootstrap ( #6770 )
...
* Bugfix automation fire on bootstrap
* Add test & fix bug
* fix lint
2017-03-24 15:52:14 -07:00