Franck Nijhof
6932cf9534
Use contextlib.suppress where possible ( #48189 )
2021-03-23 14:36:43 +01:00
Franck Nijhof
dc15f243e6
Upgrade pyupgrade to v2.11.0 ( #48220 )
2021-03-22 13:29:39 +01:00
Erik Montnemery
272dffc384
Improve script tracing ( #48100 )
...
* Improve script tracing
* Fix test
2021-03-22 13:15:45 +01:00
Erik Montnemery
f8755a52c2
Warn on undefined variables in templates ( #48140 )
...
* Warn on undefined variables in templates
* Add test
* fix tests
* fix tests
2021-03-20 15:16:04 +01:00
Franck Nijhof
fb849b81b5
Rewrite of not a == b occurances ( #48132 )
2021-03-20 01:27:04 +01:00
J. Nick Koston
c820dd4cb5
Have pylint warn when user visible log messages do not start with capital letter or end with a period ( #48064 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-19 09:26:36 -05:00
Marc Mueller
4cb7718192
Update typing 16 ( #48087 )
2021-03-18 22:58:19 +01:00
Erik Montnemery
7b717bc437
Correct trace for repeat script actions ( #48031 )
2021-03-18 13:14:06 -07:00
J. Nick Koston
08db262972
Add a service to reload config entries that can easily be called though automations ( #46762 )
2021-03-17 21:27:21 -07:00
Marc Mueller
6fb2e63e49
Update typing 02 ( #48014 )
2021-03-17 18:34:19 +01:00
Alan Tse
f86e7535e0
Add location details to deprecation warning ( #47155 )
2021-03-16 21:16:07 +01:00
Erik Montnemery
1cde1074c9
Correct trace for choose and repeat script actions ( #47973 )
...
* Correct trace for choose and repeat script actions
* only choose-wrap the choices
* Update tests
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-03-16 08:49:16 +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
Franck Nijhof
5d5a110a20
None optional hass typing in base entity and notify ( #47528 )
2021-03-15 15:11:41 +01:00
Paulus Schoutsen
ff94e920e4
Do not use AsyncTrackStates ( #47255 )
2021-03-11 23:18:09 -08:00
Erik Montnemery
a9a9e1f199
Tweak automation tracing ( #47721 )
2021-03-10 14:42:13 -08:00
Erik Montnemery
704000c049
Add support for breakpoints in scripts ( #47632 )
2021-03-09 21:23:11 -08:00
Erik Montnemery
3a054c3be7
Replace Entity.device_state_attributes with Entity.extra_state_attributes ( #47304 )
2021-03-09 13:58:43 +01:00
Erik Montnemery
ea4f3e31d5
Include changed variables in automation trace ( #47549 )
...
* Include changed variables in automation trace
* Deduplicate some code
* Tweak
* Apply suggestions from code review
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Fix format
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-03-08 22:48:36 +01:00
Paulus Schoutsen
67effbc8c4
Config flow to allow marking itself as confirm only ( #47607 )
2021-03-08 10:54:51 -08:00
Erik Montnemery
2f9d03d115
Merge action and condition traces ( #47373 )
...
* Merge action and condition traces
* Update __init__.py
* Add typing to AutomationTrace
* Make trace_get prepare a new trace by default
* Correct typing of trace_cv
* Fix tests
2021-03-06 12:57:21 +01:00
tkdrob
3baeed3684
Clean up constants ( #47323 )
2021-03-05 19:08:04 +01:00
Franck Nijhof
7a8b7224c8
Don't raise on known non-matching states in numeric state condition ( #47378 )
2021-03-04 13:09:08 -08:00
Erik Montnemery
17401cbc29
Initial automation tracing ( #46755 )
...
* Initial prototype of automation tracing
* Small fixes
* Lint
* Move trace helpers to its own file
* Improve trace for state and numeric_state conditions
* Tweaks + apply suggestions from code review
* Index traces by automation_id, trace while script is running
* Refactor condition tracing
* Improve WS API to get traces for single automation
* Add tests
* Fix imports
* Fix imports
* Address review comments
* Cap logging of loops
* Remove unused ContextVar action_config
2021-03-04 14:16:24 +01:00
Erik Montnemery
504e5b77ca
Improve behaviour when disabling or enabling config entries ( #47301 )
2021-03-03 10:12:37 -08:00
Paulus Schoutsen
2df644c6cc
Clean up secret loading ( #47034 )
2021-03-02 12:58:53 -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
Marc Mueller
16dcbf1467
Update pylint ( #47205 )
2021-02-28 22:09:01 -10:00
Paulus Schoutsen
557ec374f1
Convert discovery helper to use dispatcher ( #47008 )
2021-02-24 13:37:31 -08:00
Joakim Sørensen
11a89bc3ac
Add addon selector ( #46789 )
2021-02-24 17:02:48 +01:00
Franck Nijhof
42fd3be0e8
Add template support to service targets ( #46977 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-02-23 22:46:00 -08:00
Bram Kragten
afa91e886b
Add description to tts and notify services ( #46764 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-02-23 14:29:57 +01:00
Franck Nijhof
c8ffac20b9
Add name to services ( #46905 )
2021-02-22 16:26:46 +01:00
Anders Melchiorsen
d61d39de08
Handle ConditionError with multiple entity_id for state/numeric_state ( #46855 )
2021-02-22 08:11:59 +01:00
Anders Melchiorsen
d33a1a5ff8
Refine printing of ConditionError ( #46838 )
...
* Refine printing of ConditionError
* Improve coverage
* name -> type
2021-02-21 14:54:36 +01:00
Erik Montnemery
5e26bda52d
Add support for disabling config entries ( #46779 )
2021-02-20 19:21:39 -08:00
Erik Montnemery
2d70806035
Add support for "alias" in script steps device, device_condition, and conditions ( #46647 )
...
Co-authored-by: Donnie <donniekarnsinsb@hotmail.com>
2021-02-20 19:21:09 -08:00
Anders Melchiorsen
9f4874bb81
Explicitly create_task for asyncio.wait ( #46325 )
2021-02-20 19:57:46 +01:00
Erik Montnemery
54cf954353
Add device_entities template function/filter ( #46406 )
2021-02-19 21:50:59 -08:00
J. Nick Koston
bb7e4d7daa
Implement suggested_area in the device registry ( #45940 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-02-19 19:34:33 -10:00
Anders Melchiorsen
bfea7d0baa
Raise ConditionError for and/or/not errors ( #46767 )
2021-02-19 13:15:30 +01:00
Anders Melchiorsen
e7e3e09063
Raise ConditionError for zone errors ( #46253 )
...
* Raise ConditionError for zone errors
* Do not test missing state
* Handle multiple entities/zones
2021-02-19 13:14:47 +01:00
Bram Kragten
6986fa4eb6
Add target to services.yaml ( #46410 )
...
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-02-16 09:35:27 +01:00
J. Nick Koston
aa061e5818
Fix variable name from script refactoring ( #46503 )
2021-02-14 10:52:18 -10:00
J. Nick Koston
c9df42b69a
Add support for pre-filtering events to the event bus ( #46371 )
2021-02-14 09:42:55 -10:00
Erik Montnemery
f1714dd541
Make some Area and EntityRegistry member functions callbacks ( #46433 )
2021-02-12 17:00:35 +01:00
Franck Nijhof
9b7c39d20b
Postponed evaluation of annotations in core ( #46434 )
...
* Postponed evaluation of annotations in core
* Remove unneeded future
2021-02-12 10:58:20 +01:00
Erik Montnemery
ed31cc363b
Wait for registries to load at startup ( #46265 )
...
* Wait for registries to load at startup
* Don't decorate new functions with @bind_hass
* Fix typing errors in zwave_js
* Load registries in async_test_home_assistant
* Tweak
* Typo
* Tweak
* Explicitly silence mypy errors
* Fix tests
* Fix more tests
* Fix test
* Improve docstring
* Wait for registries to load
2021-02-11 17:36:19 +01:00
Anders Melchiorsen
888c9e120d
Raise ConditionError for time errors ( #46250 )
2021-02-11 17:29:17 +01:00
Anders Melchiorsen
1f5fb8f28a
Raise ConditionError for template errors ( #46245 )
2021-02-11 10:30:09 +01:00
Paulus Schoutsen
538df17a28
Restore Google/Alexa extra significant change checks ( #46335 )
2021-02-10 16:30:29 +01:00
Franck Nijhof
22389043eb
Remove base_url fallback ( #46316 )
2021-02-10 14:31:11 +01:00
Ville Skyttä
a6358430b4
Fix deprecated asyncio.wait use with coroutines ( #44981 )
...
https://docs.python.org/3/library/asyncio-task.html#asyncio-example-wait-coroutine
2021-02-10 14:16:58 +01:00
Bram Kragten
4b493c5ab9
Add target to service call API ( #45898 )
...
* Add target to service call API
* Fix _async_call_service_step
* CONF_SERVICE_ENTITY_ID overrules target
* Move merging up before processing schema
* Restore services.yaml
* Add test
2021-02-10 12:42:28 +01:00
Erik Montnemery
78b7fbf7b1
Fix race in EntityRegistry.async_device_modified ( #46319 )
2021-02-10 10:50:44 +01:00
Anders Melchiorsen
f27066e773
Raise ConditionError for state errors ( #46244 )
2021-02-09 09:46:36 +01:00
tkdrob
c2302784c2
Use core constants for helpers ( #46240 )
2021-02-08 22:53:17 +01:00
Erik Montnemery
0780e52ca4
Support templates in event triggers ( #46207 )
...
* Support templates in event triggers
* Don't validate trigger schemas twice
2021-02-08 14:06:27 +01:00
Matteo Agnoletto
eaa2d371a7
Add select selector for blueprints ( #45803 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-02-08 14:03:26 +01:00
Ville Skyttä
82607977ef
Various type hint improvements ( #46144 )
2021-02-08 11:59:46 +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
Paulus Schoutsen
9e07910ab0
Mark entities as unavailable when they are removed but are still registered ( #45528 )
...
* Mark entities as unavailable when they are removed but are still registered
* Add sync_entity_lifecycle to collection helper
* Remove debug print
* Lint
* Fix tests
* Fix tests
* Update zha
* Update zone
* Fix tests
* Update hyperion
* Update rfxtrx
* Fix tests
* Pass force_remove=True from integrations
Co-authored-by: Erik <erik@montnemery.com>
2021-02-08 10:45:46 +01:00
Erik Montnemery
8a7e0241ab
Fix race in script wait for trigger step ( #46055 )
...
* Fix race in script wait for trigger step
* Update script.py
* Update script.py
2021-02-06 10:01:30 +01:00
Joakim Sørensen
90973f471f
Add integration name to the deprecation warnings ( #45901 )
2021-02-03 14:40:11 +01:00
Ville Skyttä
d13b58a4e6
Upgrade mypy to 0.800 ( #45485 )
...
* Upgrade mypy to 0.800
https://mypy-lang.blogspot.com/2021/01/mypy-0800-released.html
* Fix issues flagged by mypy 0.800
* Add overloads + small changes
* Apply grammar
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-01-30 22:33:53 +01:00
Philip Allgaier
84f506efb7
Set default position value for cover action ( #45670 )
...
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-01-29 21:11:12 +01:00
Marc Mueller
7673f57248
Add additional error handling for automation script run ( #45613 )
2021-01-28 09:26:41 +01:00
J. Nick Koston
a1662b3bb9
Restore the device id after deleting and re-adding an integration ( #45348 )
2021-01-27 17:10:57 +01:00
CtrlZvi
1433cdaa12
Prefer shorter keys for intent matching ( #43672 )
...
When using fuzzy matching to match entity names for intents, whichever
entity is first is preferred in the case of equal matches. This leads
to situations where entities with similar names (such as entities named
for their area and then specific area location) may be used when the
whole area is wanted.
I ran into this with the my Phillips Hue lights. I have each individual
light named such that its room is the first part of the name, and its
location within the room after. So my living room has:
Living Room West
Living Room Northwest
Living Room North
Living Room Northeast
I then have a group for the whole room:
Living Room
Because the group is the last of the entities, trying to adjust the
whole room only activates one light, because all of the lights match
equally well.
By preferring the shortest of equal matches, we prefer keys that have
the least amount of extra information, causing "Living Room" to match
the group instead of an individual light.
2021-01-27 12:16:19 +01:00
Thomas Lovén
06ade6129c
Add selectors for text and arbitrary objects ( #45112 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-01-27 09:20:19 +01:00
Paulus Schoutsen
352d0870e3
Light significant changes + sensor tweaks ( #45583 )
2021-01-26 22:11:06 +01:00
Joakim Sørensen
b1c2cde40b
Changes to filename and path validation ( #45529 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-01-26 15:53:21 +01:00
Paulus Schoutsen
d082be787f
Add "significant change" base ( #45555 )
2021-01-26 14:13:27 +01:00
Philip Allgaier
89fc92f68a
Slightly improve error message in case of duplicate entity IDs ( #45424 )
2021-01-22 09:16:13 -05:00
Shay Levy
f117ddc6fa
Stop update_coordinator schedule refresh when HA is stopping ( #45338 )
...
* Stop update_coordinator schedule refresh when HA is stopping
* Add unittests
* Fix event type
2021-01-22 00:23:50 +01:00
J. Nick Koston
a7741be9bb
Wait for all triggers when one fails to attach ( #45361 )
2021-01-20 22:13:21 +01:00
Ville Skyttä
94dbcc9d2b
Generics and other type hint improvements ( #45250 )
2021-01-18 22:23:25 +01:00
jlvaillant
a50fba4e0b
more graceful shutdown in the presence of a proxy_stream ( #45246 )
2021-01-17 17:10:22 +01:00
J. Nick Koston
da677f7d5a
Add support for discovery via DHCP ( #45087 )
...
* Add support for discovery via DHCP
* additional tesla ouis
* merge tests
* dhcp test
* merge requirements test
* dhcp test
* dhcp discovery
* dhcp discovery
* pylint
* pylint
* pylint
* fix
* Add matching tests
* 100% cover
* cleanup
* fix codespell
* Update exception handling
* remove unneeded comment
* fix options handling exception
* fix options handling exception
2021-01-14 09:09:08 +01:00
Alexei Chetroi
de8f273bd0
Allow input_number entity_id as for numeric_state trigger thresholds ( #45091 )
...
* Allow input_number as limits for numeric_state trigger
* Rename threshold schema
2021-01-13 16:20:59 +01:00
Ville Skyttä
3a88a4120e
Helpers type hint improvements ( #44964 )
2021-01-09 00:08:34 +01:00
J. Nick Koston
7c93a11aba
Fix wait_template incorrectly matching falsey values ( #44938 )
2021-01-08 13:07:50 +01:00
Ville Skyttä
20e2493f68
Improve device registry type hints ( #44919 )
...
* Fix async_get_or_create via_device type hint
* Specify collection element types
2021-01-08 02:38:57 +01:00
Ville Skyttä
2fb3be50ab
Make DeviceRegistry.async_get_device connections arg optional ( #44897 )
...
* Make async_get_device connections Optional, default None
* Remove unnecessary async_get_device connections arg usages
Some of these were using an incorrect collection type, which didn't
cause issues mostly just due to luck.
2021-01-07 13:49:45 +01:00
Ville Skyttä
67eebce55a
Better general/fallback error message and traceback for unknown config errors ( #44655 )
...
* Include error repr in config error message is str(error) yields nothing
* Log traceback for config errors we don't have a "friendly" formatter for
2021-01-05 13:55:38 +01:00
Ville Skyttä
65e56d03bf
Complete device and entity registry type hints ( #44406 )
2021-01-05 02:03:16 +01:00
J. Nick Koston
2ef25e7414
Fix script wait templates with now/utcnow ( #44717 )
2021-01-01 13:03:34 +01:00
Ville Skyttä
1c8fbc7e6a
Upgrade codespell to 2.0.0 ( #44695 )
...
* Upgrade codespell to 2.0.0
* Fix newly found spelling errors
2020-12-31 19:14:07 +01:00
Allen Porter
eb07282e9b
Add debug logging for failed OAuth token refreshes to help users diagnose ( #44637 )
2020-12-30 10:03:27 +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
594e905742
Remove invalidation_version from deprecated ( #44156 )
...
* Remove invalidation_version from deprecated. We don't follow up and just hurts releases
* Revert change to ZHA
2020-12-12 22:24:16 +01:00
J. Nick Koston
dd0afc3b66
Create httpx helper to wrap a shared httpx.AsyncClient ( #43877 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-12-09 17:18:57 +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
Erik Montnemery
30baf333c3
Improve handling of disabled devices ( #43864 )
2020-12-02 21:20:14 +01:00
Bram Kragten
d93687b5ac
Update area and target selectors add sequence selector ( #43831 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-12-02 09:30:49 +01:00
Paulus Schoutsen
1c9c99571e
Use !input instead of !placeholder ( #43820 )
...
* Use !input instead of !placeholder
* Update input name
* Lint
* Move tests around
2020-12-01 18:21:36 +01:00
Paulus Schoutsen
69710cb664
Base area IDs on initial name ( #43804 )
2020-12-01 12:45:56 +01:00
Paulus Schoutsen
cf5be049b3
Warn when referencing missing devices/areas ( #43787 )
2020-12-01 08:01:27 +01:00
Paulus Schoutsen
a5c79a1f84
Add support for device class in target selector ( #43768 )
2020-11-30 23:35:24 +01:00
Paulus Schoutsen
0de9e8e952
Allow specifying device_id as target ( #43767 )
2020-11-30 14:27:02 +01:00
Paulus Schoutsen
dd513147a5
Add a service target ( #43725 )
2020-11-28 23:33:32 +01:00
Paulus Schoutsen
5b6d9abe2a
Await callbacks to keep cleaner stacktraces ( #43693 )
2020-11-27 17:48:43 +01:00
Paulus Schoutsen
d34753473d
Use run_job for service helper ( #43696 )
2020-11-27 16:12:39 +01:00
Erik Montnemery
a5e5c5c7e6
Exclude disabled entities from async_entries_for_device ( #43665 )
2020-11-27 09:03:44 +01:00
Paulus Schoutsen
f9fa24950b
OAuth2 to use current request header ( #43668 )
2020-11-27 08:55:34 +01:00
Paulus Schoutsen
e1de36fda8
Fix check config ( #43663 )
2020-11-26 22:25:21 +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
Erik Montnemery
dc8364fd3a
Support disabling devices ( #43293 )
2020-11-26 16:45:02 +01:00
Bram Kragten
4aa181416c
Add area selector, remove date selector ( #43658 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-11-26 15:44:25 +01:00
Bram Kragten
3767af14f3
Add more selectors ( #43639 )
2020-11-25 20:03:56 +01:00
Paulus Schoutsen
1de2554f70
Tweak template digit detection ( #43621 )
2020-11-25 16:10:33 +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
43ba053030
Add support for checking minimum HA version ( #43350 )
2020-11-20 15:24:42 +01:00
Paulus Schoutsen
390668e192
Check config to use config platforms ( #43407 )
2020-11-19 22:05:36 +01:00
Bram Kragten
5dcbb634f6
Fix selector to return the selector type ( #43395 )
2020-11-19 16:48:43 +01:00
Paulus Schoutsen
bae026a6fe
Add support for selectors in services.yaml ( #43162 )
...
* Add support for selectors in services.yaml
* Add base schema validation
2020-11-13 22:53:55 +01:00
Paulus Schoutsen
0a717f313e
Improve entity domain validator ( #43164 )
2020-11-13 13:31:43 +01:00
Paulus Schoutsen
8dbd54bed1
Disable parsing scientific/complex number notation in template type ( #43170 )
2020-11-13 13:22:29 +01:00
Paulus Schoutsen
560afc31ad
Use internal url for Squeezebox if possible ( #43089 )
2020-11-11 14:49:08 +01:00
J. Nick Koston
94bf55e29b
Limit concurrency of async_get_integration to avoid creating extra threads ( #43085 )
...
* Limit concurrency of async_get_integration to avoid creating extra threads
Since async_get_integration is waiting on the disk most of the time
it would end up creating many new threads because the disk could
not deliver the data in time.
* pylint
2020-11-10 21:34:54 -10:00
Paulus Schoutsen
7745408440
System health improvement ( #43066 )
2020-11-10 23:56:50 +01:00
Erik Montnemery
8a7febcfbe
Improve restore of deleted devices ( #42703 )
...
* Improve restore of deleted devices
* Simplify
2020-11-10 22:14:39 +01:00
J. Nick Koston
c7f35b20fb
Make all translations cacheable ( #42892 )
2020-11-09 22:36:45 +01:00
Paulus Schoutsen
aec191b558
Support datetime sensor in time trigger ( #42899 )
2020-11-09 14:50:54 +01:00
J. Nick Koston
b47a5449e3
Ensure storage task loads are always garbage collected ( #42917 )
2020-11-07 06:54:56 -10:00
J. Nick Koston
3ec7258c21
Ensure instances of async_add_entities can be garbage collected ( #42919 )
2020-11-07 06:54:20 -10:00
Anders Melchiorsen
650c57db5b
Fix async_track_utc_time_change firing too early ( #42176 )
2020-11-05 16:34:56 +01:00
Tom Parker-Shemilt
b1ed5a3e79
Fix circular import of config_validation and template ( #41802 )
2020-11-04 19:06:19 -10: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
Paulus Schoutsen
1844e30858
Add support for manual updating a data coordinator ( #42746 )
2020-11-02 09:54:08 +01:00
springstan
92379ad8d2
Use list literal without using dict.keys() ( #42573 )
2020-10-30 09:19:13 -05:00
J. Nick Koston
df552f08c3
Purge unused constants from template helper ( #42618 )
2020-10-30 09:29:12 +01: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
J. Nick Koston
7f1683c731
Remove legacy template extract_entities ( #42601 )
2020-10-30 00:06:08 +01:00
J. Nick Koston
c8f00a7b38
Gather all collection listeners and changes at the same time ( #42497 )
2020-10-29 10:06:55 +01:00
springstan
a967f689c7
Remove unnecessary instances of dict.keys() ( #42518 )
2020-10-28 20:43:48 +01:00
J. Nick Koston
94219c2266
Ensure the oauth2 token is refreshed before it is expired ( #42487 )
...
The current implementation assumed clocks were in sync and did
not account for the time it took to refresh the token. A 20
second buffer has been added to ensure that the token is refreshed
before it expires as OAuth2Session.valid_token would assume the
token was still good even though the remote would reject it
and would not refresh because it was not time yet.
2020-10-28 07:47:54 -05:00
Paulus Schoutsen
e21e28e49f
Fix string representation of template result wrappers ( #42494 )
2020-10-28 09:11:08 +01:00
Paulus Schoutsen
d4efa938dd
Improve mqtt test ( #42490 )
2020-10-27 23:22:59 +01:00
Paulus Schoutsen
711b7d4605
Make result wrappers more robust ( #42488 )
2020-10-27 22:51:58 +01:00
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