Commit graph

1357 commits

Author SHA1 Message Date
Michael Hansen
269500cb29
Report missing entities/areas instead of failing to match in Assist (#107151)
* Report missing entities/areas instead of failing

* Fix test

* Update assist pipeline test snapshots

* Test complete match failure

* Fix conflict
2024-01-04 17:09:20 -06:00
J. Nick Koston
0695bf8988
Move group helpers into their own module (#106924)
This gets rid of the legacy need to use bind_hass, and
the expand function no longer looses typing.
2024-01-04 17:34:56 +01:00
Erik Montnemery
9eefd95e91
Deduplicate handling of duplicated constants (#107074)
* Deduplicate handling of duplicated constants

* Use DeprecatedConstant + DeprecatedConstantEnum

* Fixup

* Remove test cases with unnamed tuples
2024-01-04 13:25:09 +01:00
Michael
eb01998395
Add support for placeholders in entity name translations (#104453)
* add placeholder support to entity name translation

* add negativ tests

* make property also available via description

* fix doc string in translation_placeholders()

* fix detection of placeholder

* validate placeholders for localized strings

* add test

* Cache translation_placeholders property

* Make translation_placeholders uncondotionally return dict

* Fall back to unsubstituted name in case of mismatch

* Only replace failing translations with English

* Update snapshots

* Blow up on non stable releases

* Fix test

* Update entity.py

---------

Co-authored-by: Erik <erik@montnemery.com>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-01-03 17:34:47 +01:00
J. Nick Koston
09b65f14b9
Index entities by domain for entity services (#106759) 2024-01-02 15:28:58 +01:00
Erik Montnemery
599271fdc0
Don't use entity_id in __repr__ of not added entity (#106861) 2024-01-02 11:35:16 +01:00
Erik Montnemery
c1f1b5c50b
Ensure it's safe to call Entity.__repr__ on non added entity (#106032) 2023-12-31 18:54:34 +01:00
Erik Montnemery
461dad3039
Fix changed_variables in automation traces (#106665) 2023-12-30 08:34:21 +01:00
Erik Montnemery
56a58f9285
Improve tests of inheriting entity descriptions (#106647) 2023-12-29 13:22:52 +01:00
J. Nick Koston
a46fe94216
Add helper to report deprecated entity supported features magic numbers (#106602) 2023-12-28 12:24:36 -10:00
Martijn van der Pol
a823edf1c2
Jinja filter and function for median and statistical_mode (#105554)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-12-27 15:14:20 +01:00
Robert Resch
fbcb31b103
Deprecate deprecated unit of measurement constants (#106455) 2023-12-27 09:04:25 +01:00
Marc Mueller
c6d1f1ccc8
Fix pytest test collection warning (#106405) 2023-12-26 16:23:19 +01:00
Robert Resch
ebdf7b9c8c
Deprecate some deprecated const constants (#106230)
* Deprecate some deprecated const constants

* Improve code

* fix typing

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-12-23 20:18:51 +01:00
Erik Montnemery
3a744d374b
Add support for caching entity properties (#100601) 2023-12-22 09:02:55 -10:00
Robert Resch
e18d2b8873
Deprecate deprecated device_registry helper constants (#106227) 2023-12-22 11:21:45 +01:00
Robert Resch
c4c422de79
Skip logging deprecated constant if the calling integration couldn't be indentified (#106181)
* Add option to log only if a integreation is detected for a deprecated constant

* Require param

* Add test that log entry is not created

* typo
2023-12-21 23:19:40 +01:00
Erik Montnemery
0534b0dee4
Improve entity tests (#106175) 2023-12-21 15:32:25 +01:00
Ville Skyttä
24b1e01d71
Update Ruff to 0.1.8, avoid linter/formatter conflicts (#106080)
* Disable Ruff rules that may conflict with the formatter

* Upgrade Ruff to 0.1.8

- https://github.com/astral-sh/ruff/releases/tag/v0.1.7
- https://github.com/astral-sh/ruff/releases/tag/v0.1.8

* Format with Ruff 0.1.8
2023-12-20 23:55:09 +01:00
Robert Resch
5a3db078d5
Use patch.dict in deprecation test "test_check_if_deprecated_constant" (#106117) 2023-12-20 16:06:26 +01:00
Robert Resch
0e0fd39603
Add dir_with_deprecated_constants function to deprecation helper (#106059) 2023-12-19 16:37:21 +01:00
Robert Resch
a4ccd6e13b
Deprecate binary sensor device class constants (#105736)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-12-19 12:45:32 +01:00
Michael
29e30e796a
Add significant change helper check_valid_float (#106005) 2023-12-18 21:59:30 +01:00
Erik Montnemery
2515e520c1
Allow step size any for number selector in slider mode (#105978) 2023-12-18 15:30:59 +01:00
J. Nick Koston
47f8e08261
Reduce overhead to connect dispatcher (#105715)
Reduce overhead connect dispatcher

- We tend to have 1000s (or 10000s) of connected dispatchers which
  makes these prime targets to reduce overhead/memory

- Instead of creating new functions to wrap log exceptions each time
  use partials which reuses the function body and only create new
  arguments

Previous optimizations #103307 #93602
2023-12-16 10:16:58 +01:00
Erik Montnemery
9020dbb093
Remove context_recent_time property from entity base class (#105652) 2023-12-14 08:33:31 +01:00
Erik Montnemery
dd5a48996a
Keep capabilities up to date in the entity registry (#101748)
* Keep capabilities up to date in the entity registry

* Warn if entities update their capabilities very often

* Fix updating of device class

* Stop tracking capability updates once flooding is logged

* Only sync registry if state changed

* Improve test

* Revert "Only sync registry if state changed"

This reverts commit 1c52571596c06444df234d4b088242b494b630f2.

* Avoid calculating device class twice

* Address review comments

* Revert using dataclass

* Fix unintended revert

* Add helper method
2023-12-13 17:27:26 +01:00
Erik Montnemery
22c3847c0e
Allow inheriting FrozenOrThawed with custom init (#105624) 2023-12-13 10:13:34 +01:00
Erik Montnemery
5bd0833f49
Improve FrozenOrThawed (#105541) 2023-12-12 21:19:41 +01:00
Erik Montnemery
dd338799d4
Make it possible to inherit EntityDescription in frozen and mutable dataclasses (#105211) 2023-12-11 20:00:55 +01:00
Jan Bouwhuis
4bb0e13cda
Workaround to_json template filter in parsing dict key (#105327)
* Work-a-round orjson for `to_json` fiter in case dict key is str subclass

* Add option instead

* Remove json.dumps work-a-round

* Update homeassistant/helpers/template.py

* Fix test

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-12-08 20:57:53 +01:00
Jan-Philipp Benecke
d1aa690c24
Migrate non-component tests to use freezegun/freezer (#105142) 2023-12-07 22:58:09 +01:00
Erik Montnemery
3bcc6194ef
Add domain key config validation (#104242)
* Drop use of regex in helpers.extract_domain_configs

* Update test

* Revert test update

* Add domain_from_config_key helper

* Add validator

* Address review comment

* Update snapshots

* Inline domain_from_config_key in validator
2023-12-05 15:07:32 +01:00
Erik Montnemery
25bea91683
Use modern platform path when reporting platform config errors (#104238)
* Use modern platform path when reporting platform config errors

* Update tests

* Address review comment

* Explicitly pass platform domain to log helpers

* Revert overly complicated changes

* Try a simpler solution
2023-12-05 15:06:13 +01:00
Erik Montnemery
84e74e4c74
Reverse component path (#104087)
* Reverse component path

* Update translations helper

* Fix

* Revert incorrect change of PLATFORM_FORMAT

* Fix use of PLATFORM_FORMAT in tts

* Fix ios
2023-12-05 08:43:58 +01:00
Erik Montnemery
35e2f591c1
Make cv.string return subclasses of str as is (#103916) 2023-12-04 20:36:16 +01:00
Erik Montnemery
95f7db1970
Move config_per_platform and extract_domain_configs to config.py (#104989) 2023-12-04 12:48:49 +01:00
Erik Montnemery
db51a8e1f7
Allow passing breaks_in_ha_version to deprecation helper decorators (#104985) 2023-12-04 11:52:10 +01:00
J. Nick Koston
1522118453
Remove aiohttp cancel on disconnect workaround (#104175) 2023-11-29 11:20:36 -07:00
Paul Bottein
38eda9f46e
Add multiple option to text selector (#104635)
Co-authored-by: Robert Resch <robert@resch.dev>
2023-11-29 18:32:32 +01:00
schelv
31cab5803c
Add Option For Kelvin Unit To Color Temperature Selector (#103799) 2023-11-29 12:25:06 +01:00
Aarni Koskela
706add4a57
Switch formatting from black to ruff-format (#102893)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:38:59 +01:00
Jan Bouwhuis
af71c2bb45
Raise and suppress stack trace when reloading yaml fails (#102410)
* Allow async_integration_yaml_config to raise

* Docstr - split check

* Implement as wrapper, return dataclass

* Fix setup error handling

* Fix reload test mock

* Move log_messages to error handler

* Remove unreachable code

* Remove config test helper

* Refactor and ensure notifications during setup

* Remove redundat error, adjust tests notifications

* Fix patch

* Apply suggestions from code review

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Follow up comments

* Add call_back decorator

* Split long lines

* Update exception abbreviations

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-24 17:34:45 +01:00
Erik Montnemery
a573f60947
Rename some check_config test cases (#104244) 2023-11-20 13:02:44 +01:00
Erik Montnemery
80813e992d
Improve formatting of component errors (#104081)
* Improve formatting of component errors

* Update tests
2023-11-17 23:01:00 +01:00
Erik Montnemery
a78764f000
Improve formatting of package errors (#104078) 2023-11-17 14:57:37 +01:00
Erik Montnemery
4536fb3541
Remove mock_entity_platform test helper (#104073) 2023-11-16 16:55:08 +01:00
Erik Montnemery
b400b33b0d
Refer to domain configuration in custom validator errors (#104065) 2023-11-16 15:28:48 +01:00
Erik Montnemery
d8a49b14e5
Use relative paths in configuration validation error messages (#104064) 2023-11-16 10:56:47 +01:00
Erik Montnemery
98030a9ce1
Improve formatting of package errors (#103976) 2023-11-16 09:08:47 +01:00