Commit Graph

1239 Commits (a0b61a1188123b29e539d9811ae71cba9c1615d8)

Author SHA1 Message Date
Franck Nijhof b655b9d530
Allow for translating service examples (#97141) 2023-07-24 15:57:02 +02:00
Marc Mueller 995c29e052
Cleanup EventType typing (#97136) 2023-07-24 13:18:38 +02:00
Marc Mueller 4161f53bea
Improve `async_track_state_change_filtered` callback typing (#97134) 2023-07-24 12:42:29 +02:00
Marc Mueller 582499a260
Improve `async_track_template_result` callback typing (#97135) 2023-07-24 12:42:17 +02:00
Marc Mueller 797a9c1ead
Improve `async_track_state_added/removed_domain` callback typing (#97126) 2023-07-24 09:11:41 +02:00
Marc Mueller 2618bfc073
Use EventType for state changed [core] (#97115) 2023-07-23 18:10:03 -05:00
Jan Bouwhuis 9424d11408
Allow homeassistant in MQTT configuration_url schema (#96107) 2023-07-22 22:50:58 +02:00
Erik Montnemery df46179d26
Fix broken service test (#96943) 2023-07-20 13:11:55 +02:00
Joost Lekkerkerker 0ba2531ca4
Fix bug in check_config when an integration is removed by its own validator (#96068)
* Raise if present is False

* Fix feedback

* Update homeassistant/helpers/check_config.py

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

* Update homeassistant/helpers/check_config.py

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

* Fix tests

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-20 11:45:44 +02:00
J. Nick Koston 01e66d6fb2
Improve handling of unrecoverable storage corruption (#96712)
* Improve handling of unrecoverable storage corruption

fixes #96574

If something in storage gets corrupted core can boot loop
or if its integration specific, the integration will fail to
start.

We now complainly loudly in the log, move away the corrupt data
and start fresh to allow startup to proceed so the user can
get to the UI and restore from backup without having to attach
a console (or otherwise login to the OS and manually modify files).

* test for corruption

* ensure OSError is still fatal

* one more case

* create an issue for corrupt storage

* fix key

* persist

* feedback

* feedback

* better to give the full path

* tweaks

* grammar

* add time

* feedback

* adjust

* try to get issue_domain from storage key

* coverage

* tweak wording some more
2023-07-19 09:23:12 +02:00
Paul Bottein d8c989f732
Make default theme selectable for set theme service (#96849) 2023-07-18 17:36:35 +02:00
Franck Nijhof b9f92b526b
Add prefix support to text selector (#96830) 2023-07-18 12:17:31 +02:00
J. Nick Koston bc6a41fb94
Remove deprecated state.get_changed_since (#96579) 2023-07-18 09:42:48 +02:00
J. Nick Koston 7ec506907c
Ensure async_get_system_info does not fail if supervisor is unavailable (#96492)
* Ensure async_get_system_info does not fail if supervisor is unavailable

fixes #96470

* fix i/o in the event loop

* fix tests

* handle some more failure cases

* more I/O here

* coverage

* coverage

* Update homeassistant/helpers/system_info.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* remove supervisor detection fallback

* Update tests/helpers/test_system_info.py

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-07-16 11:10:07 -04:00
Erik Montnemery 614f3c6a15
Move device info validation to device registry (#96465)
* Move device info validation to device registry

* Don't move DeviceInfo

* Fix type annotation

* Don't block adding device for unknown config entry

* Fix test

* Remove use of locals()

* Improve error message
2023-07-14 08:55:17 -04:00
Erik Montnemery 7539cf25be
Don't require passing identifiers to DeviceRegistry.async_get_device (#96479)
* Require keyword arguments to DeviceRegistry.async_get_device

* Update tests

* Update tests

* Don't enforce keyword arguments
2023-07-13 13:39:25 -04:00
J. Nick Koston 08af42b00e
Fix mixed case service schema registration (#96448) 2023-07-12 14:39:51 -10:00
Paul Bottein e513b7d0eb
Add condition selector for blueprint (#96350)
* Add condition selector for blueprint

* Add tests and validation

* Update comment
2023-07-12 10:58:35 -04:00
Franck Nijhof 594d240a96
Migrate & fix logger services to support translations (#96393)
* Migrate logger services to support translations

* Fix tests and schema validation

* Apply suggestions from code review

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
2023-07-12 10:37:18 -04:00
Franck Nijhof f054de0ad5
Add support for service translations (#95984) 2023-07-11 15:52:12 +02:00
Paulus Schoutsen eee8566694
Differentiate between device info types (#95641)
* Differentiate between device info types

* Update allowed fields

* Update homeassistant/helpers/entity_platform.py

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

* Split up message in 2 lines

* Use dict for device info types

* Extract device info function and test error checking

* Simplify parsing device info

* move checks around

* Simplify more

* Move error checking around

* Fix order

* fallback config entry title to domain

* Remove fallback for name to config entry domain

* Ensure mocked configuration URLs are strings

* one more test case

* Apply suggestions from code review

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

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-07-10 09:56:06 -04:00
Erik Montnemery 3d064b7d6b
Add filters to cover/services.yaml (#95854) 2023-07-08 11:51:02 +02:00
Jan Bouwhuis 18ee9f4725
Refactor async_get_hass to rely on threading.local instead of a ContextVar (#96005)
* Test for async_get_hass

* Add Fix
2023-07-07 14:52:38 -04:00
Erik Montnemery 86a397720f
Move platform_integration_no_support issue to the homeassistant integration (#95927)
* Move platform_integration_no_support issue to the homeassistant integration

* Update test

* Improve repair text

* Update test
2023-07-07 13:31:54 +02:00
J. Nick Koston b7b8afffd0
Handle integrations with empty services or failing to load during service description enumeration (#95911)
* wip

* tweaks

* tweaks

* add coverage

* complain loudly as we never execpt this to happen

* ensure not None

* comment it
2023-07-06 11:19:06 -04:00
Jan Bouwhuis b9c7e7c15e
Fix not including device_name in friendly name if it is None (#95485)
* Omit device_name in friendly name if it is None

* Fix test
2023-07-06 11:14:09 -04:00
Bram Kragten 342d07cb92
Set correct `response` value in service description when `async_set_service_schema` is used (#95985)
* Mark scripts as response optional, make it always return a response if return_response is set

* Update test_init.py

* Revert "Update test_init.py"

This reverts commit 8e113e54db.

* Split + add test
2023-07-06 10:24:34 -04:00
J. Nick Koston b2e708834f
Add slots to the StateMachine class (#95849) 2023-07-05 14:00:37 +02:00
J. Nick Koston b24c6adc75
Avoid regex for negative zero check in sensor (#95691)
* Avoid regex for negative zero check in sensor

We can avoid calling the regex for every sensor value
since most of the time values are not negative zero

* tweak

* tweak

* Apply suggestions from code review

* simpler

* cover

* safer and still fast

* safer and still fast

* prep for py3.11

* fix check

* add missing cover

* more coverage

* coverage

* coverage
2023-07-02 21:53:50 -04:00
Paulus Schoutsen e4f617e92e
Update log message when referenced entity not found (#95577)
* Update log message when referenced entity not found

* Update homeassistant/helpers/service.py

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

* Update test

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-07-02 00:04:03 +02:00
Paulus Schoutsen 9280dc69ae
Default device name to config entry title (#95547)
* Default device name to config entry title

* Only apply name default if device info provided

* Fix logic detecting type of device info
2023-06-30 13:54:20 -04:00
Bram Kragten a7dfe46fb1
Add conversation agent selector, use in `conversation.process` service (#95462) 2023-06-28 21:38:06 -04:00
Paulus Schoutsen 243abf32c0
Add test to stop action (#95376) 2023-06-27 19:38:30 +02:00
Franck Nijhof 3e85a29b86
Move overlapping pylint rules to ruff, disable mypy overlap (#94359) 2023-06-27 17:42:46 +02:00
Erik Montnemery 071d3a474f
Base entity ids on English for languages not using Latin script (#91357) 2023-06-27 14:37:50 +02:00
Paulus Schoutsen d95c241a1a
Add service response values to service descriptions (#95262) 2023-06-26 12:57:43 -04:00
Erik Montnemery 8fda56d2c9
Stable entity registry id when a deleted entity is restored (#77710)
* Stable entity_id and registry id when a deleted entity is restored

* Don't restore area_id

* Don't restore entity_id

* Address review comments
2023-06-26 15:54:35 +02:00
J. Nick Koston 9051750add
Cache entity translation lookups and keys (#95180) 2023-06-25 08:50:48 -05:00
Allen Porter 528c206094
Add script specific error messages for `response_variable` (#95188) 2023-06-24 21:34:57 -07:00
Allen Porter b9b5fe6be8
Add service response data for listing calendar events (#94759)
* Add service response data for listing calendar events

Add the capability of response data for for the entity component.

* Rename input arguments and add service description

* Improve list events to be more user friendly

Allow the end date to be determined based on a relative time duration. Make the start time optional and set to "now". Add additional test coverage. Update demo calendar to actually perform date range checks.

* Wrap docstrings properly.

* Increase test coverage

* Update to use new API calls

* Readability improvements

* Wrap docstrings

* Require at least one of end or duration

* Check for multiple entity matches earlier in the request

* Update documentation strings
2023-06-23 23:34:34 -04:00
Franck Nijhof e2f5a707ce
Fix use_device_name in case device device class translations are used (#95010)
Co-authored-by: Erik <erik@montnemery.com>
2023-06-22 11:30:19 +02:00
J. Nick Koston 8d2daaa694
Limit cache size of EntityValues (#94983) 2023-06-21 22:23:35 +02:00
Allen Porter 30e8f806c1
Improve service response data APIs (#94819)
* Improve service response data APIs

Make the API naming more consistent, and require registration that a
service supports response data so that we can better integrate with
the UI and avoid user confusion with better error messages.

* Improve test coverage

* Add an enum for registering response values

* Assign enum values

* Convert SupportsResponse to StrEnum

* Update service call test docstrings

* Add tiny missing full stop in comment

---------

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-06-20 06:24:31 -07:00
Erik Montnemery 4a8adae146
Teach alarm_control_panel device trigger about entity registry ids (#60977)
* Teach alarm_control_panel device trigger about entity registry ids

* Lint code

* Address review comment
2023-06-20 08:27:31 -04:00
Erik Montnemery 609a573b55
Regenerate instance ID on error (#94898) 2023-06-20 11:16:51 +02:00
Allen Porter c4284c07b6
Allow scripts to capture service response data in variables (#94757)
* Allow scripts service actions to save return values

* Simplify script service response data

* Rename result_variable to response_variable based on feedback
2023-06-16 22:59:44 -04:00
J. Nick Koston 68cf796be8
Speed up entity service calls (#94731)
* Speed up entity service calls

- Avoid permissions check if the caller is an admin
- Use set intersection instead of linear search of entity platforms to find entities

* tweak

* fix light test to not use an admin user
2023-06-16 21:07:57 -04:00
Allen Porter 12129e9d21
Update service call return values and error handling (#94657)
* Update return signature of service calls

* Add timeout error handling in websocket api for service calls

* Update recorder tests to remove assertion on service call

* Remove timeout behavior and update callers that depend on it today

* Fix tests

* Add missing else

* await coro directly

* Fix more tests

* Update the intent task to use wait instead of timeout

* Remove script service call limits and limit constants

* Update tests that depend on service call limits

* Use wait instead of wait_for and add test

* Update homeassistant/helpers/intent.py

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

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-06-16 07:01:40 -07:00
J. Nick Koston 26be0fab78
Fix debouncer not scheduling timer when wrapped function raises (#94689)
* Fix debouncer not scheduling timer when callback function raises

* test coro as well

* preen
2023-06-15 22:15:49 -04:00
Erik Montnemery 334dacc322
Change Entity.name default to UNDEFINED (#94574)
* Change Entity.name default to UNDEFINED

* Update typing

* Update Pylint plugin

* Update TTS test
2023-06-15 11:09:53 +02:00