Commit Graph
142 Commits
Author SHA1 Message Date
Erik MontnemeryandGitHub 67c68dedba Make async_track_state_change/report_event listeners fire in order (#148766) 2025-07-21 13:07:52 +02:00
Erik MontnemeryandGitHub 1a1e9e9f57 Add test for combining state change and state report listeners (#148721) 2025-07-14 20:15:39 +02:00
Joost LekkerkerkerandGitHub 4cd3527761 Enable B009 (#144192) 2025-05-21 16:37:51 +01:00
J. Nick KostonandGitHub 870350b961 Add async_has_entity_registry_updated_listeners (#142772) 2025-04-14 19:45:09 +02:00
epenetandGitHub 364556a7dd Prefer from...import...as over import...as in core tests (#136146) 2025-01-21 09:28:17 +01:00
epenetandGitHub c7485b94d5 Use breaks_in_ha_version in report_usage (#131137)
* Use breaks_in_ha_version in report_usage

* Revert behavior change
2024-11-23 18:58:24 +01:00
SidandGitHub 9e98e446a2 Bump ruff to 0.8.0 (#131273) 2024-11-22 16:53:26 +01:00
epenetandGitHub deeb55ac50 Add ability to set HA breaking version in report_usage (#130858)
* Add ability to set breaking version in report_usage

* Adjust tests

* Adjust test

* Adjust tests

* Rename breaks_in_version => breaks_in_ha_version
2024-11-20 21:41:57 +01:00
epenetandGitHub be4641b8f3 Push real binary sensor states to state machine in tests (#128894) 2024-10-21 16:19:25 +02:00
Erik MontnemeryandGitHub cf10549df4 Restore unnecessary assignment of Template.hass in event helper (#125143) 2024-09-03 15:25:35 +02:00
Erik MontnemeryandGitHub 78f7b3340d Remove unnecessary assignment of Template.hass from event helper (#123777) 2024-08-13 12:09:30 +02:00
Erik MontnemeryandGitHub 8de771de96 Rename async_track_state_reported_event to async_track_state_report_event (#120637)
* Rename async_track_state_reported_event to async_track_state_report_event

* Update tests
2024-06-27 13:45:15 +02:00
J. Nick KostonandGitHub a5a631148e Add async_track_state_reported_event to fix integration performance regression (#120622)
split from https://github.com/home-assistant/core/pull/120621
2024-06-26 23:04:27 -04:00
epenetandGitHub ca8d3e0c83 Ignore unnecessary-lambda warnings in tests (#119564) 2024-06-13 16:58:41 +02:00
eb76386c68 Prevent time pattern reschedule if cancelled during job execution (#117879)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-22 10:36:03 -10:00
J. Nick KostonandGitHub 5a609c34bb Fix blocking I/O in the event loop when loading timezones (#117721) 2024-05-20 11:06:03 +02:00
J. Nick KostonandGitHub 0380116ef6 Improve logging of _TrackPointUTCTime objects (#116711) 2024-05-04 17:35:44 -05:00
J. Nick KostonandGitHub d48bd9b016 Deprecate async_track_state_change in favor of async_track_state_change_event (#115558) 2024-04-18 10:45:14 -05:00
Marc MuellerandGitHub 0f03079065 Update import for EventStateChangedData [i-z] (#114900) 2024-04-04 11:48:29 -10:00
J. Nick KostonandGitHub b574220247 Refactor rate limit helper to track time in seconds (#113898)
* Refactor rate limit helper to track time in seconds

Currently we created datetime and timedelta objects to enforce the
rate limit. When the rate limit was being hit hard, this got expensive.

We now use floats everywhere instead as they are much cheaper which
is important when we are running up against a rate limit, which is
by definition a hot path

The rate limit helper is currently only used for templates and
we do not have any code in the code base that directly passes
in a rate limit so the impact to custom components is expected
to be negligible if any

* misesd two
2024-03-20 19:49:37 -04:00
Marc MuellerandGitHub b026b5d589 Replace EventType with Event [helpers] (#112743) 2024-03-08 19:41:50 +01:00
J. Nick KostonandGitHub a7b4cd3512 Pass job type to event listeners when creating entities (#112551) 2024-03-06 16:10:07 -10:00
Marc MuellerandGitHub cd0ee98dba Use builtin TimeoutError [core + helpers] (#109684) 2024-02-05 12:09:54 +01:00
Jan-Philipp BeneckeandGitHub d1aa690c24 Migrate non-component tests to use freezegun/freezer (#105142) 2023-12-07 22:58:09 +01:00
Erik MontnemeryandGitHub 1654ef7759 Make WS command render_template not give up if initial render raises (#99808) 2023-09-08 21:02:06 +02:00
Erik MontnemeryandGitHub 9dac6a2948 Use loop.time in DataUpdateCoordinator (#98937) 2023-08-28 10:16:34 -05:00
Marc MuellerandGitHub a9ade1f84d Use asyncio.timeout [core] (#98447) 2023-08-15 08:36:05 -05:00
Marc MuellerandGitHub f39a35c4ef Fix jinja2 DeprecationWarnings (#97728) 2023-08-04 11:25:08 +02:00
Marc MuellerandGitHub 995c29e052 Cleanup EventType typing (#97136) 2023-07-24 13:18:38 +02:00
Marc MuellerandGitHub 4161f53bea Improve async_track_state_change_filtered callback typing (#97134) 2023-07-24 12:42:29 +02:00
Marc MuellerandGitHub 582499a260 Improve async_track_template_result callback typing (#97135) 2023-07-24 12:42:17 +02:00
Marc MuellerandGitHub 797a9c1ead Improve async_track_state_added/removed_domain callback typing (#97126) 2023-07-24 09:11:41 +02:00
Marc MuellerandGitHub 2618bfc073 Use EventType for state changed [core] (#97115) 2023-07-23 18:10:03 -05:00
J. Nick KostonandGitHub 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 KostonandGitHub 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
epenetandGitHub 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 KostonandGitHub f4c341253b Avoid sorting domain/all states in templates (#90608) 2023-03-31 11:27:55 -10:00
J. Nick KostonandGitHub 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
epenetandGitHub 79c9447770 Fix lingering timer in event helper tests (#89819)
Fix lingering timer in event tests
2023-03-16 23:01:23 -04:00
epenetandGitHub 69aa3a75c5 Fix lingering timer in event sun tests (#89808) 2023-03-16 18:32:34 +01:00
epenetandGitHub 46a5aa71ec Add type hints to helper tests (#89784) 2023-03-16 11:10:56 +01:00
J. Nick KostonandGitHub 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
epenetandGitHub 5f25b71df7 Add type hints to core tests (#88478) 2023-02-20 11:42:56 +01:00
epenetandGitHub c98b4e3204 Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
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
epenetandGitHub 30bf0634fe Add per-file-ignore to pylint (#86289) 2023-01-22 17:26:24 +01:00
Franck NijhofandGitHub dd266b7119 Remove elevation warning from sun (#80239) 2022-10-14 15:23:44 +02:00
Franck NijhofandGitHub 8f4caf4141 Clean up accessing event helpers via hass (#72011) 2022-05-17 19:36:29 +02:00
Erik MontnemeryandGitHub 4885331509 Fail template functions when no default specified (#71687) 2022-05-13 09:46:49 -07:00
J. Nick KostonandGitHub 30fdfc454f Avoid lowercasing entities after template ratelimit recovery (#71415) 2022-05-09 12:48:38 +02:00