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

380 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 b3eb97adad Enable ruff RUF046 rule and remove unnecessary int() casts (#170514)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-13 23:50:44 +02:00
Artur Pragacz f5fef37210 Remove bind_hass usage (#168369) 2026-04-16 15:38:59 +02:00
Erik Montnemery b75af6d84a Mark Entity.async_write_ha_state as final (#166627) 2026-03-30 13:21:45 +02:00
Artur Pragacz 151eae4d5a Add compatibility layer for entities without has_entity_name to entity registry (#166246) 2026-03-24 20:22:15 +01:00
epenet 5e1a0e2152 Use annotationlib.get_annotations in entity helper (#165331) 2026-03-19 15:27:42 +01:00
Ariel Ebersberger eb17367229 Add DomainSpec to trigger and condition helpers (#165392) 2026-03-13 19:50:19 +01:00
Artur Pragacz 6ac0c163aa Improve group entities (#160860) 2026-03-10 17:34:52 +01:00
Artur Pragacz 578a933f30 Move entity name helper to module-level function (#162766) 2026-02-11 17:54:53 +01:00
Artur Pragacz c6064f40d2 Use same code path for friendly name as for entity ID (#161250) 2026-01-27 00:13:53 +01:00
Artur Pragacz 0130919128 Improve entity id generation (#160302) 2026-01-14 14:34:52 +01:00
Jan Bouwhuis 34d6938171 Fix subentry ID is not updated when renaming the entity ID (#157498) 2025-12-01 07:55:13 +01:00
Artur Pragacz 36268ffb73 Remove capability_attributes from CalculatedState (#151672) 2025-11-10 08:06:02 +01:00
Erik Montnemery dd399ef59f Refactor EntityPlatform (#147927) 2025-07-22 14:35:57 +02:00
Erik Montnemery 943fb9948b Adjust logic related to entity platform state (#147882)
* Adjust logic related to entity platform state

* Break up hard to read if-statement

* Add and improve tests
2025-07-02 14:57:53 +02:00
Erik Montnemery 91c3b43d7f Improve comment for helpers.entity.entity_sources (#146529) 2025-06-27 20:54:19 +02:00
G Johansson db3090078b Remove deprecated support feature values in camera (#146988) 2025-06-22 09:31:16 +02:00
Erik Montnemery e39edcc234 Remove unused attribute EntityInfo.custom_component (#146550) 2025-06-11 17:27:17 +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 d61e39743b Reduce ref counting in _async_write_ha_state (#143634)
* Reduce ref counting in _async_write_ha_state

It no longer makes sense to keep a temp reference
to entity_id and hass since the function was
refactored and there are very few accesses now.

* one more place we can reduce ref counts
2025-04-25 18:25:16 +02:00
J. Nick Koston cb0523660d Improve error logging when state is too long (#143636) 2025-04-24 18:37:32 -10:00
Joost Lekkerkerker dcc63a6f2e Bump ruff to 0.10.0 (#140541)
* Bump ruff to 0.10.0

* Bump ruff to 0.10.0

* Bump ruff to 0.10.0

* Bump ruff to 0.10.0

* Update pyproject.toml

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Fix

---------

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2025-03-14 12:32:50 +00:00
J. Nick Koston d97194303a Improve performance of calculating state (#138832)
```
print(timeit.timeit("x.update(y)", setup=x={a:b}
2025-02-19 09:43:41 +01:00
Ville Skyttä 40eb8b91cc Adjust to recommended propcache.api import paths (#136150) 2025-01-21 10:58:22 +01:00
Joost Lekkerkerker 8a35261fd8 Remove unused noqas (#135583) 2025-01-15 10:02:18 +01:00
Joost Lekkerkerker 8db63adc11 Bump ruff to 0.9.1 (#135197) 2025-01-14 11:46:12 +01:00
Franck Nijhof 00c052bb22 Revert "Remove deprecated supported features warning in ..." (multiple) (#134933) 2025-01-07 00:08:02 +01:00
epenet f2500e5a32 Remove deprecated supported features warning in MediaPlayer (#132365) 2024-12-09 23:03:55 +01:00
Abílio Costa 208b14dd2b Use translations on NumberEntity unit_of_measurement property (#132095)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-12-03 17:08:09 +01: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 0d447c9d50 Improve entity cached attributes (#128876) 2024-10-21 10:29:01 +02:00
J. Nick Koston 0f29fd3e10 Switch to using fast cached_property implementation in propcache (#127339) 2024-10-03 13:11:02 -05:00
J. Nick Koston e71f6c5948 Small speedup to processing entity customize (#121271) 2024-07-05 08:57:08 +02:00
J. Nick Koston cdb2ec4231 Small speed up to entity state calculation (#121273) 2024-07-05 08:56:20 +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 5ae13c2ae2 Make use_device_name a cached_property in the base entity class (#119758)
There is a small risk that _attr_name or entity_description
would not be set before state was first written, but that
would likely be a bug.
2024-06-18 21:52:36 -04:00
J. Nick Koston 62b1bde0e8 Only entity verify state writable once after success unless hass is missing (#118896) 2024-06-06 11:46:44 -05: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 ade0f94a20 Remove duplicate getattr call in entity wrap_attr (#118558) 2024-05-31 11:11:46 -04:00
J. Nick Koston e0264c8604 Replace pop calls with del where the result is discarded in entity (#118340) 2024-05-28 15:26:53 -10:00
Marc Mueller 900b6211ef Use PEP 695 for function annotations (2) (#117659) 2024-05-18 11:44:39 +02:00
Sid 2cc916db6d Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
J. Nick Koston 2401580b6f Make a copy of capability_attributes instead of making a new dict (#116477) 2024-04-30 17:54:33 -05:00
J. Nick Koston 164403de20 Add thread safety checks to async_create_task (#116339)
* Add thread safety checks to async_create_task

Calling async_create_task from a thread almost always results in an
fast crash. Since most internals are using async_create_background_task
or other task APIs, and this is the one integrations seem to get wrong
the most, add a thread safety check here

* Add thread safety checks to async_create_task

Calling async_create_task from a thread almost always results in an
fast crash. Since most internals are using async_create_background_task
or other task APIs, and this is the one integrations seem to get wrong
the most, add a thread safety check here

* missed one

* Update homeassistant/core.py

* fix mocks

* one more internal

* more places where internal can be used

* more places where internal can be used

* more places where internal can be used

* internal one more place since this is high volume and was already eager_start
2024-04-28 18:29:00 -04:00
J. Nick Koston ab2ea6100c Speed up singleton decorator so it can be used more places (#116292) 2024-04-28 12:11:08 -05:00
J. Nick Koston cbcfd71f3d Reduce number of time calls needed to write state (#116297) 2024-04-27 13:17:31 -05:00
J. Nick Koston f295172d07 Add a fast path for _stringify_state when state is already a str (#116295) 2024-04-27 10:48:17 -05:00
J. Nick Koston eea66921bb Avoid update call in entity state write if there is no customize data (#116296) 2024-04-27 10:48:05 -05:00
Sid e662e3b65c Bump ruff to 0.4.2 (#116201)
* Bump ruff to 0.4.2

* review comments
2024-04-26 08:48:32 +02:00