Commit Graph

1468 Commits (d8df62ba1bf751899cdd052d65627d5d17e1090b)

Author SHA1 Message Date
Paulus Schoutsen 8a611eb640
Fix singleton not working with falsey values (#56072) 2021-09-11 12:02:01 -07:00
Erik Montnemery 232943c93d
Add significant change support to AQI type sensors (#55833) 2021-09-08 12:47:48 -07:00
Ruslan Sayfutdinov 7195b8222b
Bump PyJWT to 2.1.0 (#55911) 2021-09-07 20:59:02 -07:00
Chris Browet 5a2bcd2763
ADD: generalize regex_findall (#54584) 2021-09-05 12:41:39 +02:00
Ville Skyttä b10fc89a6b
Automation trigger info type hint improvements (#55402)
* Make automation trigger info a TypedDict

* zwave_js trigger type hint fixes

* Remove redundant automation trigger info field presence checks

* Use async_initialize_triggers in mqtt and tasmota device_trigger tests
2021-09-04 02:25:51 +02:00
Raman Gupta 4d98a7e156
Allow device_id template function to use device name as input (#55474) 2021-08-31 14:56:47 +02:00
Raman Gupta 1d1b5ab345
Fix area_id and area_name template functions (#55470) 2021-08-30 13:09:41 -07:00
J. Nick Koston 43288d3e1f
Prevent storage loads from monopolizing the executor pool (#55389)
* Prevent storage loads from monopolizing the executor pool

- At startup there is an increasing demand to load data
  from storage. Similar to #49451 and #43085, we now prevent
  the thread pool from being monopolized by storage loads and
  allow other consumers that are doing network I/O to proceed
  without having to wait for a free executor thread.

* Only create Semaphore instance when one is not already there
2021-08-28 18:30:20 -05:00
Raman Gupta 2f7a7b0309
Add template functions to get area_id and area_name (#54248)
* Add template function to get area_id

* fix int bug

* Prefer area name lookup

* remove unnecessary checks

* fix import

* Add area_name function

* change behavior to fail in ambiguous scenarios

* Revert lotto winning exception checking

* review comments

* try except else
2021-08-25 15:16:51 -04:00
Paulus Schoutsen 7c5a0174ba
Add an energy solar platform for solar forecasts (#54576)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-08-25 11:37:03 -07:00
Børge Nordli 0d654fa6b3
Extract attribute names out of vol.Optional when validating entity service schema (#55157) 2021-08-25 13:00:11 +02:00
Franck Nijhof 243c52e210
Add missing BYN currency (#55001) 2021-08-21 19:14:48 -07:00
Ville Skyttä 59809503d1
Various type hint related improvements (#54971)
* Avoid some implicit generic Anys

* Fix hassio discovery view type hints

* Fix http view result type in assert message
2021-08-21 13:58:49 +02:00
Marc Mueller 69e413ac1e
Update pylint to 2.10.1 (#54963)
* Update pylint to 2.10.0

* useless-suppression

* Consider-using-tuple

* Apply suggestions from code review

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Use dict.items()

* Add pylint disable

* Use pylint 2.10.1

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-08-21 10:41:23 +02:00
Ville Skyttä de6e7ea016
Replace *args and **kwargs type hint collections with value types (#54955) 2021-08-21 10:20:09 +03:00
Raman Gupta 036e99e91e
Allow integrations to define trigger platforms with a subtype (#54861) 2021-08-19 21:43:04 -07:00
Paulus Schoutsen f1a4ba8bb0
Add Rainforest Eagle tests and price (#54887) 2021-08-19 13:19:31 -07:00
Paulus Schoutsen 4ae2a26aa3
Add config flow to Rainforest EAGLE-200 (#54846)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-08-19 09:22:30 -07:00
Ville Skyttä 848c0be58a
Avoid some implicit generic Anys (#54577) 2021-08-16 23:12:06 +02:00
Erik Montnemery 4e07ab1b32
Move temperature conversions to sensor base class (1/8) (#48261)
* Move temperature conversions to entity base class (1/8)

* Update integrations a-c

* Leave old temperature conversion until all integrations are migrated

* tweak

* Use contextlib.suppress

* Remove the MeasurableUnitEntity mixin

* Address comments, add tests

* Fix f-string

* Drop deprecation warning from base entity class

* Update with _attr-shorthand

* Fix rebase mistakes

* Fix additional rebase mistakes

* Only report temperature conversion once

* Fix additional rebase mistakes

* Format homeassistant/components/bbox/sensor.py

* Fix check for overidden _attr_state

* Remove test workarounds from implementation

* Remove useless None-check

* Tweaks

* Migrate new sensors a-c

* Update climacell

* Push deprecation of temperature conversion forward

* Override __repr__ in SensorEntity

* Include native_value in SensorEntity attributes

* Pylint

* Black

* Black

* Fix rebase mistakes

* black

* Fix rebase mistakes

* Revert changes in august/sensor.py

* Revert handling of unit converted restored state

* Apply code review suggestion

* Fix arlo test
2021-08-11 10:45:05 +02:00
Richard T. Schaefer 3184f0697f
Add Save Persistent States service (#53881) 2021-08-10 00:38:56 +02:00
Paulus Schoutsen 952d11cb03
Ensure internal/external URL have no path (#54304)
* Ensure internal/external URL have no path

* Fix comment typo

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-08-09 09:38:09 +02:00
Allen Porter 160bd74bae
Update DeviceInfo static types (#54276)
* Update nest static types from aditional PR feedback

Update nest and device helper static types based on post-merge discussion in PR #53475

* Remove unused type: ignore in synology

* Remove check for None device type

Remove check for None device type in order to reduce untested code as this is
a case not allowed by the nest python library.
2021-08-08 19:24:36 -07:00
Paulus Schoutsen 1cc3ffe20d
Fix jinja warning (#54109) 2021-08-06 06:41:50 +02:00
Joakim Sørensen 3f2e18fe17
Add user to homeassistant system health (#53902) 2021-08-03 11:58:27 +02:00
Robert Svensson c6213b36ad
Only disable a device if all associated config entries are disabled (#53681) 2021-07-29 12:08:53 -07:00
Franck Nijhof 1968b95829
Add currency core configuration (#53541)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-07-28 08:55:58 +02:00
Raman Gupta 73bc0267e9
Add DeviceRegistry template functions (#53131) 2021-07-27 18:55:55 -04:00
Franck Nijhof d4c4263730
Adjust typing of _attr_extra_state_attributes (#53529) 2021-07-27 01:25:22 +02:00
Franck Nijhof 0b44265232
Add description classes to entity components (#53521)
* Add description classes to entity components

* An -> A

* Add StateVacuumEntityDescription
2021-07-27 00:22:21 +02:00
Franck Nijhof ee452d415d
Add SensorEntityDescription class (#53357) 2021-07-26 22:00:43 +02:00
Marc Mueller 46c3495ae0
Update pylint to 2.9.5 (#53496) 2021-07-26 16:17:15 +02:00
Aaron Bach 0fd88e7e66
Type _attr_extra_state_attributes as a MutableMapping (#52616)
* Type extra_state_attributes as a MutableMapping

* Update homeassistant/helpers/entity.py

Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>

* Update homeassistant/helpers/entity.py

Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
2021-07-20 15:41:03 -06:00
Marc Mueller a56485a8c5
Revert new unit types (#53226) 2021-07-20 14:13:51 +02:00
Marc Mueller f6b162bc39
Add pylint CodeStyle extension (#53147) 2021-07-19 06:57:06 -07:00
Ville Skyttä 470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Marc Mueller 71a8ae3016
Add new unit types for better type checking (#53124)
* Add new unit types
* Update helper functions
* Update components
* Update lcn climate
2021-07-18 14:43:47 +02:00
Daniel Hjelseth Høyer fbad453c89
Pylint 2.9.3 (#52972)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-07-14 21:44:57 -07:00
Erik Montnemery 3408912ded
Improve docstring for async_get_device_class_lookup (#52921) 2021-07-13 10:55:18 +02:00
Marc Mueller 5d2e5d2612
Import Protocol from typing (#52848) 2021-07-12 10:35:17 +02:00
Erik Montnemery 1cc8280959
Enable basic type checking for the homeassistant component (#52464)
* Enable basic type checking for the homeassistant component

* Tweak
2021-07-05 11:26:31 +02:00
Erik Montnemery 14dd6478d1
Enable basic type checking for trace (#52468) 2021-07-03 17:52:31 +02:00
Shay Levy ab73ce00a0
Change "Not adding entity" log level to debug (#52240) 2021-06-28 11:22:10 +02:00
Raman Gupta bef8be9256
Support dynamic schema validation in device conditions and actions (#52007)
* Allow integrations to provide dynamic schema validation in device conditions and actions

* Add tests

* re-add type

* mypy
2021-06-28 09:23:46 +02:00
Erik Montnemery b916247e8e
Improve editing of device automation referring non added select entity (#52047)
* Improve editing of device automation referring non added select entity

* Update tests
2021-06-21 14:49:51 +02:00
Erik Montnemery 4c9f12b9c5
Correct trace path for trigger with custom id (#51847) 2021-06-14 17:09:20 +02:00
Eduard van Valkenburg 779ef3c8e1
Add timedelta option for async_call_later (#50164) 2021-06-12 13:14:35 +02:00
Erik Montnemery b01b33c304
Add trigger condition (#51710)
* Add trigger condition

* Tweaks, add tests
2021-06-11 15:05:57 +02:00
Erik Montnemery ba6b527d61
Improve editing of device actions referencing non-added HVAC (#51706)
* Improve editing of device actions referencing non-added HVAC

* Improve test coverage
2021-06-11 11:13:55 +02:00
Erik Montnemery 49bec86dae
Add base schema for triggers (#51727)
* Add base schema for triggers

* Tweak

* Make TRIGGER_BASE_SCHEMA a voluptuous schema

* Make state trigger BASE_SCHEMA a voluptuous schema
2021-06-11 09:51:12 +02:00
Erik Montnemery a1e3283f8f
Improve editing of device automations referencing non-added sensors (#51312) 2021-06-08 23:28:08 -07:00
Franck Nijhof 4c51299dcc
Add easy converting string timestamps/dates to datetime objects in templates (#51576) 2021-06-07 15:02:15 +02:00
Franck Nijhof f35929ba63
Allow referencing sensor entities for before/after in time conditions (#51444)
* Allow referencing sensor entities for before/after in time conditions

* Fix typo in variable naming

* Improve test coverage
2021-06-07 14:50:31 +02:00
Franck Nijhof 05241a7a68
Allow number/sensor entities in numeric state conditions/triggers (#51439) 2021-06-04 18:14:48 +02:00
Paulus Schoutsen ede7932a57
Protect our user agent (#51486)
* Protect our user agent

* Fix expected error
2021-06-04 09:14:18 -07:00
Franck Nijhof d51fc5814a
Define ToggleEntity entity attributes as class variables (#51231)
* Define ToggleEntity entity attributes as class variables

* Fix upcloud overriding state property

* Implement available state for upcloud, to compensate removed state
2021-06-02 08:53:55 +02:00
Paulus Schoutsen ee2c950716
Merge system options into pref properties (#51347)
* Make system options future proof

* Update tests

* Add types
2021-06-01 22:34:31 +02:00
Franck Nijhof c5dc99c052
Fix time condition microsecond offset when using input helpers (#51337) 2021-06-01 17:57:23 +02:00
Erik Montnemery 63e16de6c0
Improve time condition trace (#51335) 2021-06-01 17:07:45 +02:00
Paulus Schoutsen 45e1473f83
Improve config validation for key_value_schemas (#49429) 2021-06-01 11:23:59 +02:00
Paulus Schoutsen f472219c68
Set up cloud semi-dependencies at start (#51313) 2021-06-01 01:35:31 +02:00
Paulus Schoutsen 4821484d2c
Add system option to disable polling (#51299) 2021-05-31 15:36:40 -07:00
Erik Montnemery 837220cce4
Add deprecated backwards compatible history.LazyState (#51144) 2021-05-28 11:01:28 +02:00
Raman Gupta 58e37435b3
Make more max lengths constants and add additional MaxLengthExceeded checks (#50337)
* Add more MaxLengthExceeded checks

* remove some validations to reduce performance impact

* check length of generated entity ID

* dont check entity ID twice and use single context id length constant

* fix test

* add missing test
2021-05-25 19:58:01 +02:00
Erik Montnemery abd6f739e8
Pylint fix (#51083) 2021-05-25 10:53:18 -07:00
Erik Montnemery 7b5e63132c
Prevent parallel reload of automations (#50008) 2021-05-25 08:50:50 -07:00
Matt Zimmerman e964c607a3
jinja2.contextfilter decorator renamed to pass_context (#51007)
* jinja2.contextfilter decorator renamed to pass_context

* bump jinja2 dependency
2021-05-24 17:38:37 +02:00
Ruslan Sayfutdinov 44bbd9396d
Fix typing in config flow helper (#50994) 2021-05-23 14:08:21 +02:00
Franck Nijhof 38d095aa18
Define entity attributes as entity class variables (#50925)
* Define entity attributes as entity class variables

* Example coronavirus integration

* Example verisure

* Cleanup/typing fixes

* Fix Coronavirus

* Revert "Fix Coronavirus"

This reverts commit 060843860f.

* Revert "Cleanup/typing fixes"

This reverts commit 659b79e75a.

* Define entity attributes as entity class variables (attr alternative)

* Example coronavirus

* Example nut

* Example verisure

* Mark private

* Cleanup after all reverting/cherrypicking/merging

* Implement all entity properties

* Update coronavirus example

* Update nut example

* Update verisure example

* Lets not talk about this one...

* Fix multiple class attribute
2021-05-22 09:13:50 -07:00
Ruslan Sayfutdinov 391b2f8ccd
Add missing return type in Core constructors (#50884) 2021-05-20 18:53:29 +03:00
Erik Montnemery 1ea0d8ae02
Correct trace of condition actions (#50800) 2021-05-17 16:54:17 -07:00
Ruslan Sayfutdinov 6b38adaa3d
Downgrade setuptools to fix CI (#50734) 2021-05-16 20:36:23 -07:00
Ville Skyttä ed10856cc4
UpCloud API and typing update (#50624) 2021-05-14 21:49:41 -07:00
Martin Hjelmare e32dc306e1
Fix oauth2 helper user step typing (#50618) 2021-05-14 23:39:14 +02:00
Erik Montnemery bcd8f43e7b
Update light intents to check supported_color_modes (#50625) 2021-05-14 14:23:29 -07:00
Ruslan Sayfutdinov 0cb08f9516
Add missing type hints in entity_platform (#50453) 2021-05-12 16:28:44 +02:00
Erik Montnemery b35f229674
Include _StopScript.__cause__ in trace (#50441)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-05-11 22:27:11 -07:00
Martin Hjelmare 7c4893cbb1
Fix event action return value typing (#50353)
Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
2021-05-11 16:23:59 +02:00
Ruslan Sayfutdinov ce15f28642
Add missing type hints in http component (#50411) 2021-05-10 14:30:47 -07:00
Ville Skyttä b89c53f759
Type hint device registry identifiers as set of str 2-tuples (#50355)
* Type hint device registry identifiers as set of str 2-tuples

* Fix airly test

* Really fix airly test, add another migration test
2021-05-10 12:13:45 +02:00
Franck Nijhof 44383f25ce
Clean up pylint comments (#49334) 2021-05-05 08:56:50 +02:00
Franck Nijhof 96f69fb9fb
Finalize clean up connection classes (#49895) 2021-05-04 20:08:51 +02:00
Franck Nijhof efb1bb08a4
Add small async_get_current_platform helper method (#50014) 2021-05-03 16:46:42 +02:00
Franck Nijhof 378cee01b4
Add typing to async_register_entity_service (#50015) 2021-05-03 14:22:38 +02:00
Ville Skyttä ddd7e79ee9
Improve device registry internal typing (#49924) 2021-05-01 12:33:31 -10:00
Franck Nijhof 1b5596b4c2
Remove ServiceCallType alias from codebase (#49844) 2021-05-02 00:15:27 +02:00
Ville Skyttä 59f32f7c9c
Make device info a TypedDict (#49670) 2021-04-30 23:21:39 +02:00
Ruslan Sayfutdinov f53284b200
Make CoordinatorEntity generic (#49854) 2021-04-30 13:24:27 -07:00
Ville Skyttä a19f757120
Allow str 1..n-tuples in device registry identifier type hints (#49864)
This reflects current practice, but the intent has been to have them as
2-tuples, and a future change is likely to start enforcing that (again).

Refs https://github.com/home-assistant/core/pull/49670#discussion_r622344872
2021-04-30 08:56:55 +02:00
Franck Nijhof c68b259bd3
Cleanup of unused connection_class logic (#49865)
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
2021-04-29 23:12:58 +02:00
Ruslan Sayfutdinov 183220008d
Rename FlowResultDict to FlowResult (#49847) 2021-04-29 13:40:51 +02:00
Ruslan Sayfutdinov 0301706fc6
Define AddEntitiesCallback type (#49812) 2021-04-29 12:28:14 +02:00
Ruslan Sayfutdinov 5008c27e7a
Relax type annotation for DataUpdateCoordinator data (#49827) 2021-04-28 18:31:08 -10:00
Erik Montnemery d2fd504442
Limit precision when stringifying float states (#48822)
* 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
J. Nick Koston 3fa8ffa731
Enable mccabe complexity checks in flake8 (#49616)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Marc Mueller f1d48ddfe3
Update pylint to 2.8.0 (#49637) 2021-04-24 14:39:24 -10:00
jan iversen 49c23bad29
Revert "Remove HomeAssistantType from typing.py as it is no...2 (#49617)
This reverts commit 39cb22374d.

Added comment that HomeAssistantType is not to be used, but only
kept in order not to break custom components.
2021-04-24 09:10:07 -10:00
jan iversen 39cb22374d
Remove HomeAssistantType from typing.py as it is no longer used. (#49593) 2021-04-23 11:08:58 +02:00
Erik Montnemery d28b959a09
Improve sun condition trace (#49551) 2021-04-22 16:46:27 -07:00
Paulus Schoutsen 1016d4ea28
Support trigger-based template binary sensors (#49504)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-22 14:54:28 -07:00
Marc Mueller c07646db5d
Update typing syntax (#49480)
* 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 (#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