2103 Commits

Author SHA1 Message Date
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 060843860fe300f8448d0d2476de8963d5ddf5a2.

* Revert "Cleanup/typing fixes"

This reverts commit 659b79e75a97007f7181064e446c3e988c2d54bb.

* 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 39cb22374d20ec16e163bab07ce194b6a36c34bd.

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