1
0
mirror of https://github.com/home-assistant/core.git synced 2025-09-02 09:01:05 +00:00
Commit Graph

191 Commits

Author SHA1 Message Date
Erik Montnemery
362e5ca09a Fix changed_variables in automation traces () 2023-12-31 18:56:23 +01:00
Erik Montnemery
09ad1a9a36 Remove unnecessary block use of pylint disable in components p-z () 2023-09-12 20:47:48 +02:00
Allen Porter
7b1c0c2df2 Extend template entities with a script section ()
* Extend template entities with a script section

This allows making a trigger entity that triggers a few times a day,
and allows collecting data from a service resopnse which can be
fed into a template entity.

The current alternatives are to publish and subscribe to events or to
store data in input entities.

* Make variables set in actions accessible to templates

* Format code

---------

Co-authored-by: Erik <erik@montnemery.com>
2023-09-02 16:19:45 -07:00
Marc Mueller
a9ade1f84d Use asyncio.timeout [core] () 2023-08-15 08:36:05 -05:00
Franck Nijhof
3e85a29b86 Move overlapping pylint rules to ruff, disable mypy overlap () 2023-06-27 17:42:46 +02:00
Erik Montnemery
cb22fb16f8 Allow returning a script variable from a script ()
* Allow returning a script variable from a script

* Don't allow returning a template result

* Raise if response variable is undefined

* Add test

* Update homeassistant/helpers/script.py

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

* Format code

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-06-27 17:13:53 +02:00
Paulus Schoutsen
5f14cdf69d Allow stopping a script with a response value () 2023-06-27 08:24:22 +02:00
Allen Porter
1d9821efa2 Fix spelling mistake in script.py ()
Update script.py
2023-06-25 21:00:50 -04:00
Allen Porter
528c206094 Add script specific error messages for response_variable () 2023-06-24 21:34:57 -07:00
Allen Porter
30e8f806c1 Improve service response data APIs ()
* 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 ()
* 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 ()
* 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 () 2023-03-16 08:00:21 +01:00
Karlie Meads
e40a9822f5 Fix disabled condition within an automation action ()
fixes undefined
2023-02-02 22:35:02 +01:00
Marc Mueller
8abce25948 Update Union typing (4) [Py310] () 2023-01-23 09:04:40 +01:00
Franck Nijhof
79b52a2b41 Stricter pylint message control () 2023-01-20 13:47:55 +01:00
Michaël Arnauts
7142b4ecac Fixes some grammar mistakes () 2022-12-20 11:10:31 +01:00
Erik Montnemery
18033532ca Fix search throwing on templated services () 2022-10-05 10:59:18 +03:00
epenet
d3be06906b Improve type hints in script helpers ()
* Improve type hints in script helpers

* Import CONF_SERVICE_DATA from homeassistant.const

* Make data optional
2022-09-13 23:11:29 +02:00
Franck Nijhof
99360ad7f4 Indicate disabled steps in script trace () 2022-05-03 13:04:59 +02:00
Erik Montnemery
92f1855bcf Fix script conditions () 2022-05-03 11:28:08 +02:00
Erik Montnemery
1931600eac Isolate parallel subscripts () 2022-05-03 10:36:58 +02:00
Erik Montnemery
f6c2fb088c Stop script if sub-script stops or aborts () 2022-05-02 14:59:58 +02:00
Franck Nijhof
35687def02 Merge stop & error script actions () 2022-04-20 14:22:37 -07:00
Franck Nijhof
1b48d7eda1 Add for each item support to repeat action () 2022-04-15 19:10:25 +02:00
Franck Nijhof
e04fef3c2d Allow disabling specific triggers/actions/conditions () 2022-04-15 09:33:09 -07:00
Franck Nijhof
cdabcce83a Add ability to continue scripts/automations on error () 2022-04-14 13:43:14 -07:00
Franck Nijhof
d704d4f853 Add parallel automation/script actions () 2022-04-13 13:07:44 -07:00
Franck Nijhof
67b200a532 Add if/else automation/script action ()
Co-authored-by: Erik <erik@montnemery.com>
2022-04-12 15:02:17 +02:00
Franck Nijhof
81d90b1bc7 Add stop/error script/automation action () 2022-04-11 14:22:22 -07:00
Erik Montnemery
46f27fdefd Don't prevent automations from triggering themselves () 2022-03-15 18:48:54 +01:00
Erik Montnemery
8ea31cea3a Fix deadlock when stopping queued script () 2022-03-15 08:29:04 -07:00
Erik Montnemery
1a27025793 Prevent spawning script runs when shutting down () 2022-03-15 12:46:58 +01:00
Erik Montnemery
65fbcfa0ba Prevent recursive script calls from deadlocking ()
* Prevent recursive script calls from deadlocking

* Address review comments, improve tests

* Tweak comment
2022-03-10 19:28:00 +01:00
Paulus Schoutsen
c2e62e4d9f Re-org device automations ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-02-22 13:15:16 -08:00
mk-maddin
efb6fd1569 Fix script / automation repeat with count 0 fails ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-02-03 08:18:58 -08:00
Marc Mueller
d3b7bd25ef Update typing (1) () 2022-01-11 21:26:03 +01:00
Marc Mueller
40262c4763 Fix exception import locations () 2022-01-05 15:00:49 +01:00
Tobias Sauerwein
2c904c0974 Bump mypy to 0.930 ()
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-12-27 17:55:17 +01:00
Ruslan Sayfutdinov
55f4962c06 Fix pylint plugin which checks relative imports () 2021-12-23 11:14:47 -08:00
Erik Montnemery
e48f567176 Wrap shorthand template conditions during schema validation () 2021-12-21 17:20:15 +01:00
Ville Skyttä
334c6c5c02 Make device automation type an enum () 2021-12-20 19:16:30 +01:00
Erik Montnemery
112e259437 Fix threading error in scripts with repeat or choose actions () 2021-12-17 11:41:54 +01:00
Erik Montnemery
17dc609363 Correct validation of conditions in scripts and automations ()
* Correct validation of conditions in scripts and automations

* Fix test
2021-12-03 09:08:28 -08:00
Erik Montnemery
caf5ee2fab Remove optional validation when creating conditions () 2021-11-28 14:54:07 +01:00
Erik Montnemery
ea102f71a6 Correct validation of repeats in scripts and automations ()
* Correct validation of repeats in scripts and automations

* Improve validation test
2021-11-26 14:12:59 +01:00
Erik Montnemery
ad9c3a47cf Correct validation of conditions in scripts and automations () 2021-11-26 13:21:11 +01:00
J. Nick Koston
10d6247fee Bump to aiohttp 3.8.0 () 2021-11-04 10:07:50 -05:00
Marc Mueller
238b488642 Use assignment expressions 03 () 2021-10-17 20:08:11 +02:00
Paulus Schoutsen
835e07f63e Remove debug log () 2021-10-13 13:03:52 -07:00