Artur Pragacz
b964bc58be
Fix variable scopes in scripts ( #138883 )
...
Co-authored-by: Erik <erik@montnemery.com>
2025-02-26 16:19:19 +01:00
epenet
364556a7dd
Prefer from...import...as over import...as in core tests ( #136146 )
2025-01-21 09:28:17 +01:00
Artur Pragacz
b009f11013
Fix referenced objects in script sequences ( #135499 )
2025-01-13 11:40:53 +01:00
Petro31
33222436d2
Nested stop actions will now return response_variables ( #126393 )
...
fix-nested-stop-variable-response
2024-11-27 09:18:02 +01:00
Jonas Bergler
756a866ffd
Add `completed` to the wait variable when using triggers (`wait_for_trigger`) ( #123427 )
...
* Add support for the wait.completed variable when using wait with triggers
* Remove junk comment
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-10-23 17:19:07 +02:00
Franck Nijhof
8b96c7873f
Rename 'service' to 'action' in automations and scripts ( #122845 )
2024-07-31 14:36:53 +02:00
Franck Nijhof
a9bf12f102
Rename Services to Actions in translation strings ( #121777 )
2024-07-15 21:19:25 +02:00
Sid
721b2c2ca8
Enable Ruff PT012 ( #113957 )
2024-06-08 17:59:08 +02:00
J. Nick Koston
7bbb33b415
Improve script disallowed recursion logging ( #118151 )
2024-05-26 12:58:34 +02:00
Franck Nijhof
9224997411
Add sequence action for automations & scripts ( #117690 )
...
Co-authored-by: Robert Resch <robert@resch.dev>
2024-05-24 09:34:49 +02:00
Matthias Alphart
ec4c8ae228
Allow templates for enabling actions ( #117049 )
...
* Allow templates for enabling automation actions
* Use `cv.template` instead of `cv.template_complex`
* Rename test function
2024-05-15 21:03:52 +02:00
J. Nick Koston
4529268544
Ensure scripts with timeouts of zero timeout immediately ( #115830 )
2024-04-19 18:24:54 +02:00
J. Nick Koston
ee535ee611
Ensure test async_create_task eager start behavior matches production ( #115517 )
2024-04-13 15:58:52 -05:00
J. Nick Koston
569f54d8e3
Terminate scripts with until and while conditions that execute more than 10000 times ( #115110 )
2024-04-07 11:02:53 -10:00
Sid
d5f883fbf0
Unignore Ruff PLR in tests ( #114470 )
...
* Unignore Ruff PLR in tests
* Address review comments
* review comments
* fix import
* Update test_api.py
* Update test_api.py
* Update test_api.py
2024-04-01 11:11:59 +02:00
J. Nick Koston
f4922edb4b
Fix empty delays in script helper ( #114346 )
...
fixes
```
Logger: homeassistant.components.automation.kamermaster_knop_4_acties_licht
Bron: components/automation/__init__.py:726
integratie: Automatisering (documentatie, problemen)
Eerst voorgekomen: 22:17:29 (5 gebeurtenissen)
Laatst gelogd: 22:59:24
While executing automation automation.kamermaster_knop_4_acties_licht
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 726, in async_trigger
return await self.action_script.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1645, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 454, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 506, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 536, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 504, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 626, in _async_delay_step
if timeout_future.done():
^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'done'
```
2024-03-28 00:29:43 -04: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
Jan Bouwhuis
67ab49b825
Fetch ServiceNotFound message from translation cache and fix super ( #114084 )
...
* Fetch ServiceNotFound message from translation cache and fix super
* Fix tests trace component
* Fix script errors
2024-03-24 07:41:13 -10:00
Franck Nijhof
670bd97777
Find referenced labels in automations & scripts ( #113812 )
2024-03-19 16:28:37 +01:00
Franck Nijhof
38d0854b70
Find referenced floors in automations & scripts ( #113802 )
2024-03-19 14:18:53 +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
J. Nick Koston
bdede0e0da
Start script runs eagerly ( #113190 )
2024-03-14 16:53:26 -10:00
J. Nick Koston
324266a4e6
Fix race in script stop that could cause async_stop to hang forever ( #113089 )
2024-03-11 10:48:11 -10:00
Marc Mueller
a6b842f818
Add empty line after module docstring (2) [other] ( #112738 )
2024-03-08 19:16:38 +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
Marc Mueller
cd0ee98dba
Use builtin TimeoutError [core + helpers] ( #109684 )
2024-02-05 12:09:54 +01:00
Erik Montnemery
8abb4e5f52
Improve display of errors with no message in script trace ( #108735 )
2024-01-28 19:27:14 +01:00
Erik Montnemery
909e58066d
Fix changed_variables in automation and script traces ( #108788 )
2024-01-24 19:12:45 +01:00
Erik Montnemery
431e4b38ac
Improve tests of script trace ( #108733 )
2024-01-24 15:29:35 +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
J. Nick Koston
c399cab427
Small speed up to checking core state ( #107845 )
2024-01-18 08:41:32 -10:00
Erik Montnemery
461dad3039
Fix changed_variables in automation traces ( #106665 )
2023-12-30 08:34:21 +01:00
Jan-Philipp Benecke
d1aa690c24
Migrate non-component tests to use freezegun/freezer ( #105142 )
2023-12-07 22:58:09 +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
b83ada8c19
Use real devices in automation and script tests ( #102785 )
2023-10-25 16:09:39 +02:00
Marc Mueller
c59404b5bc
Fix additional test cases for Python 3.12 ( #101006 )
2023-09-27 17:19:20 +02:00
Marc Mueller
a9ade1f84d
Use asyncio.timeout [core] ( #98447 )
2023-08-15 08:36:05 -05:00
Allen Porter
528c206094
Add script specific error messages for `response_variable` ( #95188 )
2023-06-24 21:34:57 -07: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
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
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
epenet
913156b0e0
Avoid lingering timer on script shutdown ( #89753 )
2023-03-16 08:00:21 +01:00
Erik Montnemery
d90ee85118
Allow conditions to be implemented in platforms ( #88509 )
...
* Allow conditions to be implemented in platforms
* Update tests
* Tweak typing
* Rebase fixes
2023-02-23 22:30:51 -05:00
epenet
5f25b71df7
Add type hints to core tests ( #88478 )
2023-02-20 11:42:56 +01:00
Franck Nijhof
d3ed8de232
Update Ruff to v0.0.247 ( #88210 )
...
* Update Ruff to v0.0.247
* Fix new found violations
2023-02-15 16:46:03 -05:00
Franck Nijhof
ed79265843
Enable Ruff PT006 ( #88165 )
...
* Enable Ruff PT006
* Adjust existing cases
* Fix tests
* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Paulus Schoutsen
d54f59478f
Keep task references while running ( #87970 )
...
* Keep task references while running
* Update pilight tests pointing at correct logger call
* Fix graphite tests
* Fix profiler tests
* More graphite test fixes
* Remove extra sleep
* Fix tests
* Shutdown background tasks as part of stage 1
* Remove unnecessary sleep in test
* Remove unused method on mock hass
* Skip on cancelled too
* Remove background tasks
* Test trigger variables without actually sleeping
* Fix graphite
* One more graphite grrrrrrr
2023-02-13 23:16:59 -05: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
Karlie Meads
e40a9822f5
Fix disabled condition within an automation action ( #87213 )
...
fixes undefined
2023-02-02 22:35:02 +01:00