1787 Commits

Author SHA1 Message Date
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
Erik Montnemery
1c817cc18c
Attach relevant config to check_config errors (#104048) 2023-11-16 07:25:52 +01:00
Erik Montnemery
5b37096b5f
Refactor config.async_log_exception (#104034)
* Refactor config.async_log_exception

* Improve test coverage

* Make functions public
2023-11-15 19:09:49 +01:00
Erik Montnemery
dd7670cacf
Improve errors for component configuration with missing keys (#103982) 2023-11-15 10:47:05 +01:00
Erik Montnemery
94a2087ba0
Improve formatting of config validation errors (#103957)
* Improve formatting of config validation errors

* Address review comments
2023-11-14 12:48:45 +01:00
Erik Montnemery
dedd3418a1
Improve print of line numbers when there are configuration errors (#103216)
* Improve print of line numbers when there are configuration errors

* Update alarm_control_panel test
2023-11-14 08:21:36 +01:00
Erik Montnemery
07af073735
Remove trailing space from configuration error messages (#103909)
* Remove trailing space from configuration error messages

* Update test
2023-11-13 15:19:37 +01:00
Erik Montnemery
01b3e0c49e
Remove useless code from entity helper tests (#103854) 2023-11-12 18:55:34 +01:00
Allen Porter
787fb3b954
Improve OAuth error handling in configuration flows (#103157)
* Improve OAuth error handling in configuration flows

* Update strings for all integrations that use oauth2 config flow

* Remove invalid_auth strings

* Revert change to release

* Revert close change in aiohttp mock
2023-11-11 11:02:51 +01:00
Franck Nijhof
70ad5ab3e4
Update helper tests to use device & entity registry fixtures (#103710) 2023-11-10 09:32:19 +01:00
Erik Montnemery
123f14dd6c
Attach correct platform config in check_config warnings and errors (#103633) 2023-11-09 00:06:04 +01:00
Erik Montnemery
d913508607
Allow removing an entity more than once (#102904) 2023-11-08 12:50:40 +01:00
Erik Montnemery
cc5eda76d3
Humanize core config errors in check_config helper (#103635) 2023-11-08 10:15:27 +01:00
Erik Montnemery
3ba8a82243
Differentiate between warnings and errors in check_config helper (#102902)
* Differentiate between warnings and errors in check_config helper

* Update tests

* Treat configuration errors in frontend and its dependencies as errors

* Improve test coverage

* Address review comments

* Improve test coverage

* Improve test coverage

* Address review comments

* Add comment
2023-11-05 03:08:04 +01:00
Jan-Philipp Benecke
ae1117bc74
Fix failing entity reuse test (#103342)
* Fix failing entity reuse test

* One more test
2023-11-03 23:19:37 +01:00
Erik Montnemery
0ea0a1ed06
Prevent accidentally reusing an entity object (#102911)
* Prevent accidentally reusing an entity object

* Fix group reload service

* Revert "Fix group reload service"

* Improve test

* Add tests aserting entity can't be reused
2023-11-03 21:01:38 +01:00
Paul Bottein
89a9e6c6e8
Add trigger selector for blueprint (#103050) 2023-11-03 09:11:49 +01:00
Kevin Stillhammer
06c9719cd6
Support multiple responses for service calls (#96370)
* add supports_response to platform entity services

* support multiple entities in entity_service_call

* support legacy response format for service calls

* revert changes to script/shell_command

* add back test for multiple responses for legacy service

* remove SupportsResponse.ONLY_LEGACY

* Apply suggestion

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* test for entity_id remove None

* revert Apply suggestion

* return EntityServiceResponse from _handle_entity_call

* Use asyncio.gather

* EntityServiceResponse not Optional

* styling

---------

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2023-11-02 18:37:35 -07:00
Erik Montnemery
03d3a87f23
Small cleanup of legacy groups (#102918)
* Small cleanup of legacy groups

* Update tests which create groups
2023-10-28 17:16:41 +02:00
Erik Montnemery
6f515c06a2
Add test for check_config helper (#102898) 2023-10-28 14:52:20 +02:00
Erik Montnemery
294f565bad
Allow missing components in safe mode (#102888) 2023-10-27 12:25:27 +02:00