Commit Graph

744 Commits (e5bfef719fc88972240ccdc2456aff85750543d9)

Author SHA1 Message Date
Ville Skyttä 77d5244577
Use device registry CONNECTION_* constants () 2021-04-30 23:58:50 +02:00
Franck Nijhof c68b259bd3
Cleanup of unused connection_class logic ()
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
2021-04-29 23:12:58 +02:00
Erik Montnemery d2fd504442
Limit precision when stringifying float states ()
* Limit precision when stringifying float states

* Add test

* Fix typing

* Move StateType

* Update

* Move conversion to entity helper

* Address review comments

* Tweak precision

* Tweak

* Make _stringify_state an instance method
2021-04-27 21:48:24 +02:00
Ville Skyttä 153d6e891e
Use config_entries.SOURCE_* constants () 2021-04-25 11:27:40 +02:00
Ville Skyttä a396619251
Use disabled_by constants ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-04-23 09:56:42 +02:00
Erik Montnemery d28b959a09
Improve sun condition trace () 2021-04-22 16:46:27 -07: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
Mike Degatano 236d274351
Add `search` and `match` as Jinja tests () 2021-04-15 20:13:27 +02: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
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
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
Marc Mueller 8e2b5b36b5
Bump pyupgrade to 2.12.0 () 2021-04-09 09:58:27 -07:00
Erik Montnemery 9f5db2ce3f
Improve warnings on undefined template errors () 2021-04-06 12:11:42 -07: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
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
J. Nick Koston a851bff95a
Create async_config_entry_first_refresh to reduce coordinator boilerplate () 2021-03-29 12:51:39 -10:00
Erik Montnemery 0c6a1c29ec
Fix broken trace tests () 2021-03-29 10:06:22 +02:00
Franck Nijhof ad13a9295e
Merge multiple context managers in tests () 2021-03-27 09:17:15 +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
Franck Nijhof f0e5e616a7
Fix device discovery of OAuth2 config flows () 2021-03-25 10:35:01 -07:00
Erik Montnemery 272dffc384
Improve script tracing ()
* Improve script tracing

* Fix test
2021-03-22 13:15:45 +01:00
Erik Montnemery 73e546e2b8
Improve condition trace tests () 2021-03-21 22:09:59 -07:00
Franck Nijhof 08870690a6
Fix a collection of tests with missing asserts ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-03-20 17:23:55 +01:00
Erik Montnemery f8755a52c2
Warn on undefined variables in templates ()
* Warn on undefined variables in templates

* Add test

* fix tests

* fix tests
2021-03-20 15:16:04 +01:00
Franck Nijhof 5a2b5fe7c5
Yoda assertion style removed is () 2021-03-20 13:55:10 +01:00
Franck Nijhof 8a56dbf587
Add flake8 comprehensions checks to pre-commit & CI () 2021-03-19 13:41:09 +01:00
Erik Montnemery 7b717bc437
Correct trace for repeat script actions () 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 () 2021-03-17 21:27:21 -07:00
Alan Tse f86e7535e0
Add location details to deprecation warning () 2021-03-16 21:16:07 +01:00
Erik Montnemery 389891d13d
Improve JSONEncoder test coverage () 2021-03-16 17:12:51 +01:00
Erik Montnemery 1cde1074c9
Correct trace for choose and repeat script actions ()
* 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
Paulus Schoutsen ff94e920e4
Do not use AsyncTrackStates () 2021-03-11 23:18:09 -08:00
Erik Montnemery 704000c049
Add support for breakpoints in scripts () 2021-03-09 21:23:11 -08:00
Erik Montnemery b3fecb1c95
Update tests t-z to use async_get() instead of async_get_registry() () 2021-03-09 14:25:03 +01:00
Paulus Schoutsen 67effbc8c4
Config flow to allow marking itself as confirm only () 2021-03-08 10:54:51 -08:00
Erik Montnemery 8fe51b8ea7
Store automation traces indexed by run_id ()
* Store traces indexed by run_id

* Format

* Add test

* Add test

* Clarify comment
2021-03-08 18:04:41 +01:00
Erik Montnemery 2f9d03d115
Merge action and condition traces ()
* 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
Franck Nijhof 7a8b7224c8
Don't raise on known non-matching states in numeric state condition () 2021-03-04 13:09:08 -08:00
Erik Montnemery 17401cbc29
Initial automation tracing ()
* 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 () 2021-03-03 10:12:37 -08:00