1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-30 04:05:01 +01:00
Commit Graph

606 Commits

Author SHA1 Message Date
Franck Nijhof eae809abd1 Fix line length violations in core and helpers (#170534)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-14 16:31:01 -04:00
Franck Nijhof 555d838290 Enable ruff B010 rule and replace setattr with direct attribute assignmet (#170527) 2026-05-13 23:39:32 +02:00
epenet 7169d52010 Remove import annotations from core (#169547) 2026-04-30 20:34:43 +02:00
Ariel Ebersberger 533871babb Optimize add_job to skip double-deferral for @callback targets (#168198) 2026-04-15 18:50:33 +02:00
Ariel Ebersberger ecb814adb0 Add test coverage for add_job and fix docstring (#168291) 2026-04-15 16:17:01 +02:00
epenet 1c59d846e3 Cleanup unnecessary brackets for except statements (core) (#162410) 2026-02-06 13:45:59 +01:00
rlippmann 9da07c2058 remove domain and service slots from Service object (#160039) 2025-12-31 13:34:02 +01:00
epenet 1e09bddb1d Cleanup deprecated alias in core (#158799) 2025-12-13 09:29:15 +01:00
Jan Bouwhuis 10299b2ef4 Add description placeholders to service translation strings (#154984)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-11-26 09:54:22 +01:00
G Johansson d40eeee422 Remove deprecated ConfigSource from core (#154112) 2025-10-10 18:23:13 +02:00
Erik Montnemery 1743766d17 Add last_reported to state reported event data (#148932) 2025-07-18 13:53:30 +02:00
Marc Mueller 80eb4fb2f6 Replace asyncio.iscoroutinefunction (#148738) 2025-07-14 20:24:32 +01:00
Joakim Sørensen 699c60f293 Add the current version to the starting log to aid troubleshooting (#148271) 2025-07-06 19:06:27 +02:00
Marc Mueller 2c13c70e12 Update ruff to 0.12.0 (#147106) 2025-06-19 20:39:09 +02:00
Joost Lekkerkerker 4cd3527761 Enable B009 (#144192) 2025-05-21 16:37:51 +01:00
J. Nick Koston 34d17ca458 Move state length validation to StateMachine APIs (#143681)
* Move state length validation to StateMachine async_set method

We call validate_state to make sure we do not allow any states
into the state machine that have a length>255 so we do not break
the recorder. Since async_set_internal already requires callers
to pre-validate the state, we can move the check to async_set
instead of at State object creation time to avoid needing to
check it twice in the hot path (entity write state)

* move check in async_set_internal so it only happens on state change

* no need to check if same_state
2025-04-25 21:15:15 -04:00
J. Nick Koston 03950f270a Remove lower call in async_reserve (#143682)
async_reserve is only called from the the entity_platform helper
which already ensures the entity_id is validated and in lower
case.
https://github.com/home-assistant/core/blob/a783b6a0abda02b26e193356c4f3db8b86e13b86/homeassistant/helpers/entity_platform.py#L936
2025-04-25 21:12:55 -04:00
Robert Resch 199a274c80 Remove deprecated hass.helpers (#143514) 2025-04-23 17:24:25 +02:00
Jan-Philipp Benecke f22eca3d9e Remove deprecated hass.components (#141947) 2025-04-23 14:04:36 +02:00
Erik Montnemery 93162f6b65 Mark Event and HassJob with @final (#142055) 2025-04-02 14:04:48 +02:00
J. Nick Koston 0d511c697c Improve performance of as_compressed_state (#141800)
We have to build all of these at startup.

Its a lot faster to compare floats instead
of datetime objects. Since we already have to
fetch last_changed_timestamp, use it to compare
with last_updated_timestamp since we already know
we will have last_updated_timestamp
2025-03-30 22:20:24 +02:00
Ville Skyttä 40eb8b91cc Adjust to recommended propcache.api import paths (#136150) 2025-01-21 10:58:22 +01:00
Joost Lekkerkerker ef8b8fbbaa Enable RUF023 (#135830) 2025-01-17 12:28:27 +01:00
Franck Nijhof 60bdc13c94 Drop Python 3.12 support (#135589) 2025-01-14 16:23:15 +01:00
epenet 5df7092f41 Improve formatting in core files (#135256)
* Adjust core files formatting

* Adjust translations script
2025-01-10 09:08:37 +01:00
epenet 899fb091fc Simplify access to hass in service calls (#133062) 2024-12-13 09:31:21 +01:00
Robert Resch be81fd86d3 Remvove deprecated core constants (#131803) 2024-11-28 11:06:04 +01:00
epenet 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
epenet a3b0909e3f Add new frame helper to better distinguish custom and core integrations (#130025)
* Add new frame helper to clarify options available

* Adjust

* Improve

* Use report_usage in core

* Add tests

* Use is/is not

Co-authored-by: J. Nick Koston <nick@koston.org>

* Use enum.auto()

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-11-07 18:23:35 +01:00
Erik Montnemery 1c6ad2fa66 Allow importing homeassistant.core.Config until 2025.11 (#129537) 2024-10-30 22:56:59 +01:00
Erik Montnemery 4b56701152 Move core config class to core_config.py (#129163) 2024-10-26 07:00:31 +02:00
Robert Resch 3512cb9599 Use webrtc-models package (#129032) 2024-10-25 10:18:55 +02:00
Erik Montnemery 3e62c6ae2f Move core config functionality to its own module (#129065)
* Move core config functionality to its own module

* Adjust test
2024-10-24 13:34:51 +02:00
Erik Montnemery 487593af38 Allow configuring WebRTC stun and turn servers (#128984)
* Allow configuring WebRTC stun and turn servers

* Add tests

* Remove class WebRTCCoreConfiguration
2024-10-23 14:41:45 +02:00
J. Nick Koston db494de809 Restore __slots__ to core objects (#127441) 2024-10-03 22:23:47 +02:00
J. Nick Koston 0f29fd3e10 Switch to using fast cached_property implementation in propcache (#127339) 2024-10-03 13:11:02 -05:00
Erik Montnemery 6c01e4b99c Use BaseEventLoop._thread_id instead of a custom attribute (#124054)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-17 10:59:39 +02:00
J. Nick Koston b15ea58851 Relocate code to get scheduled TimerHandles (#123546) 2024-08-12 09:15:33 +02:00
Erik Montnemery d1264655a0 Fix some typos in core.py (#121189) 2024-07-04 13:04:52 +02:00
J. Nick Koston 48172b0426 Small speed up to writing entity state (#121043) 2024-07-03 12:16:41 -05:00
J. Nick Koston 852bb19223 Cleanup db_schema from_event constructors (#120803) 2024-06-29 07:49:16 -05:00
Erik Montnemery 3895252965 Fix docstring for EventStateEventData (#120662) 2024-06-27 08:00:14 -05:00
Erik Montnemery a165064e9d Improve typing of state event helpers (#120639) 2024-06-27 06:08:19 -05:00
Erik Montnemery d589eaf440 Simplify EVENT_STATE_REPORTED (#120508) 2024-06-26 11:23:26 +02:00
Marc Mueller b4eee166aa Add voluptuous type aliases (#120399) 2024-06-25 11:58:27 +02:00
Erik Montnemery 7e61ec96e7 Make the radius of the home zone configurable (#119385) 2024-06-15 13:22:01 +02:00
Erik Montnemery 904b89df80 Allow importing typing helper in core files (#119377)
* Allow importing typing helper in core files

* Really fix the circular import

* Update test
2024-06-11 13:48:12 +02:00
J. Nick Koston f9205cd88d Avoid additional timestamp conversion to set state (#118885)
Avoid addtional timestamp conversion to set state

Since we already have the timestamp, we can pass it on to the State
object and avoid the additional timestamp conversion which can be as
much as 30% of the state write runtime.

Since datetime objects are limited to microsecond precision, we need
to adjust some tests to account for the additional precision that we
will now be able to get in the database
2024-06-05 23:43:34 -04:00
J. Nick Koston 475c20d529 Always do thread safety check when writing state (#118886)
* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* async_fire is more common than expected with ccs

* fix mock

* fix hass mocking
2024-06-05 23:41:55 -04:00
J. Nick Koston 76aa504e36 Fix last_reported_timestamp not being updated when last_reported is changed (#118341)
* Reduce number of calls to last_reported_timestamp

When a state is created, last_update is always the same
as last_reported, and we only update it later if it changes
so we can pre-set the cached property to avoid it being
run when the recorder accesses it later.

* fix cache not being overridden

* coverage
2024-05-28 19:03:19 -10:00