Commit Graph

44 Commits

Author SHA1 Message Date
abmantis
d6caa86ab3 Add support for trigger descriptions with relative keys 2025-08-03 16:25:36 +01:00
Artur Pragacz
749fc318ca Validate selectors in the trigger helper (#149662) 2025-07-30 14:22:55 +02:00
Marc Mueller
80eb4fb2f6 Replace asyncio.iscoroutinefunction (#148738) 2025-07-14 20:24:32 +01:00
Erik Montnemery
d2825e1c80 Don't gather TRIGGER_PLATFORM_SUBSCRIPTIONS (#147954)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-07-03 19:33:28 +02:00
Erik Montnemery
1fb587bf03 Allow core integrations to describe their triggers (#147075)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-06-25 17:35:15 +01:00
Erik Montnemery
b8044f60fc Fix trigger config validation (#147408) 2025-06-24 10:13:44 +02:00
Erik Montnemery
26fe23eb5c Improve support for trigger platforms with multiple triggers (#144827)
* Improve support for trigger platforms with multiple triggers

* Adjust zwave_js

* Refactor the Trigger class

* Silence mypy

* Adjust

* Revert "Adjust"

This reverts commit 17b3d16a267d54c082b12f07550faa8ac4ac3a49.

* Revert "Silence mypy"

This reverts commit c2a011b16f9b02880fc3dc673b5b12501f7995fc.

* Reapply "Adjust"

This reverts commit c64ba202dd.

* Apply suggestions from code review

* Revert "Apply suggestions from code review"

This reverts commit 0314955c5a.
2025-06-10 20:48:51 +02:00
Artur Pragacz
f0c5e00cc1 Fix conversation trigger with variables (#140066) 2025-03-08 22:23:24 -05:00
Joost Lekkerkerker
33d83e43de Update trigger validation message (#126749) 2024-09-25 15:33:03 +02:00
Matthias Alphart
ba48da7678 Allow templates for enabling automation triggers (#114458)
* Allow templates for enabling automation triggers

* Test exception for non-limited template

* Use `cv.template` instead of `cv.template_complex`

* skip trigger with invalid enable template

instead of returning and thus not evaluating other triggers
2024-05-14 14:44:21 +02:00
Marc Mueller
8f614fb06d Use HassKey for helpers (2) (#117013) 2024-05-07 11:24:13 -05:00
Marc Mueller
19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
J. Nick Koston
390f5822fe Initialize triggers eagerly (#112294)
Most of these will never suspend and do not need
to be scheduled as tasks on the event loop
2024-03-05 09:58:43 -05:00
J. Nick Koston
331989de4c Migrate condition/state/trigger helper to use async_get_platform (#112144)
Currently these would always load the platform in the loop
if it was not already loaded
2024-03-03 21:20:47 -05: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
Marc Mueller
a70ec64408 Update mypy to 1.7.0 (#103800) 2023-11-11 23:31:04 +01:00
Marc Mueller
c35f56ea77 Handle BaseException from asyncio gather (#103814) 2023-11-11 22:26:37 +01:00
rlippmann
3a72054f93 Make dataclasses in HA core slotted (#91208) 2023-04-11 07:58:28 -10:00
J. Nick Koston
11681f3f31 Pass a helpful name when creating common asyncio tasks in core (#89171) 2023-03-05 12:46:02 +01:00
Erik Montnemery
6d9411b8a1 Improve trigger platform typing (#88511)
* Improve trigger platform typing

* Tweak docstring

* Revert "Tweak docstring"

This reverts commit c31f790fc3.

* Tweak docstring
2023-02-22 11:59:53 +01:00
Erik Montnemery
30ebc6604f Invert trigger._PLATFORM_ALIASES (#88503) 2023-02-20 22:14:41 +01:00
Franck Nijhof
06a35fb7db Code styling tweaks to core helpers (#85441) 2023-01-08 13:44:09 -10:00
Marc Mueller
79b400d71b Improve PluggableActionsEntry typing (#82885)
* Improve PluggableActionsEntry typing

* Add parameter typing
2022-11-29 13:37:22 +01:00
epenet
9d192643ee Move PluggableAction to trigger helpers (#81900)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Joakim Plate <elupus@ecce.se>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
2022-11-22 11:35:18 +01:00
ehendrix23
ba6a81c565 Resolve traceback error when using variables in template triggers (#77287)
Co-authored-by: Erik <erik@montnemery.com>
2022-09-29 13:26:28 -04:00
Franck Nijhof
9843753f30 Add alias support to all triggers (#77184) 2022-08-22 17:43:09 -04:00
Marc Mueller
c93d9d9a90 Move AutomationActionType to helpers.trigger (#76790) 2022-08-15 08:37:11 -04:00
epenet
5cfb31d28a Adjust device_automation type hints in core components (#72207) 2022-05-23 16:07:34 +02:00
Franck Nijhof
e04fef3c2d Allow disabling specific triggers/actions/conditions (#70082) 2022-04-15 09:33:09 -07:00
Paulus Schoutsen
ad1e43e083 Add support for variables on trigger (#68275) 2022-03-18 09:25:22 +01:00
Marc Mueller
30e2411761 Add type ignore error codes [last ones] (#66816) 2022-02-18 18:15:57 +01:00
Ruslan Sayfutdinov
55f4962c06 Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
Marc Mueller
77ee72cbb9 Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Ville Skyttä
b10fc89a6b Automation trigger info type hint improvements (#55402)
* Make automation trigger info a TypedDict

* zwave_js trigger type hint fixes

* Remove redundant automation trigger info field presence checks

* Use async_initialize_triggers in mqtt and tasmota device_trigger tests
2021-09-04 02:25:51 +02:00
Raman Gupta
036e99e91e Allow integrations to define trigger platforms with a subtype (#54861) 2021-08-19 21:43:04 -07:00
Erik Montnemery
4c9f12b9c5 Correct trace path for trigger with custom id (#51847) 2021-06-14 17:09:20 +02:00
Erik Montnemery
b01b33c304 Add trigger condition (#51710)
* Add trigger condition

* Tweaks, add tests
2021-06-11 15:05:57 +02:00
Erik Montnemery
b26779a27a Add id to automation triggers (#48464) 2021-03-31 14:56:04 +02:00
Franck Nijhof
38d14702fa Remove HomeAssistantType alias from helpers (#48400) 2021-03-27 12:55:24 +01:00
Marc Mueller
6fb2e63e49 Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Erik Montnemery
047f16772f Support templating MQTT triggers (#45614)
* Add support for limited templates (no HASS access)

* Pass variables to automation triggers

* Support templates in MQTT triggers

* Spelling

* Handle trigger referenced by variables

* Raise on unsupported function in limited templates

* Validate MQTT trigger schema in MQTT device trigger

* Add trigger_variables to automation config schema

* Don't print stacktrace when setting up trigger throws

* Make pylint happy

* Add trigger_variables to variables

* Add debug prints, document limited template

* Add tests

* Validate MQTT trigger topic early when possible

* Improve valid_subscribe_topic_template
2021-02-08 10:50:38 +01:00
J. Nick Koston
a7741be9bb Wait for all triggers when one fails to attach (#45361) 2021-01-20 22:13:21 +01:00
Phil Bruckner
76ead858cf Add wait_for_trigger script action (#38075)
* Add wait_for_trigger script action

* Add tests

* Change script integration to use config validator
2020-08-21 11:38:25 +02:00
Phil Bruckner
ca9dd0c833 Reorganize trigger code (#38655) 2020-08-17 11:54:56 -05:00