Commit Graph

114 Commits (2d46028e21b4095479302629a201c3cfc811b2c2)

Author SHA1 Message Date
Erik Montnemery 8620bef5b0
Support shared keys starting with period in services.yaml (#118789) 2024-06-11 16:31:19 +02:00
Robert Resch cb62f4242e
Remove strict connection (#117933) 2024-05-24 15:50:22 +02:00
Robert Resch 630ddd6a8c
Revert "Remove strict connection" (#116416) 2024-04-29 21:26:40 +02:00
Robert Resch dfc198cae0
Remove strict connection (#116396) 2024-04-29 19:33:31 +02:00
Erik Montnemery 7cd0fe3c5f
Don't reload other automations when saving an automation (#80254)
* Only reload modified automation

* Correct check for existing automation

* Add tests

* Remove the new service, improve ReloadServiceHelper

* Revert unneeded changes

* Update tests

* Address review comments

* Improve test coverage

* Address review comments

* Tweak reloader code + add a targetted test

* Apply suggestions from code review

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

* Explain the tests + add more variations

* Fix copy-paste mistake in test

* Rephrase explanation of expected test outcome

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-16 15:58:57 +02:00
Robert Resch 348e1df949
Add strict connection (#112387)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-12 14:47:46 +02:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Sid 00ec7f11f0
Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Franck Nijhof 167e66d45c
Add labels to service target (#113753) 2024-03-18 22:32:23 +01:00
Franck Nijhof 2aadd643ed
Add floors to service target (#110850) 2024-03-14 19:02:23 +01:00
Jan-Philipp Benecke 3b1ab6436d
Remove deprecated `hass.components` usage in service tests (#111883) 2024-03-12 17:27:44 +01:00
Paulus Schoutsen 145657dc21
Only load services.yaml for integrations that have it (#112732)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-11 19:05:32 +01:00
Marc Mueller a6b842f818
Add empty line after module docstring (2) [other] (#112738) 2024-03-08 19:16:38 +01:00
J. Nick Koston ed726db974
Fix race in loading service descriptions (#109316) 2024-02-01 12:34:23 -06:00
J. Nick Koston d260ed938a
Reduce overhead to call entity services (#106908) 2024-01-08 09:30:52 +01:00
J. Nick Koston 09b65f14b9
Index entities by domain for entity services (#106759) 2024-01-02 15:28:58 +01: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
J. Nick Koston 034fabe188
Use loop time to set context (#99701)
* Use loop time to set context

loop time is faster than utcnow, and since its only used internally it can
be switched without a breaking change

* fix mocking
2023-09-06 11:04:49 +02:00
Ville Skyttä 6399d74c15
Remove unnnecessary pylint configs from core (#98704) 2023-08-22 23:12:12 +02:00
Franck Nijhof b655b9d530
Allow for translating service examples (#97141) 2023-07-24 15:57:02 +02:00
Erik Montnemery df46179d26
Fix broken service test (#96943) 2023-07-20 13:11:55 +02:00
J. Nick Koston 08af42b00e
Fix mixed case service schema registration (#96448) 2023-07-12 14:39:51 -10: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
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
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
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 d95c241a1a
Add service response values to service descriptions (#95262) 2023-06-26 12:57:43 -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
J. Nick Koston b993fe1c9d
Cache generation of the service descriptions (#93131) 2023-05-16 21:42:37 -05:00
epenet a0f725dfcb
Add type hints to tests (#89497) 2023-03-10 12:06:50 +01:00
Erik Montnemery 18cb53a35c
Pass hass instance when validating templates (#89242)
* Pass hass instance when validating templates

* Update tests

* Fix validating templates without hass

* Update service tests
2023-03-08 11:28:53 -05:00
Erik Montnemery bc0b3abb01
Remove unittest.TestCase from service helper tests (#89283)
* Remove unittest.TestCase from service helper tests

* Update

* Improve tests
2023-03-07 16:54:35 +01:00
epenet b84eead3f8
Adjust entity registry access in helper tests (#88965) 2023-03-01 16:24:31 +01:00
epenet 5f25b71df7
Add type hints to core tests (#88478) 2023-02-20 11:42:56 +01:00
Erik Montnemery cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
epenet c98b4e3204
Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
Franck Nijhof e50a531cd9
Code styling tweaks to the tests - Part 2 (#86662)
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2023-01-26 01:23:53 +01:00
Paulus Schoutsen d59258bd25
Revert "Add service entity context (#71558)" (#72610) 2022-05-27 10:30:40 -07:00
epenet 4eb46d45ca
Cleanup deprecated async_get_registry in tests (#72059) 2022-05-18 13:12:38 +02:00
Franck Nijhof c0da97b038
Clean up accessing service helpers via hass (#72013) 2022-05-17 10:56:57 -07:00
Paulus Schoutsen 64636a4310
Add service entity context (#71558)
Co-authored-by: Shay Levy <levyshay1@gmail.com>
2022-05-09 14:45:53 -07:00
Paulus Schoutsen 130ca2213f
Enforce EntityCategory enum (#69015)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-31 15:04:33 -07:00
Erik Montnemery eb068bc850
Fix targeting all or none entities in service calls (#68513)
* Fix targeting all or none entities in service calls

* Add test
2022-03-22 19:45:27 +02:00
Paulus Schoutsen 8bbbd1947d
Raise if referenced entity does not support service (#68394) 2022-03-20 16:01:58 -07:00
Erik Montnemery 34eb4aa2d0
Exclude hidden entities from targets (#68149) 2022-03-15 08:42:22 -07:00
Erik Montnemery fc2025509e
Teach call service script action about entity registry ids (#61172) 2022-01-07 08:42:47 -08:00
Erik Montnemery 2b37943355
Don't add indirectly referenced config entities to service calls (#57671) 2021-10-15 08:46:43 -07:00
Tobias Sauerwein 9d4ad1821e
Fix logic of entity id extraction (#49164)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-14 14:12:26 +02:00
Franck Nijhof 4e3c12883e
Allow templatable service target to support scripts (#48600) 2021-04-01 13:10:01 -07:00