J. Nick Koston
0a9c4f15c4
Add event helper to dispatch device registry updates by device_id ( #93602 )
...
* Add event helper to dispatch device registry updates by device_id
* Update homeassistant/helpers/event.py
* dry
* dry
* reduce
* reduce
* reorder
* reduce
* cleanup stack depth
* dry
* fix double lookup
* remove unused
* collapse
2023-05-27 20:04:09 -04:00
J. Nick Koston
5c6ed8f6d5
Use call_at for events instead call_later ( #93431 )
...
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2023-05-24 21:04:07 +02:00
J. Nick Koston
3c8659d5d7
Fix missing f-string in async_track_utc_time_change ( #92916 )
2023-05-11 08:37:15 +02:00
epenet
a018ba0696
Improve async_track_point_in_time ( #91451 )
...
* Adjust async_track_point_in_time
* Adjust name
2023-04-15 20:28:08 +02:00
J. Nick Koston
56cc6633f5
Use fast path for track_time_change that fires every second ( #91432 )
...
We were missing a check for `*` and were only checking
`None`. Automations use `*`, python code uses `None`.
2023-04-14 21:02:54 -04:00
J. Nick Koston
5ffd833fdf
Improve performance of tracking time changes ( #91433 )
...
* Improve performance of async_track_time_interval
Uses HassJob internally to avoid looking up the function
target type every time it fires
* name
2023-04-14 21:02:13 -04:00
epenet
9744e72d5a
Add ability to auto-cancel track_time_interval ( #91381 )
2023-04-13 21:31:16 +02:00
rlippmann
3a72054f93
Make dataclasses in HA core slotted ( #91208 )
2023-04-11 07:58:28 -10:00
epenet
c01b1eb013
Adjust async_track_time_interval name argument ( #90838 )
...
Adjust async_track_time_interval naming
2023-04-05 10:58:02 -04:00
J. Nick Koston
02ef7d445d
Allow passing an optional name to async_track_time_interval ( #90244 )
...
* Allow passing an optional name to async_track_time_interval
This is the same idea as passing a name to asyncio.create_task which
makes it easier to track down bugs
* more
* short
* still cannot find it
* add a few more
* test
2023-03-25 10:11:14 -04:00
J. Nick Koston
cefba7c638
Avoid falling back to listening for all states when a template render raises an exception ( #89392 )
...
When a template render raised an exception we would start listening for
all states until the template did not raise an exception anymore. This
was not needed since the entity that is causing the exception was
already in the tracker.
Re-rendering on all state changes can be extremely expensive and can
bring an instance into a sluggish or unresponsive state when updating
from a much older version that did not raise ValueError when a default
was missing.
2023-03-08 15:50:34 -05:00
J. Nick Koston
aff7345ea0
Improve event filters to reject earlier ( #89337 )
...
* Improve event filters to reject earlier
- Avoid running the callbacks for state added/removed from
a domain if there are no listeners that care about the domain
- Remove some impossible checks in the listeners that will
never match since they were already rejected by the filter
* leave one guard since there is a race when we return control via await
2023-03-08 10:25:42 -05:00
J. Nick Koston
11681f3f31
Pass a helpful name when creating common asyncio tasks in core ( #89171 )
2023-03-05 12:46:02 +01:00
krahabb
899342d391
Refactor async_call_later to improve performance and reduce conversion loss ( #87117 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-05 12:04:38 -06:00
Marc Mueller
6f94e47270
Update Union typing (6) [Py310] ( #86454 )
2023-01-23 15:01:07 +01:00
Marc Mueller
45b4b0e990
Import `ParamSpec` from typing [Py310] ( #86413 )
...
* Import ParamSpec from typing [Py310]
* Update additional imports
2023-01-23 07:28:43 +01:00
Franck Nijhof
06a35fb7db
Code styling tweaks to core helpers ( #85441 )
2023-01-08 13:44:09 -10:00
J. Nick Koston
d89c259d7e
Fix double time conversion in async_track_point_in_utc_time ( #85036 )
2023-01-03 20:21:54 +01:00
Franck Nijhof
d4f69a3652
String formatting and max line length - Part 7 ( #84532 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
Michaël Arnauts
7142b4ecac
Fixes some grammar mistakes ( #84283 )
2022-12-20 11:10:31 +01:00
J. Nick Koston
d0efdd750f
Fix high latency from thundering heard at 0 microseconds ( #82233 )
...
* Fix high latency at 0 microseconds
fixes #82231
* fix async_track_utc_time_change alignment
* use replace to preserve fold
* naming
* tweak
* make async_fire_time_changed aware of the thundering heard issue
2022-11-17 14:22:06 -05:00
HarvsG
e5dafbc166
Make _TrackTemplateResultInfo not private ( #79812 )
2022-10-09 15:23:08 +02:00
Erik Montnemery
7ead77eea6
Correct typing of async_track_state_change ( #79150 )
...
* Correct typing of async_track_state_change
* Update integrations
2022-09-27 16:32:54 +01:00
J. Nick Koston
363f95c954
Remove auto lowercasing from async_track_entity_registry_updated_event ( #77740 )
2022-09-05 12:13:05 +02:00
Marc Mueller
dc47121f2c
Better type hass_job method calls ( #76053 )
2022-08-09 16:12:33 -04:00
Marc Mueller
af7df260a0
Fix small type issues [core] ( #75760 )
2022-07-26 16:28:22 +02:00
J. Nick Koston
9b157f974d
Reduce overhead to refire events from async_track_point_in_utc_time when an asyncio timer fires early ( #73295 )
...
* Reduce overhead to refire events
- asyncio timers can fire early for a varity of reasons including
poor clock resolution and performance. To solve this problem
we re-arm async_track_point_in_utc_time and try again later
when this happens.
- On some platforms this means the async_track_point_in_utc_time can
end up trying many times to prevent firing the timer early since as
soon as it rearms it fires again and this repeats until we reach
the appointed time. While there is not much we can do to prevent
asyncio from firing the timer callback early, we can reduce the
overhead when this happens by using avoiding creating datetime
objects
* tweak mocking
* -vvv
* fix time freeze being too broad in litterrobot
* adjust
2022-06-14 07:46:00 -10:00
Marc Mueller
b417ae72e5
Add generic parameters to HassJob ( #70973 )
2022-05-30 09:22:37 +02:00
J. Nick Koston
30fdfc454f
Avoid lowercasing entities after template ratelimit recovery ( #71415 )
2022-05-09 12:48:38 +02:00
Marc Mueller
93cbb331e5
Update Mypy to 0.950 ( #70948 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-04-27 20:49:54 -05:00
Marc Mueller
7dfe8591c4
Improve typing [helpers.event] ( #70891 )
2022-04-27 17:19:06 +02:00
Franck Nijhof
fb92fc6a8e
Trigger on not matching to/from states ( #69760 )
2022-04-12 14:18:23 -07:00
J. Nick Koston
fe6a4bfb1d
Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC ( #69643 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-09 09:05:54 -10:00
Marc Mueller
30e2411761
Add type ignore error codes [last ones] ( #66816 )
2022-02-18 18:15:57 +01:00
Erik Montnemery
037621b796
Update _TrackStateChangeFiltered entity listener with new entities ( #64909 )
2022-01-25 18:19:12 +01:00
Marc Mueller
12757a8cd2
Update typing - collections.abc (1) ( #63933 )
...
* Update typing - collections.abc (1)
* Additional typing updates
2022-01-12 07:56:35 +01:00
Marc Mueller
d3b7bd25ef
Update typing (1) ( #63922 )
2022-01-11 21:26:03 +01:00
Marc Mueller
eb2238a9e1
Add types for HassJob [helpers.event] ( #63675 )
2022-01-08 14:26:22 +01:00
Marc Mueller
250af90acb
Improve callable typing [helpers.event] ( #63543 )
2022-01-06 21:01:27 -10:00
Marc Mueller
198ade5e2b
Fix typing `TrackTemplateResultListener` [helpers.event] ( #63541 )
2022-01-06 13:43:54 -10:00
Ruslan Sayfutdinov
55f4962c06
Fix pylint plugin which checks relative imports ( #62693 )
2021-12-23 11:14:47 -08:00
Erik Montnemery
39d6aba3bc
Improve startup of unavailable template entities ( #59827 )
2021-11-22 09:20:38 -08:00
Erik Montnemery
acf58111c6
Correct initial update of async_track_template_result ( #59705 )
2021-11-15 13:00:46 +01:00
Erik Montnemery
34e5596375
Use async_track_utc_time_change to schedule short term statistics ( #58903 )
2021-11-01 10:49:54 -07:00
Erik Montnemery
bed4096430
Allow specifying a super template for async_track_template_result ( #58477 )
2021-10-27 16:07:17 +02:00
Marc Mueller
7af67d34cf
Use assignment expressions 01 ( #56394 )
2021-09-18 13:31:35 -10: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
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
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
Eduard van Valkenburg
779ef3c8e1
Add timedelta option for async_call_later ( #50164 )
2021-06-12 13:14:35 +02:00