Commit graph

128 commits

Author SHA1 Message Date
Ruslan Sayfutdinov
55f4962c06
Fix pylint plugin which checks relative imports () 2021-12-23 11:14:47 -08:00
Erik Montnemery
39d6aba3bc
Improve startup of unavailable template entities () 2021-11-22 09:20:38 -08:00
Erik Montnemery
acf58111c6
Correct initial update of async_track_template_result () 2021-11-15 13:00:46 +01:00
Erik Montnemery
34e5596375
Use async_track_utc_time_change to schedule short term statistics () 2021-11-01 10:49:54 -07:00
Erik Montnemery
bed4096430
Allow specifying a super template for async_track_template_result () 2021-10-27 16:07:17 +02:00
Marc Mueller
7af67d34cf
Use assignment expressions 01 () 2021-09-18 13:31:35 -10:00
Ville Skyttä
59809503d1
Various type hint related improvements ()
* 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
Daniel Hjelseth Høyer
fbad453c89
Pylint 2.9.3 ()
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-07-14 21:44:57 -07:00
Erik Montnemery
1cc8280959
Enable basic type checking for the homeassistant component ()
* Enable basic type checking for the homeassistant component

* Tweak
2021-07-05 11:26:31 +02:00
Eduard van Valkenburg
779ef3c8e1
Add timedelta option for async_call_later () 2021-06-12 13:14:35 +02:00
Ruslan Sayfutdinov
391b2f8ccd
Add missing return type in Core constructors () 2021-05-20 18:53:29 +03:00
Martin Hjelmare
7c4893cbb1
Fix event action return value typing ()
Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
2021-05-11 16:23:59 +02: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
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
Ville Skyttä
970cbcbe15
Type hint improvements () 2021-04-17 08:35:21 +02:00
Erik Montnemery
16196e2e16
Don't log template errors from developer tool () 2021-04-09 12:10:02 -07:00
Marc Mueller
6fb2e63e49
Update typing 02 () 2021-03-17 18:34:19 +01:00
J. Nick Koston
c9df42b69a
Add support for pre-filtering events to the event bus () 2021-02-14 09:42:55 -10:00
tkdrob
c2302784c2
Use core constants for helpers () 2021-02-08 22:53:17 +01:00
Erik Montnemery
0780e52ca4
Support templates in event triggers ()
* Support templates in event triggers

* Don't validate trigger schemas twice
2021-02-08 14:06:27 +01:00
Ville Skyttä
d13b58a4e6
Upgrade mypy to 0.800 ()
* Upgrade mypy to 0.800

https://mypy-lang.blogspot.com/2021/01/mypy-0800-released.html

* Fix issues flagged by mypy 0.800

* Add overloads + small changes

* Apply grammar

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-01-30 22:33:53 +01:00
J. Nick Koston
2ef25e7414
Fix script wait templates with now/utcnow () 2021-01-01 13:03:34 +01:00
Anders Melchiorsen
650c57db5b
Fix async_track_utc_time_change firing too early () 2020-11-05 16:34:56 +01:00
Paulus Schoutsen
bba770b411
Fix CI () 2020-10-26 13:36:03 +01:00
Anders Melchiorsen
cb0c937b3e
Refresh now() templates on second=0 () 2020-10-23 00:11:02 +02:00
J. Nick Koston
31c21126a8
Implement time tracking in templates ()
Co-authored-by: Anders Melchiorsen <amelchio@nogoto.net>
2020-10-19 11:02:43 +02:00
J. Nick Koston
3a9b2392f8
Suppress domain and all listeners during template rate limit () 2020-10-19 10:17:51 +02:00
J. Nick Koston
21cc23244d
Improve template ratelimit performance () 2020-10-15 12:02:05 +02:00
J. Nick Koston
53a1d92f2b
Permit event trackers to accept an empty list of entities or domains () 2020-10-15 09:26:51 +02:00
J. Nick Koston
1bcedd15b3
Update sun listeners to use HassJob ()
Avoids checking the callable type every time sun events trigger
2020-10-13 21:37:10 +02:00
J. Nick Koston
3a863c4a0f
Fully convert async_track_time_interval to use HassJob ()
The callback type for interval_listener was being determined
each time the interval hit.

This was missed in the original conversion.
2020-10-09 09:35:09 +02:00
J. Nick Koston
9e1461da62
Determine how to run listeners at setup time instead of execution time () 2020-10-07 16:51:50 +02:00
Franck Nijhof
ee914366a8
Add native Python types support to templates ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-10-07 00:05:52 +02:00
J. Nick Koston
51da605b9f
Remove manual rate_limit control directive from templates ()
Increase default rate limit for all states and entire
domain states to one minute

Ensure specifically referenced entities are excluded from
the rate limit
2020-10-04 22:40:04 +02:00
J. Nick Koston
ab17b4ab70
Simplify template tracking and make it easier to follow () 2020-10-02 07:27:39 -05:00
J. Nick Koston
b45215f1d2
Implement template rate_limit directive () 2020-10-01 21:39:44 +02:00
J. Nick Koston
7285c7806f
Seperate state change tracking from async_track_template_result into async_track_state_change_filtered () 2020-10-01 10:19:20 +02:00
J. Nick Koston
205cf57a77
Code cleanups for async_track_template_result () 2020-09-30 13:00:21 +02:00
J. Nick Koston
57b7559832
Ensure all jinja2 errors are trapped and displayed in the developer tools ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-09-26 17:03:32 -05:00
J. Nick Koston
3261a904da
Reduce the number of template re-renders when we are only counting states () 2020-09-26 16:29:49 -05:00
J. Nick Koston
e9abb357e4
Log template listeners when debug logging is on () 2020-09-17 14:45:30 -05:00
J. Nick Koston
949bd8d738
Reduce listener cancelation code in template tracker () 2020-09-14 21:43:00 +02:00
J. Nick Koston
aaa8083d49
Change template loop detection strategy to allow self-referencing updates when there are multiple templates () 2020-09-12 14:20:21 +02:00
J. Nick Koston
741487a1fc
Return the listeners with the template result for the websocket api () 2020-09-11 13:18:40 -05:00
J. Nick Koston
e208aac834
Add async_track_state_removed_domain to allow tracking when a state is removed from a domain ()
when a state is removed from a domain
2020-09-11 13:03:31 +02:00
J. Nick Koston
fd8a4182d9
Detect self-referencing loops in template entities and log a warning () 2020-09-10 20:50:11 +02:00
J. Nick Koston
e55a014e94
Undecorate RenderInfo result property () 2020-09-02 10:35:15 +02:00
J. Nick Koston
a77e09b2c2
Make async_track_template_result track multiple templates ()
* Make async_track_template_result track multiple templates

Combine template entity updates to only write ha
state once per template group update

* Make async_track_template_result use dataclasses for input/output

* black versions

* naming
2020-08-31 19:07:40 -05:00
Ville Skyttä
1bf2c4d976
Upgrade pylint to 2.6.0 () 2020-08-29 07:59:24 +02:00
J. Nick Koston
f8704a2dfc
Ensure we always fire time pattern changes after microsecond 0 () 2020-08-28 16:27:25 +02:00