Commit Graph

277 Commits (93c2f2bbeb9cec44f04d4893222e2d917a2a0ff4)

Author SHA1 Message Date
Ville Skyttä 43474762b2
Drop remaining Python < 3.8 support (#44743)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-01-04 11:47:29 +01:00
Philip Allgaier 392c058d34
Ensure consistent spelling of "ID" (#44585) 2020-12-28 18:34:08 +01:00
Ville Skyttä 317ed418dd
Use singleton enum for "not set" sentinels (#41990)
* Use singleton enum for "not set" sentinel

https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions

* Remove unused variable
2020-12-19 12:46:27 +01:00
Paulus Schoutsen edf70e9f06
Make input_datetime better handle timezones (#43396)
* Make input_datetime better handle timezones

* Improve test coverage

* Apply suggestions from code review

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

* Revert change to time format

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-11-26 20:20:10 +01:00
Paulus Schoutsen 819dd27925
Automatically clean up executor as part of closing loop (#43284) 2020-11-16 15:43:48 +01:00
Franck Nijhof 6e9b65405a
Disable legacy templates by default (#42967) 2020-11-08 16:11:38 +01:00
J. Nick Koston 1626c236dc
Only call utcnow once during a state changed event (#42941) 2020-11-07 15:51:06 -10:00
J. Nick Koston 2bbd2a6e70
Reduce complexity of storage writes (#42576)
* Reduce complexity of storage writes

* add test

* stop hass

* workaround bad test
2020-10-29 22:35:51 -05:00
Paulus Schoutsen 21e9e7c5c2
Default legacy templates to true (#42511)
* Default legacy templates to true

* Disable legacy_templates in tests

Co-authored-by: Franck Nijhof <git@frenck.dev>
2020-10-28 16:58:16 +01: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
Paulus Schoutsen b8417a2ce2
Do not allow coroutines to be passed to HassJob (#42073)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-10-19 23:25:33 +02:00
J. Nick Koston afc602595b
Only validate entity id if it did not exist on state change (#41820) 2020-10-14 11:06: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 4798f37c6e
Convert States to dicts via as_dict only once (#41208)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-10-05 09:18:57 -05:00
J. Nick Koston b45215f1d2
Implement template rate_limit directive (#40667) 2020-10-01 21:39:44 +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 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
J. Nick Koston f0f817c361
Serialize websocket event message once (#40453)
Since most of the json serialize work for the websocket was done
multiple times for the same message, we can avoid the overhead
of serializing the same message many times (once per websocket
client) with a cache.
2020-09-22 08:47:04 -05:00
Franck Nijhof ff0562ad1e
Add media dirs core configuration (#40071)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-09-16 15:28:25 +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
Ville Skyttä 6ae9399237
Upgrade isort to 5.4.2 (#37939) 2020-08-29 08:23:55 +02:00
Ville Skyttä 1bf2c4d976
Upgrade pylint to 2.6.0 (#39363) 2020-08-29 07:59:24 +02:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Paulus Schoutsen 2a1fe9d29a
Add websocket trigger/condition commands (#39109) 2020-08-24 23:01:57 +02:00
J. Nick Koston bee6d87e7a
Standardize uuid generation for events/storage/registry (#39184) 2020-08-24 17:21:30 +02: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
J. Nick Koston a6f869aeee
Improve performance of fetching the state domain (#38653)
Pre calc domain when an entity id created to avoid
having to call the property method which had to call
split_entity_id every time. If there are a lot of
zone related automations, async_active_zone can call
async_entity_ids frequently which results in 100000s
of split_entity_id via the domain property every
second.
2020-08-09 13:45:16 +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 03582402fa
Add debug logging for when a chain of tasks blocks startup (#38311)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-07-28 18:24:29 +02:00
J. Nick Koston a7459b3126
Log which task is blocking startup when debug logging is on (#38134)
* Log which task is blocking startup when debug logging for homeassistant.core is on

* test needs to go one level deeper now
2020-07-23 20:03:42 -06:00
J. Nick Koston 6e2025a748
Use postgresql style uuid generation (uuid_generate_v1mc) for Context uuids (#38089)
This avoids the syscall to getrandom() every time we generate a uuid.
2020-07-22 21:53:01 -07:00
J. Nick Koston d7811a4adf
Avoid generating a Context() object every second (#38085)
Every second we were calling the getrandom() syscall to generate a uuid4
for a context that will never be looked:

 * In most setups there are no more time_changed listeners

 * The ones that do exist never care about context

 * time_changed events are never saved in the database
2020-07-22 21:52:10 -07:00
Ville Skyttä ac0dbb17af
Attrs cleanups (#37849) 2020-07-14 10:30:30 -07:00
Paulus Schoutsen 8ed1a29c82
Drop white blacklist pt1 (#37816) 2020-07-13 17:43:11 +02:00
Joakim Plate bcd604eec2
Detect lingering threads after tests (#37270)
* Detect lingering threads after tests

* Make sure cast is setup before checking state

* Make sure we ask executors of old hass to shutdown

We are not waiting here, just hoping for the best

* Make sure all instances of hass and executors is stopped.

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Also apply hass stopping to scripts

* Adjust to changes how we set up executor

* Add new CoreState.stopped

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-07-09 16:15:14 +02: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
Franck Nijhof 53545c984b
Log lines do not end with a full stop (#37527) 2020-07-05 23:04:19 +02:00
Phil Bruckner 584ce043e5
Add debug output for invalid service call data (#37171) 2020-06-27 22:19:54 -07:00
Aaron Bach 7968cd650a
Add concept of allowed external URLs to config (#36988)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-06-24 17:37:01 -07:00
J. Nick Koston edad387b12
Make recorder execute avoid native conversion by default (#36938) 2020-06-21 21:58:57 -07:00
Paulus Schoutsen de12c21ce7
Fire config changed event during start (#36812) 2020-06-15 15:22:53 -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
J. Nick Koston 578d4a9b6a
Make the frontend available sooner (Part 1 of 2) (#36263)
* Part 1 of 2 (no breaking changes in part 1).

When integrations configured via the UI block startup or fail to start,
the webserver can remain offline which make it is impossible
to recover without manually changing files in
.storage since the UI is not available.

This change is the foundation that part 2 will build on
and enable a listener to start the webserver when the frontend
is finished loading.

Frontend Changes (home-assistant/frontend#6068)

* Address review comments

* bump timeout to 1800s, adjust comment

* bump timeout to 4h

* remove timeout failsafe

* and the test
2020-06-02 13:54:11 -05:00
Pascal Vizeli ed014e3c96
Revert "Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)" (#36251)
This reverts commit fbe7b4ddfa.
2020-05-29 10:18:39 +02:00
J. Nick Koston fbe7b4ddfa
Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-05-28 21:09:07 -07:00
Franck Nijhof d3ae8a938c
Fix handling of additional data in core config storage (#35660) 2020-05-16 13:31:15 +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