Commit Graph

1221 Commits (0072923fbe203008ee3bea2d674b80ea6b7fd67b)

Author SHA1 Message Date
jan iversen 39cb22374d
Remove HomeAssistantType from typing.py as it is no longer used. () 2021-04-23 11:08:58 +02:00
Erik Montnemery d28b959a09
Improve sun condition trace () 2021-04-22 16:46:27 -07:00
Paulus Schoutsen 1016d4ea28
Support trigger-based template binary sensors ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-22 14:54:28 -07:00
Marc Mueller c07646db5d
Update typing syntax ()
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Erik Montnemery a968dea152
Fix deadlock when restarting scripts () 2021-04-19 14:45:01 +02:00
J. Nick Koston 6048e88c8b
Improve debuggability by providing job as an arg to loop.call_later ()
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 ()
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 () 2021-04-17 08:35:21 +02:00
Erik Montnemery 2c8b7c56f5
Fix race when restarting script () 2021-04-16 09:03:34 +02:00
Mike Degatano 236d274351
Add `search` and `match` as Jinja tests () 2021-04-15 20:13:27 +02:00
Ruslan Sayfutdinov 80f66f301b
Define data flow result type ()
* 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 ()
* 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 ()
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 () 2021-04-13 16:16:26 -10:00
J. Nick Koston 82790cd28d
Do not compile static templates ()
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 ()
* 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 () 2021-04-12 17:18:38 -07:00
Erik Montnemery ff5fbea1fb
Improve trace of template conditions ()
* 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 () 2021-04-12 10:02:04 +02:00
Erik Montnemery 7e4be921a8
Add helper to get an entity's supported features ()
* 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 () 2021-04-09 19:41:29 -10:00
Jason 7cc857a298
Add custom JSONEncoder for subscribe_trigger WS endpoint () 2021-04-09 20:47:10 -07:00
Erik Montnemery 16196e2e16
Don't log template errors from developer tool () 2021-04-09 12:10:02 -07:00
J. Nick Koston 40450b9cfd
Detach aiohttp.ClientSession created by config entry setup on unload () 2021-04-09 10:14:33 -07:00
Marc Mueller 8e2b5b36b5
Bump pyupgrade to 2.12.0 () 2021-04-09 09:58:27 -07:00
Erik Montnemery d1df6e6fba
Don't get code_context when calling inspect.stack ()
* 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 () 2021-04-06 12:11:42 -07:00
J. Nick Koston 12e3bc8101
Provide api to see which integrations are being loaded ()
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 ()
* Apply ConfigEntryNotReady improvements to PlatformNotReady

- Limit log spam 
- Log exception reason 
- Prevent startup blockage 

* coverage
2021-04-04 12:31:58 +02:00
J. Nick Koston 3bc583607f
Optimize storage collection entity operations with asyncio.gather () 2021-04-03 23:35:33 -10:00
Paulus Schoutsen e882460933
Support modern config for the trigger based template entity () 2021-04-02 16:57:16 -07:00
FMKaiba 09eb74fd9d
Upgrade Astral to 2.2 () 2021-04-02 00:29:08 +02:00
Franck Nijhof 4e3c12883e
Allow templatable service target to support scripts () 2021-04-01 13:10:01 -07:00
Erik Montnemery 9f481e1642
Include script script_execution in script and automation traces () 2021-04-01 09:42:23 -07:00
Ruslan Sayfutdinov a6759d731d
Use Mapping[str, Any] instead of dict in Entity () 2021-03-31 19:34:00 +02:00
Erik Montnemery b26779a27a
Add id to automation triggers () 2021-03-31 14:56:04 +02:00
Bram Kragten d1a1e70726
Search for areas used in automations and scripts ()
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 ()
* 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 () 2021-03-29 12:51:39 -10:00
Franck Nijhof 38d14702fa
Remove HomeAssistantType alias from helpers () 2021-03-27 12:55:24 +01:00
Franck Nijhof 45f77ccccf
Merge of nested IF-IF cases - Core () 2021-03-27 09:23:32 +01:00
J. Nick Koston 79af18a8ab
Bump httpx to 0.17.1 ()
* 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 () 2021-03-26 23:56:40 -07:00
Erik Montnemery c6a20d0fc1
Improve traces for nested script runs () 2021-03-26 10:14:01 -07:00
J. Nick Koston c4f98a3084
Small speed up to adding entities () 2021-03-26 12:05:19 +01:00
Franck Nijhof f0e5e616a7
Fix device discovery of OAuth2 config flows () 2021-03-25 10:35:01 -07:00
Erik Montnemery 8896ae0d56
Add support for tracing script execution ()
* 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 () 2021-03-23 14:53:38 -07:00
Franck Nijhof 6932cf9534
Use contextlib.suppress where possible () 2021-03-23 14:36:43 +01:00
Franck Nijhof dc15f243e6
Upgrade pyupgrade to v2.11.0 () 2021-03-22 13:29:39 +01:00