J. Nick Koston
5ca4b4cd0f
Set the translations cache under the lock ( #42470 )
2020-10-27 22:02:38 +01:00
Franck Nijhof
45aba9bdf2
Allow skip parsing template result ( #42401 )
2020-10-26 16:01:09 +01:00
Paulus Schoutsen
bba770b411
Fix CI ( #42397 )
2020-10-26 13:36:03 +01:00
Paulus Schoutsen
e552c9ba96
Store original result on template results ( #42391 )
...
* Store original result on template results
* Fix shell command test
2020-10-26 11:30:58 +01:00
J. Nick Koston
ce2c388c09
Ensure config entry platforms are excluded from reload ( #42367 )
2020-10-25 23:53:31 +01:00
J. Nick Koston
6822190772
Fix unmocked https in the test suite ( #42316 )
2020-10-25 07:16:23 -05:00
Robert Svensson
e06c8009e1
Add area id to entity registry ( #42221 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-24 21:25:28 +02:00
Anders Melchiorsen
cb0c937b3e
Refresh now() templates on second=0 ( #42225 )
2020-10-23 00:11:02 +02:00
J. Nick Koston
4a0d18ccd8
Avoid overloading the executor with service.yaml loads ( #42172 )
2020-10-21 22:24:50 +02:00
J. Nick Koston
df2ede6522
Fix state overwrite race condition where two platforms request the same entity_id ( #42151 )
...
* Fix state overwrite race condition where two platforms request the same entity id
* fix test
* create reservations instead
* revert
* cannot use __slots__ because we patch async_all
2020-10-21 17:01:51 +02:00
J. Nick Koston
31c21126a8
Implement time tracking in templates ( #41147 )
...
Co-authored-by: Anders Melchiorsen <amelchio@nogoto.net>
2020-10-19 11:02:43 +02:00
J. Nick Koston
77b95ae8a1
Reduce domain states rate limit to 1 per second ( #42004 )
2020-10-19 10:18:25 +02:00
J. Nick Koston
3a9b2392f8
Suppress domain and all listeners during template rate limit ( #42005 )
2020-10-19 10:17:51 +02:00
Paulus Schoutsen
6ab9b7355f
Add tests for singleton decorator ( #42055 )
2020-10-18 22:41:22 +02:00
Philip Allgaier
dde6305549
Cleanup unused loggers (components N-Z + tests) ( #41982 )
2020-10-16 21:24:08 -05:00
J. Nick Koston
21cc23244d
Improve template ratelimit performance ( #41741 )
2020-10-15 12:02:05 +02:00
J. Nick Koston
53a1d92f2b
Permit event trackers to accept an empty list of entities or domains ( #41857 )
2020-10-15 09:26:51 +02:00
J. Nick Koston
1bcedd15b3
Update sun listeners to use HassJob ( #41695 )
...
Avoids checking the callable type every time sun events trigger
2020-10-13 21:37:10 +02:00
Erik Montnemery
12a6d10168
Log exceptions in EntityPlatform.async_add_entities ( #41730 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-13 15:35:27 +02:00
Ville Skyttä
f28c3273c2
Upgrade mypy to 0.790 ( #41595 )
2020-10-12 19:17:30 -05:00
J. Nick Koston
b897ca7260
Ensure all template errors are caught and the websocket api reports them ( #41719 )
2020-10-12 16:38:24 +02:00
Matthias Alphart
93a9a11065
Add config validator helper positive_float ( #41640 )
2020-10-11 22:04:49 +02:00
Raman Gupta
d3734aae9d
Allow custom_serializer to recognize cv.string and cv.boolean to make config schema more reusable ( #41532 )
2020-10-09 09:36:54 +02:00
J. Nick Koston
852d1b2e67
Update discovery to use HassJob ( #41511 )
...
Predetermine the listener types for discovery
2020-10-09 09:35:28 +02:00
J. Nick Koston
3a863c4a0f
Fully convert async_track_time_interval to use HassJob ( #41513 )
...
The callback type for interval_listener was being determined
each time the interval hit.
This was missed in the original conversion.
2020-10-09 09:35:09 +02:00
J. Nick Koston
5ebf5996f1
Predetermine listener type for script change listeners ( #41510 )
2020-10-09 08:41:12 +02:00
J. Nick Koston
0b3bea0282
Use async_add_hass_job for debouncer ( #41449 )
2020-10-09 08:40:36 +02:00
Erik Montnemery
343e5d64b8
Add MQTT integration discovery ( #41332 )
...
* Add MQTT integration discovery
* Add script/hassfest/mqtt.py
* Unsubscribe if config entry exists
* Add homeassistant/generated/mqtt.py
* Fix bad loop
* Improve tests
* Improve tests
* Apply suggestions from code review
Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
* Prevent initiating multiple config flows
Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
2020-10-07 18:30:51 +02:00
J. Nick Koston
9e1461da62
Determine how to run listeners at setup time instead of execution time ( #41304 )
2020-10-07 16:51:50 +02:00
J. Nick Koston
8d5c124deb
Improve performance of generating non-cryptographically secure uuids ( #41314 )
2020-10-07 16:37:01 +02: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
J. Nick Koston
2fabd4edb8
Prevent collecting states already referenced by domain or all ( #41308 )
...
The template engine would collect all the states in
a domain or all states while iterating even though
they were already included in all or the domain
This lead to the rate limit not being applied to
templates that iterated all states that also
accessed a collectable property because the engine
incorrectly believed they were specifically
referenced.
2020-10-06 07:25:05 +02:00
J. Nick Koston
f50976a0b3
Switch to asyncio.wait for slow update warning implementation ( #41184 )
2020-10-05 15:28:15 +02:00
Paulus Schoutsen
8ae3f575dd
Add extended validation for script repeat/choose ( #41265 )
2020-10-05 14:03:48 +02:00
Paulus Schoutsen
fe2c16dc29
Allow any value when triggering on state attribute ( #41261 )
2020-10-05 12:53:12 +02:00
J. Nick Koston
51da605b9f
Remove manual rate_limit control directive from templates ( #41225 )
...
Increase default rate limit for all states and entire
domain states to one minute
Ensure specifically referenced entities are excluded from
the rate limit
2020-10-04 22:40:04 +02:00
Franck Nijhof
38d132addd
Fix referenced entity extraction when service call entity contains a template ( #41107 )
2020-10-03 20:55:59 +02:00
springstan
a2c3c33b22
Use core GitHub URL in all files ( #41089 )
2020-10-03 00:04:11 +02:00
J. Nick Koston
ab17b4ab70
Simplify template tracking and make it easier to follow ( #41030 )
2020-10-02 07:27:39 -05:00
Paulus Schoutsen
22b4ad6308
Allow processing data in CoordinatorEntity before writing state ( #40926 )
2020-10-02 09:16:37 +02:00
J. Nick Koston
b45215f1d2
Implement template rate_limit directive ( #40667 )
2020-10-01 21:39:44 +02:00
springstan
c7ebfdb403
Use single_instance_allowed for webhook config flows ( #40965 )
2020-10-01 20:44:13 +02:00
J. Nick Koston
7285c7806f
Seperate state change tracking from async_track_template_result into async_track_state_change_filtered ( #40803 )
2020-10-01 10:19:20 +02:00
J. Nick Koston
205cf57a77
Code cleanups for async_track_template_result ( #40737 )
2020-09-30 13:00:21 +02:00
J. Nick Koston
e564af0b5b
Improve performance of accessing template state ( #40323 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-09-28 10:35:12 -05:00
J. Nick Koston
e08ee282ab
Abort execution of template renders that overwhelm the system ( #40647 )
2020-09-28 14:43:22 +02:00
J. Nick Koston
57b7559832
Ensure all jinja2 errors are trapped and displayed in the developer tools ( #40624 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-09-26 17:03:32 -05:00
J. Nick Koston
3261a904da
Reduce the number of template re-renders when we are only counting states ( #40272 )
2020-09-26 16:29:49 -05:00
J. Nick Koston
35533407fe
Improve performance of counting and iterating states in templates ( #40250 )
...
Co-authored-by: Anders Melchiorsen <amelchio@nogoto.net>
2020-09-26 11:36:47 -05:00
Franck Nijhof
c64eec3238
Add bare hostname as valid known hostname in get_url helper ( #40510 )
2020-09-26 09:36:03 +02:00
Ville Skyttä
167490b71c
Complete helpers.service type hints ( #40193 )
...
* Complete helpers.service type hints
* Update homeassistant/helpers/service.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Handle None entity.supported_features
2020-09-20 12:03:58 +03:00
Philip Allgaier
ddbcfe83dd
Catch TypeError in strptime() template helper ( #40226 )
2020-09-18 15:29:40 +02:00
J. Nick Koston
e9abb357e4
Log template listeners when debug logging is on ( #40180 )
2020-09-17 14:45:30 -05:00
springstan
db582bdc1b
Use http status constants more, add HTTP_ACCEPTED and HTTP_BAD_GATEWAY ( #39993 )
...
* Use http status codes and add HTTP_BAD_GATEWAY constant
* Address review comments:
- using constants in tado integration
- using constant in media_player init.py
* Add and use HTTP_ACCEPTED constant
2020-09-15 20:01:07 +03:00
J. Nick Koston
949bd8d738
Reduce listener cancelation code in template tracker ( #40040 )
2020-09-14 21:43:00 +02:00
Franck Nijhof
cd26384634
Fix entity extraction from Template conditions ( #40034 )
2020-09-13 22:05:45 +02:00
J. Nick Koston
ff4bb962c4
Cleanup and reduce duplicate code from recent template changes ( #40012 )
...
As a result of refactoring, there is duplicate code
we can now reduce.
Additionally `_wrap_state` can be removed because
it had unreachable checks for `None`
2020-09-13 09:21:11 -05:00
J. Nick Koston
aaa8083d49
Change template loop detection strategy to allow self-referencing updates when there are multiple templates ( #39943 )
2020-09-12 14:20:21 +02:00
Jakob Schlyter
9b49ca3820
Add template filter timedelta_seconds to create a timedelta from seconds ( #39608 )
2020-09-11 15:07:31 -05:00
J. Nick Koston
741487a1fc
Return the listeners with the template result for the websocket api ( #39925 )
2020-09-11 13:18:40 -05:00
Thomas Lovén
f59e727f16
Set variable values in scripts ( #39915 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-09-11 13:16:25 +02:00
J. Nick Koston
e208aac834
Add async_track_state_removed_domain to allow tracking when a state is removed from a domain ( #39859 )
...
when a state is removed from a domain
2020-09-11 13:03:31 +02:00
Franck Nijhof
101b5b3b35
Accept known hosts for get_url for OAuth ( #39936 )
2020-09-11 13:00:00 +02:00
Paulus Schoutsen
5117a16841
Extract variable rendering ( #39934 )
2020-09-11 12:24:16 +02:00
J. Nick Koston
fd8a4182d9
Detect self-referencing loops in template entities and log a warning ( #39897 )
2020-09-10 20:50:11 +02:00
Paulus Schoutsen
aa9dff572e
Add default variables to script helper ( #39895 )
2020-09-10 20:41:42 +02:00
Joakim Sørensen
0cce35b23e
Add exception for NoURLAvailableError in OAuth2FlowHandler ( #39845 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-09-10 14:52:49 +02:00
J. Nick Koston
8adfcf23f0
Fix isy994 send_node_command ( #39806 )
2020-09-08 17:31:08 +02:00
Paulus Schoutsen
63aa46369b
Copy instead of deepcopy the variables in a wait for trigger ( #39796 )
2020-09-08 15:23:38 +02:00
Aidan Timson
6f43285a28
Force token expires_in to float ( #39489 )
2020-09-07 21:26:58 +02:00
J. Nick Koston
90d574e521
Ensure static templates are still called back on first refresh ( #39753 )
2020-09-07 17:19:39 +02:00
J. Nick Koston
2e6cd4f12b
Optimize template sandbox for Home Assistant ( #39731 )
2020-09-07 09:17:41 +02:00
Erik Montnemery
863b63d75e
Fix handling of device registry defaults ( #39688 )
2020-09-06 21:08:50 -05:00
Franck Nijhof
1ec3446c56
State condition can also accept an input_* Entity ID as state value ( #39691 )
2020-09-07 00:36:01 +02:00
J. Nick Koston
251d8919ea
Add domain filter support to async_all to match async_entity_ids ( #39725 )
...
This avoids copying all the states before applying
the filter
2020-09-06 23:20:32 +02:00
Franck Nijhof
878347243d
Numeric state condition can also accept input_number entity ID ( #39680 )
2020-09-06 20:04:07 +02:00
Franck Nijhof
a3c45a6f89
Add shorthand notation for Template conditions ( #39705 )
2020-09-06 16:55:06 +02:00
Franck Nijhof
da9b077c11
Time condition can also accept an input_datetime Entity ID ( #39676 )
2020-09-06 16:06:09 +02:00
J. Nick Koston
35e84d0427
Add as_local convenience function to jinja templates ( #39618 )
2020-09-03 14:35:16 -05:00
J. Nick Koston
661b593db3
Support reloading the rest notify platform ( #39527 )
...
* Support reloading the rest notify platform
* update services.yaml
* fix conflict
2020-09-02 18:25:43 -05:00
J. Nick Koston
a778690b64
Support reloading the group notify platform ( #39511 )
2020-09-03 00:12:07 +02:00
Phil Bruckner
4486251382
Add max_exceeded log level option to automations & scripts ( #39448 )
2020-09-02 11:05:14 +02:00
J. Nick Koston
e55a014e94
Undecorate RenderInfo result property ( #39108 )
2020-09-02 10:35:15 +02:00
J. Nick Koston
a77e09b2c2
Make async_track_template_result track multiple templates ( #39371 )
...
* Make async_track_template_result track multiple templates
Combine template entity updates to only write ha
state once per template group update
* Make async_track_template_result use dataclasses for input/output
* black versions
* naming
2020-08-31 19:07:40 -05:00
Paulus Schoutsen
190611a079
Detect comments in jinja templates ( #39496 )
2020-08-31 10:51:30 +02:00
J. Nick Koston
8b893173fd
Prevent CoordinatorEntity from requesting updates on disabled entities ( #39452 )
2020-08-30 12:10:22 -05:00
Paulus Schoutsen
5a7f1d62c1
CoordinatorEntity to call super added_to_hass ( #39416 )
2020-08-30 08:42:33 -05:00
J. Nick Koston
f8712b0e00
Create a CoordinatorEntity class to avoid repating code in integrations ( #39388 )
2020-08-30 12:02:37 +02:00
Ville Skyttä
1bf2c4d976
Upgrade pylint to 2.6.0 ( #39363 )
2020-08-29 07:59:24 +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
J. Nick Koston
414a59ae9f
Add the ability to reload homekit from yaml ( #39326 )
2020-08-28 16:46:45 +02:00
J. Nick Koston
f8704a2dfc
Ensure we always fire time pattern changes after microsecond 0 ( #39302 )
2020-08-28 16:27:25 +02:00
Ville Skyttä
b4bac0f7a0
Exception chaining and wrapping improvements ( #39320 )
...
* Remove unnecessary exception re-wraps
* Preserve exception chains on re-raise
We slap "from cause" to almost all possible cases here. In some cases it
could conceivably be better to do "from None" if we really want to hide
the cause. However those should be in the minority, and "from cause"
should be an improvement over the corresponding raise without a "from"
in all cases anyway.
The only case where we raise from None here is in plex, where the
exception for an original invalid SSL cert is not the root cause for
failure to validate a newly fetched one.
Follow local convention on exception variable names if there is a
consistent one, otherwise `err` to match with majority of codebase.
* Fix mistaken re-wrap in homematicip_cloud/hap.py
Missed the difference between HmipConnectionError and
HmipcConnectionError.
* Do not hide original error on plex new cert validation error
Original is not the cause for the new one, but showing old in the
traceback is useful nevertheless.
2020-08-28 13:50:32 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 ( #39287 )
2020-08-27 13:56:20 +02:00
J. Nick Koston
715fe4eef8
Fix time pattern listener firing a few microseconds early ( #39281 )
2020-08-26 17:50:25 +02:00
J. Nick Koston
810df38f0d
Add the ability to reload light/cover groups from yaml ( #39250 )
...
* Add the ability to reload light/cover groups from yaml
Update previous usage to reduce code duplication.
* Fix conflict from rebase
2020-08-25 18:13:43 -05:00
J. Nick Koston
c87e03ee6f
Ensure template tracking can recover after the template generates an exception ( #39256 )
2020-08-26 00:33:08 +02:00
J. Nick Koston
90842fcb84
Support reloading the universal platform ( #39248 )
2020-08-26 00:25:15 +02:00
J. Nick Koston
20398cc0a6
Subscribe to state change events only if the template has entities ( #39188 )
2020-08-26 00:20:04 +02:00
J. Nick Koston
bee6d87e7a
Standardize uuid generation for events/storage/registry ( #39184 )
2020-08-24 17:21:30 +02:00
Franck Nijhof
181709f3d2
Allow templates in data & service parameters (making data_template & service_template obsolete) ( #39210 )
2020-08-24 16:21:48 +02:00
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
Ville Skyttä
ac0dbb17af
Attrs cleanups ( #37849 )
2020-07-14 10:30:30 -07:00
Phil Bruckner
7e280e2b27
Add choose script action ( #37818 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-07-14 10:22:54 -07:00
Jakob Schlyter
dbcd5f4c2c
Add urlencode template filter ( #37753 )
...
* add urlencode template filter
* fix flake8
* add test to string ang integer
* better test vectors
2020-07-13 16:48:29 +02:00
Phil Bruckner
e5a081c7dd
Fix script queued mode typo ( #37759 )
2020-07-11 13:34:53 -05:00
Phil Bruckner
63e55bff52
Remove legacy script mode and simplify remaining modes ( #37729 )
2020-07-10 17:00:57 -07:00
Rohan Kapoor
0db8140c13
Add support for the DataUpdateCoordinator to not automatically update ( #37734 )
2020-07-10 15:48:20 -07:00
Phil Bruckner
91271f388c
Add new repeat loop for scripts and automations ( #37589 )
2020-07-10 13:37:19 -05:00
Paulus Schoutsen
f49ce5d1b4
Protect loop set default executor ( #37438 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-06 15:58:53 -07:00
J. Nick Koston
34ccb6588c
Cleanup async_track_state_change and augment docstring ( #37251 )
...
* Cleanup async_track_state_change and augment docstrings.
Skip from_state and to_state matching in
async_track_state_change when they are None
Optimize the state change listener for the most
common use case: no to_state and from_state
matching.
* Update benchmark to be more realistic (previously we assumed only one entity was present in the whole instance)
* Add more tests to ensure behavior is preserved
* Ensure new behavior matches test
* remove MATCH_ALL from zone automation since its the default anyways
* Might as well use async_track_state_change_event instead since MATCH_ALL is removed
2020-07-05 17:31:33 -05:00
Franck Nijhof
53545c984b
Log lines do not end with a full stop ( #37527 )
2020-07-05 23:04:19 +02:00
Phil Bruckner
f7c4900d5c
Enhance automation integration to use new features in script helper ( #37479 )
2020-07-05 09:25:15 -05:00
Kevin Eifinger
eb66da6436
Add helpers.location.coordinates ( #37234 )
2020-07-03 11:28:44 -07:00
Paulus Schoutsen
d08d00daa7
Limit entity platform entity service to same integration ( #37313 )
2020-07-02 11:39:53 +02:00
mdegat01
52f3238e17
Add constant for PlatformNotReady wait time to use in tests ( #37266 )
2020-07-01 08:42:57 -07: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
J. Nick Koston
a63a11a11a
Ensure all async_track_state_change_event callbacks run if one throws ( #37179 )
2020-06-27 17:48:27 -07:00
J. Nick Koston
4acc6f333e
Improve scalability of state change event routing ( #37174 )
2020-06-27 14:46:45 -07:00
Paulus Schoutsen
5bc6ed4cef
Add logbook platforms ( #37078 )
...
* Add logbook platforms
* Fix logbook describe test
2020-06-24 18:14:50 -07:00
mdegat01
6c7355785a
Add support for glob matching to entity filters ( #36913 )
...
* Added GLOB capability to entityfilter and every place that uses it. All existing tests are passing
* added tests for components affected by glob change
* fixed flake8 error
* mocking the correct listener
* mocking correct bus method in azure test
* tests passing in 3.7 and 3.8
* fixed formatting issue from rebase/conflict
* Checking against glob patterns in more performant way
* perf improvments and reverted unnecessarily adjusted tests
* added new benchmark test around filters
* no longer using get with default in entityfilter
* changed filter name and removed logbook from filter benchmark
* simplified benchmark tests from feedback
* fixed apache tests and returned include exclude schemas to normal
* fixed azure event hub tests to properly go through component logic
* fixed azure test and clean up for other tests
* renaming test files to match standard
* merged mqtt statestream test changes with base
* removed dependency on recorder filter schema from history
* fixed recorder tests after merge and a bunch of lint errors
2020-06-23 20:02:29 -05:00
J. Nick Koston
152a80abed
Complete deprecation of hidden attribute (ATTR_HIDDEN) ( #37041 )
2020-06-23 17:05:32 -05:00
Joakim Sørensen
835f433cf7
Remove loading of legacy translations ( #37021 )
2020-06-23 10:58:11 +02:00
Franck Nijhof
8b21b415c4
Fix/Rewrite of Toon integration ( #36952 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-22 18:22:41 -07:00
Franck Nijhof
f131959f4b
Correct inst method names in system info and issue templates ( #36998 )
2020-06-22 14:46:31 +02:00
Franck Nijhof
02f174e2e6
Add support for multiple states/zones in conditions ( #36835 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-16 00:53:13 +02:00
Franck Nijhof
ba73ac12ba
Add support for multiple entity_ids in conditions ( #36817 )
2020-06-15 22:54:19 +02:00
Franck Nijhof
3cc94f7d6a
ConfigFlow default discovery without unique ID ( #36754 )
2020-06-15 13:38:38 +02:00
Paulus Schoutsen
1ffa8fcbba
Platforms cleanup when adding entity fails ( #36742 )
2020-06-12 17:54:46 -07:00
Erik Montnemery
14bff5a375
Abort other config flows on import ( #36608 )
...
* Abort other flows on import
* Add test
2020-06-10 22:46:14 +02:00
Paulus Schoutsen
8f3c84b349
Mark config dependency of frontend ( #36587 )
2020-06-09 23:27:47 -07:00
Ville Skyttä
29b8f76e57
Use past tense in messages for already invalidated deprecated configs ( #36591 )
2020-06-09 23:26:55 -07:00
Ville Skyttä
0c5ca3084e
Add and fix type hints ( #36501 )
...
* Fix exceptions.Unauthorized.permission type
* Use auth.permission consts more
* Auth typing improvements
* Helpers typing improvements
* Calculate self.state only once
2020-06-06 20:34:56 +02:00
Erik Montnemery
7722e417ad
Stable device id when a deleted device is restored ( #36309 )
...
* Stable device id when a deleted device is restored.
* Tweak
* Store only basic data for deleted devices
* Simplify code
* Simplify code
* Address review comments.
* Improve test
* Fix missing save
2020-06-02 21:22:08 +02:00
Franck Nijhof
e86bedb223
Prevent possible secret values to show up in deprecation logs ( #36368 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-06-02 17:29:59 +02:00
Franck Nijhof
0629b30ade
Correct inst method names in system info, add Docker version ( #36360 )
2020-06-02 10:50:34 +02:00
Paulus Schoutsen
276f3afb00
Do async_setup_platform in background ( #36244 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07:00
Phil Bruckner
1e9ec917f6
Add support for simultaneous runs of Script helper - Part 3 ( #36202 )
2020-05-27 15:10:28 -07:00
Ville Skyttä
f8416484f8
More data entry flow and HTTP related type hints ( #34430 )
2020-05-26 09:28:22 -05:00
Robert Chmielowiec
d21cfd869e
Fix service registration supported features check ( #35718 )
2020-05-23 18:11:51 +02:00
Andre Lengwenus
919f3243de
Fix device_registry cleanup behavior ( #35977 )
...
* Fix: Only decives which are not referenced by an entity or a config_entry are removed
* Adapted test for async_cleanup
* Changed variable names
2020-05-23 09:46:03 +02:00
J. Nick Koston
6d03496372
Ensure storage write consume the data under the lock ( #35889 )
...
If two writes trigger at the same time the data would already
be consumed.
2020-05-21 10:27:40 +02:00
Bram Kragten
cb7b8d94c0
Add check for HTML in translations ( #35615 )
...
* Add check for HTML in translations
and remove existing html
* Add test
2020-05-14 19:33:14 +02:00
Martin Hjelmare
2a120d9045
Patch aiohttp client session close ( #34769 )
...
* Patch aiohttp client session close
* Add test
* Restore close regardless of auto_cleanup
* Close session instead of detaching and do not restore
* Delint test
* Add frame helper
* Use frame helper
* Test warning log when closing session
* Clean up
* Correct docstring
* Do not change shutdown
* Fix tests
2020-05-13 09:58:33 +02:00
Franck Nijhof
eddb5c6c3f
Add more system information from Supervisor ( #35560 )
2020-05-12 15:27:34 -07:00
Thomas Hollstegge
8f285c15d3
Listen for group member state changes when using `expand` in templates ( #35398 )
...
* Re-evaluate template on group member state change
* Use named groups for entity extraction regex
This will avoid unnecessary edits of match indices if the regex is
amended in the future
* Improve test coverage
2020-05-10 10:48:56 -05:00
Franck Nijhof
e3e3a113e9
async_get_url -> get_url ( #35382 )
2020-05-08 21:53:28 +02:00
Franck Nijhof
e56dd8ed50
Detect use of deprecated base_url ( #35353 )
...
* Detect use of deprecated base_url
* Update get_url helper
* Update core migration
* Migrate all tests
2020-05-08 17:52:32 +02:00
Franck Nijhof
2223592486
Add get_url helper, deprecate base_url ( #35224 )
2020-05-08 02:29:47 +02:00
Paulus Schoutsen
a330eba61c
Guard bad entity ID in entity registry ( #35271 )
2020-05-05 15:07:54 -07:00
Paulus Schoutsen
4ae31bc938
Clean up device registry if entity registry updates ( #35106 )
2020-05-05 10:53:46 -07:00