Erik Montnemery
a968dea152
Fix deadlock when restarting scripts ( #49410 )
2021-04-19 14:45:01 +02:00
J. Nick Koston
6048e88c8b
Improve debuggability by providing job as an arg to loop.call_later ( #49328 )
...
Before
`<TimerHandle when=1523538.181864923 async_track_point_in_utc_time.<locals>.run_action() at /usr/src/homeassistant/homeassistant/helpers/event.py:1177>`
After
`<TimerHandle when=1524977.1818648616 async_track_point_in_utc_time.<locals>.run_action(<Job HassJobType.Coroutinefunction <bound method DataUpdateCoordinator._handle_refresh_interval of <homeassistant.components.roku.RokuDataUpdateCoordinator object at 0x7fcc978a51c0>>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1175>`
2021-04-19 11:02:17 +02:00
J. Nick Koston
f96a6e878f
Ensure restore state is not written after the stop event ( #49329 )
...
If everything lined up, the states could be written
while Home Assistant is shutting down after the stop
event because the interval tracker was not canceled on
the stop event.
2021-04-17 09:03:18 +02:00
Ville Skyttä
970cbcbe15
Type hint improvements ( #49320 )
2021-04-17 08:35:21 +02:00
Erik Montnemery
2c8b7c56f5
Fix race when restarting script ( #49247 )
2021-04-16 09:03:34 +02:00
Mike Degatano
236d274351
Add `search` and `match` as Jinja tests ( #49229 )
2021-04-15 20:13:27 +02:00
Ruslan Sayfutdinov
80f66f301b
Define data flow result type ( #49260 )
...
* Define data flow result type
* Revert explicit definitions
* Fix tests
* Specific mypy ignore
2021-04-15 07:17:07 -10:00
J. Nick Koston
8bee25c938
Fix stop listener memory leak in DataUpdateCoordinator on retry ( #49186 )
...
* Fix stop listener leak in DataUpdateCoordinator
When an integration retries setup it will add a new stop listener
* Skip scheduled refreshes when hass is stopping
* Update homeassistant/helpers/update_coordinator.py
* ensure manual refresh after stop
2021-04-14 12:16:59 -10:00
Tobias Sauerwein
9d4ad1821e
Fix logic of entity id extraction ( #49164 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-14 14:12:26 +02:00
J. Nick Koston
44beff31c2
Cancel config entry retry, platform retry, and polling at the stop event ( #49138 )
2021-04-13 16:16:26 -10:00
J. Nick Koston
82790cd28d
Do not compile static templates ( #49148 )
...
self._compiled_code is unreachable if self.is_static
2021-04-13 16:51:56 +02:00
Raman Gupta
769923e8dd
Raise exception for invalid call to DeviceRegistry.async_get_or_create ( #49038 )
...
* Raise exception instead of returning None for DeviceRegistry.async_get_or_create
* fix entity_platform logic
2021-04-13 14:18:51 +02:00
J. Nick Koston
53853f035d
Prevent calling stop or restart services during db upgrade ( #49098 )
2021-04-12 17:18:38 -07:00
Erik Montnemery
ff5fbea1fb
Improve trace of template conditions ( #49101 )
...
* Improve trace of template conditions
* Refactor
* Fix wait_template trace
* Update tests
2021-04-12 20:22:28 +02:00
Franck Nijhof
a610076001
Support min()/max() as template function ( #48996 )
2021-04-12 10:02:04 +02:00
Erik Montnemery
7e4be921a8
Add helper to get an entity's supported features ( #48825 )
...
* Add helper to check entity's supported features
* Move get_supported_features to helpers/entity.py, add tests
* Fix error handling and improve tests
2021-04-10 08:19:16 +02:00
J. Nick Koston
4cd7f9bd8b
Raise ConfigEntryAuthFailed during setup or coordinator update to start reauth ( #48962 )
2021-04-09 19:41:29 -10:00
Jason
7cc857a298
Add custom JSONEncoder for subscribe_trigger WS endpoint ( #48664 )
2021-04-09 20:47:10 -07:00
Erik Montnemery
16196e2e16
Don't log template errors from developer tool ( #48933 )
2021-04-09 12:10:02 -07:00
J. Nick Koston
40450b9cfd
Detach aiohttp.ClientSession created by config entry setup on unload ( #48908 )
2021-04-09 10:14:33 -07:00
Marc Mueller
8e2b5b36b5
Bump pyupgrade to 2.12.0 ( #48943 )
2021-04-09 09:58:27 -07:00
Erik Montnemery
d1df6e6fba
Don't get code_context when calling inspect.stack ( #48849 )
...
* Don't get code_context when calling inspect.stack
* Update homeassistant/helpers/config_validation.py
2021-04-09 07:26:09 +02:00
Erik Montnemery
9f5db2ce3f
Improve warnings on undefined template errors ( #48713 )
2021-04-06 12:11:42 -07:00
J. Nick Koston
12e3bc8101
Provide api to see which integrations are being loaded ( #48274 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-04 22:11:44 -10:00
J. Nick Koston
b5c679f3d0
Apply ConfigEntryNotReady improvements to PlatformNotReady ( #48665 )
...
* Apply ConfigEntryNotReady improvements to PlatformNotReady
- Limit log spam #47201
- Log exception reason #48449
- Prevent startup blockage #48660
* coverage
2021-04-04 12:31:58 +02:00
J. Nick Koston
3bc583607f
Optimize storage collection entity operations with asyncio.gather ( #48352 )
2021-04-03 23:35:33 -10:00
Paulus Schoutsen
e882460933
Support modern config for the trigger based template entity ( #48635 )
2021-04-02 16:57:16 -07:00
FMKaiba
09eb74fd9d
Upgrade Astral to 2.2 ( #48573 )
2021-04-02 00:29:08 +02:00
Franck Nijhof
4e3c12883e
Allow templatable service target to support scripts ( #48600 )
2021-04-01 13:10:01 -07:00
Erik Montnemery
9f481e1642
Include script script_execution in script and automation traces ( #48576 )
2021-04-01 09:42:23 -07:00
Ruslan Sayfutdinov
a6759d731d
Use Mapping[str, Any] instead of dict in Entity ( #48421 )
2021-03-31 19:34:00 +02:00
Erik Montnemery
b26779a27a
Add id to automation triggers ( #48464 )
2021-03-31 14:56:04 +02:00
Bram Kragten
d1a1e70726
Search for areas used in automations and scripts ( #48499 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-03-30 15:01:56 -07:00
Marc Mueller
2956eb0902
Update pylint to 2.7.3 ( #48488 )
...
* Update pylint to 2.7.3
* Add class-const-naming-style
* Remove unused-import message
* Additional cleanup
2021-03-29 18:02:56 -10:00
J. Nick Koston
a851bff95a
Create async_config_entry_first_refresh to reduce coordinator boilerplate ( #48451 )
2021-03-29 12:51:39 -10:00
Franck Nijhof
38d14702fa
Remove HomeAssistantType alias from helpers ( #48400 )
2021-03-27 12:55:24 +01:00
Franck Nijhof
45f77ccccf
Merge of nested IF-IF cases - Core ( #48364 )
2021-03-27 09:23:32 +01:00
J. Nick Koston
79af18a8ab
Bump httpx to 0.17.1 ( #48388 )
...
* Bump httpx to 0.17.1
* git add
* typing
* add test
* tweak
2021-03-27 09:02:01 +01:00
Paulus Schoutsen
63e3012380
Fix script default trace ( #48390 )
2021-03-26 23:56:40 -07:00
Erik Montnemery
c6a20d0fc1
Improve traces for nested script runs ( #48366 )
2021-03-26 10:14:01 -07:00
J. Nick Koston
c4f98a3084
Small speed up to adding entities ( #48353 )
2021-03-26 12:05:19 +01:00
Franck Nijhof
f0e5e616a7
Fix device discovery of OAuth2 config flows ( #48326 )
2021-03-25 10:35:01 -07:00
Erik Montnemery
8896ae0d56
Add support for tracing script execution ( #48276 )
...
* Add support for tracing script execution
* Tweak
2021-03-24 17:56:22 +01:00
Erik Montnemery
9f8b697e64
Refactor tracing: Prepare for tracing of scripts ( #48231 )
2021-03-23 14:53:38 -07:00
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