Commit Graph

930 Commits (a47f73244c0b3fbe4210ffd7731be69b3984fbbd)

Author SHA1 Message Date
Paulus Schoutsen fefa1a7259
Add shortcuts when we know template is static (#39208)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2020-08-24 13:40:34 +02:00
J. Nick Koston c3ad493bb7
Report usage of extract_entities by custom components (#39185)
Block core usage usage of extract_entities

Suggest event.async_track_template_result instead.
2020-08-23 19:38:45 +02:00
Bas Nijholt a9ffc149f8
Allow templating keys in data_template (#39008)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-08-21 22:42:05 +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
J. Nick Koston 1381b279f0
Update template sensor to use async_track_template_result (#38940)
* Add template entity

* Update template tracking to work for template sensors

* add test for whitespace

* Update homeassistant/helpers/config_validation.py

* revert

* fix

* reduce

* fix _refresh missing decorator

* defer until start

* do not throw errors during startup

* defer tracking until start event

Co-authored-by: Swamp-Ig <github@ninjateaparty.com>
2020-08-20 08:06:41 -05:00
Franck Nijhof bdc5af8dd2
Add support for attributes in (numeric) state conditions (#39050) 2020-08-19 20:01:27 +02:00
Paulus Schoutsen 3dc79aa60a
Track entity sources (#37258)
Co-authored-by: David Mulcahey <david.mulcahey@me.com>
2020-08-19 14:57:38 +02:00
Paulus Schoutsen 24a16ff8fe
Add image integration (#38969) 2020-08-19 11:33:04 +02:00
Ville Skyttä 802c556e82
State and service related type hint improvements (#38956)
* Improve type hint of service_func to register

* Add named type for state values

* Narrow some unnecessarily broad state type hints
2020-08-17 15:02:43 -04:00
Phil Bruckner ca9dd0c833
Reorganize trigger code (#38655) 2020-08-17 11:54:56 -05:00
J. Nick Koston 472b12bef5
Update TrackTemplateResultInfo to remove side effects from init (#38934)
* Verify and case

* Review comments

* Update homeassistant/helpers/event.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/helpers/event.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-08-16 11:16:28 -05:00
J. Nick Koston 7d0e356560
Add track_template_result method to events (#38802)
* Merge original changes from #23590

* guard

* adjust

* adjust

* adjust

* Update async_render_to_info for recent codebase changes

* no more protected access

* do not fire right away per review comments

* update test to not fire right away

* closer

* rework tests for non firing first

* augment coverage

* remove cruft

* test for complex listen add/remove

* update docs to match review feedback to not fire right away

* preserve existing behavior

* fix test

* Ensure listeners are cleaned up

* de-dupe and comment

* de-dupe and comment

* coverage

* test to login again if we go from exception to ok to exception

* Update homeassistant/core.py

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

* Update homeassistant/helpers/event.py

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

* rename _boolean_coerce to result_as_boolean and move it out of event

* additional coverage

* Add more tests (may still be able to trim this down)

Co-authored-by: Swamp-Ig <github@ninjateaparty.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-08-15 19:53:03 -05:00
Franck Nijhof 755761867d
Use current request context in OAuth redirect (#38692) 2020-08-15 15:26:54 +02:00
J. Nick Koston af5cb948a0
Adjust slow add entities timeouts to handle slowest known case (#38876)
With this change, we should still be able to startup
in under 10 minutes if something really goes wrong.

The testing done in #38661 was used to determine
these values.
2020-08-15 07:14:02 +02:00
Paulus Schoutsen b3571602bb
Add default_* to device registry (#38829) 2020-08-13 10:38:56 +02:00
Ville Skyttä 991bf126d4
Helpers type hint improvements (#38522) 2020-08-12 23:01:10 +02:00
Joakim Plate 15db2225da
async_get_instance was not reentrant during await (#38263) 2020-08-12 22:35:24 +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
J. Nick Koston 45526f4e8a
Add async_track_state_added_domain for tracking when states are added to a domain (#38776)
* Fire event_state_added when a state is added after start

* async_track_state_added_domain

* test

* naming

* coverage
2020-08-12 13:30:40 -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
J. Nick Koston 444df4a7d2
Use the shared zeroconf instance when attempting to create another Zeroconf instance (#38744) 2020-08-12 16:08:33 +02:00
Franck Nijhof 20710d8605
Add current request context to get_url helper (#38602) 2020-08-09 14:07:31 +02:00
J. Nick Koston ef8e74786f
Support extracting entities by domain from templates (#38647) 2020-08-09 13:44:09 +02:00
Pascal Vizeli 72a6251042
V2 timeout for async_add_entities (#38601)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-08-07 08:36:38 +02:00
Pascal Vizeli 896bdbff8f
Revert "Add a timeout for async_add_entities (#38474)" (#38584)
This reverts commit 7590af3930.
2020-08-06 09:32:42 +02:00
J. Nick Koston 7590af3930
Add a timeout for async_add_entities (#38474) 2020-08-05 18:06:21 +02:00
Pascal Vizeli c291d4aa7d
Intelligent timeout handler for setup/bootstrap (#38329)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-05 14:58:19 +02:00
J. Nick Koston 62c664fbbd
Reduce time to reload yaml and check configuration (#38469)
* Reduce time to reload yaml and check configuration

We spend a significant amount of time compiling templates
that we have already compiled.

Use an LRU cache to avoid re-compiling templates that
we frequently use.

* pylint

* switch to WeakValueDictionary

* preen
2020-08-04 03:00:44 +02:00
Phil Bruckner c3a820c4a3
Fix queued script not updating current attribute when queuing (#38432) 2020-08-01 15:51:48 +02:00
J. Nick Koston fe69a85386
Improve logging when a unique id conflict is detected (#38434)
* fix error when unique id is re-used

* add test for the logging

* Update homeassistant/helpers/entity_platform.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/helpers/entity_platform.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-08-01 11:20:37 +02:00
J. Nick Koston 79055487ed
Simplify generate_entity_id (#38418)
* Simplify generate_entity_id

Use similar optimized logic for async_generate_entity_id
from entity_registry that was already optimized

* pylint

* make generate_entity_id a wrapper around async_generate_entity_id instead
2020-07-31 08:50:42 +02:00
Ville Skyttä c2a21fa496
Update coordinator improvements (#38366)
* Make generic

* Add type info to bunch of uses

* Recognize requests exceptions

* Recognize urllib exceptions
2020-07-30 18:04:00 +03: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 726d5fdd94
Allow float values in time periods (#38023) 2020-07-21 19:41:42 -05: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
J. Nick Koston 6ea5c8aed9
Index the device registry (#37990) 2020-07-19 23:32:05 -07:00
J. Nick Koston 890562e3ae
Index the entity registry (#37994) 2020-07-19 22:52:41 -07:00
David F. Mulcahey 967a168ab7
Update comment about parallel updates to match the documentation (#37964) 2020-07-19 14:40:08 -10:00
J. Nick Koston 910b6c9c2c
Index entity_registry_updated listeners (#37940) 2020-07-17 21:59:18 -07:00
J. Nick Koston fa4e9c0485
Increase test line coverage of homeassistant/helpers/event.py to 100% (#37927)
* Increase test line coverage of homeassistant/helpers/event.py to 100%

* fix test
2020-07-16 21:47:53 -07:00
J. Nick Koston b6befa2e83
Ensure a state change tracker setup from inside a state change listener does not fire immediately (#37924)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-07-16 17:50:06 -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
J. Nick Koston 41cd90648e
Have async_track_point_in_utc_time call async_run_job directly from call_at (#37790)
We do not need a nested function here since call_at
takes args
2020-07-14 17:24:36 -10:00
Bram Kragten 7d77fa92c2
Add mode info attributes to script and automation (#37815)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-14 10:47:59 -07:00