Piotr Machowski
a2f4e99994
Add state_translated function to jinja templates ( #96906 )
...
* Add state_translated jinja function
* Add tests for load_state_translations_to_cache and get_cached_translations
* Cleanup state_translated template
* Add tests for state_translated jinja function
* Apply black formatting
* Improve code quality
* Apply suggestions from code review
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Apply suggestions from code review
* Prevent invalid components from loading translations
* Refactor loading translations to cache
* Adjust code issues
* Update homeassistant/helpers/translation.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Refactor listeners that trigger translation loading
* Apply suggestions from code review
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Apply suggestions from code review
* Adjust invalid function calls, fix code styling
* Adjust code quality
* Extract async_translate_state function
* Apply suggestions from code review
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Apply suggestions from code review
* Fix tests
* Fix tests
---------
Co-authored-by: Piotr Machowski <PiotrMachowski@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-02-10 10:47:56 +01:00
J. Nick Koston
f6d4617c7a
Avoid directly changing config entry state in tests (part 2) ( #110115 )
...
followup to #110048 for more places
2024-02-10 07:20:15 +01:00
Joost Lekkerkerker
59e9010b65
Show domain in oauth2 error log ( #109708 )
...
* Show token url in oauth2 error log
* Fix tests
* Use domain
2024-02-06 23:03:35 +01:00
J. Nick Koston
09c609459d
Fix entity services targeting entities outside the platform when using areas/devices ( #109810 )
2024-02-06 12:41:57 -06:00
Marc Mueller
cd0ee98dba
Use builtin TimeoutError [core + helpers] ( #109684 )
2024-02-05 12:09:54 +01:00
J. Nick Koston
9fef1938b4
Make get_entries_for_device_id skip disabled devices by default ( #109645 )
2024-02-04 23:11:56 +01:00
Erik Montnemery
09ba46ddb9
Mask sensitive data in google_assistant logs ( #109366 )
...
* Mask sensitive data in google_assistant logs
* Move common code to homeassistant/util/redact.py
* Move to helpers
* Add tests
* Tweak
* Redact additional logs
* Fix stale docstring
* Don't reveal the length of masked data
* Update test
2024-02-02 22:10:30 +01:00
J. Nick Koston
ed726db974
Fix race in loading service descriptions ( #109316 )
2024-02-01 12:34:23 -06:00
Bram Kragten
d361d47516
Add qr code selector ( #109214 )
2024-01-31 19:27:03 +01:00
Martijn van der Pol
b386960661
Add default parameter to as_datetime template function/filter ( #107229 )
...
* improve as_datetime
* Improve `as_datetime` Jinja filter/function
* review
* resolve more review items
* change test for datetime input
* Update docstring
* update docstrings for tests
* remove whitespace
* only_default
* Update do string and comment
* improve comment
* Adjust comment
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-01-29 18:05:44 +01:00
Erik Montnemery
8abb4e5f52
Improve display of errors with no message in script trace ( #108735 )
2024-01-28 19:27:14 +01:00
karwosts
a2d707442a
Fix error when passing a whole number to location selector ( #108952 )
...
* Fix error when passing an integer to location selector
* fix tests
* more fix tests
* don't mutate original dict
* remove string testcase
2024-01-28 14:13:00 +01:00
Erik Montnemery
909e58066d
Fix changed_variables in automation and script traces ( #108788 )
2024-01-24 19:12:45 +01:00
Erik Montnemery
9c727e5ea8
Add icon to areas ( #108650 )
2024-01-24 19:11:03 +01:00
Erik Montnemery
431e4b38ac
Improve tests of script trace ( #108733 )
2024-01-24 15:29:35 +01:00
Daniel
a67113a95a
Parse template result in async_render_with_possible_json_value ( #99670 )
...
* Optionally parse templates rendered with possible json
* Remove duplicate strip
* Add tests for parsing template result
2024-01-24 12:12:28 +01:00
Erik Montnemery
069c2b7e38
Improve tests of script trace ( #108717 )
...
* Improve tests of script trace
* Update tests after rebase
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Apply suggestions from code review
* Adjust
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-01-23 19:53:09 +01:00
Erik Montnemery
9bff039d17
Add set_conversation_response script action ( #108233 )
...
* Add set_conversation_response script action
* Update homeassistant/components/conversation/trigger.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Revert accidental change
* Add test
* Ignore mypy
* Remove incorrect callback decorator
* Update homeassistant/helpers/script.py
* Add test with templated set_conversation_response
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-01-23 09:13:42 -05:00
Franck Nijhof
01372024f5
Add icon translations support ( #103294 )
...
Co-authored-by: Robert Resch <robert@resch.dev>
Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
2024-01-19 16:56:56 +01:00
J. Nick Koston
c399cab427
Small speed up to checking core state ( #107845 )
2024-01-18 08:41:32 -10:00
J. Nick Koston
454c62b5b4
Avoid total_seconds conversion every state write when context is set ( #107617 )
2024-01-13 21:04:32 -05:00
J. Nick Koston
4b7a313ece
Use identity checks for CoreState ( #107846 )
...
Some of the checks used ==, and some used is. Switch
everything to is as its faster
2024-01-12 10:21:26 +01:00
Erik Montnemery
8a9f9b94ef
Fix call to async_setup_component in translation test ( #107807 )
2024-01-11 10:09:32 -10:00
Lars R
bf6b9175a1
Add 'bitwise_xor' filter to jinja templates ( #104942 )
...
Co-authored-by: Robert Resch <robert@resch.dev>
2024-01-10 09:40:52 +01:00
Erik Montnemery
9859306718
Prevent overriding cached attribute as property ( #107657 )
...
* Prevent overriding cached attribute as property
* Remove debug
2024-01-09 19:16:45 +01:00
Marc Mueller
fde7a6e9ef
Improve dispatcher typing ( #106872 )
2024-01-08 09:45:37 +01:00
J. Nick Koston
d260ed938a
Reduce overhead to call entity services ( #106908 )
2024-01-08 09:30:52 +01:00
J. Nick Koston
d04e2d56da
Add support for JSON fragments ( #107213 )
2024-01-07 17:36:31 -10:00
Erik Montnemery
c805ea7b4f
Include deprecated constants in wildcard imports ( #107114 )
2024-01-05 11:46:45 +01:00
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
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
Erik Montnemery
b83ada8c19
Use real devices in automation and script tests ( #102785 )
2023-10-25 16:09:39 +02:00