Commit Graph

126 Commits

Author SHA1 Message Date
Wendelin
a32ada3155 Use input_weekday in automations 2025-10-09 08:48:41 +02:00
Artur Pragacz
cf1a745283 Move condition-specific fields into options (#152635) 2025-09-25 15:55:50 +02:00
Artur Pragacz
98df5f5f0c Validate selectors in the condition helper (#151884) 2025-09-08 14:20:11 +02:00
Artur Pragacz
06130219b4 Use relative condition keys (#150021) 2025-08-06 17:20:30 +01:00
Artur Pragacz
2b0cda0ad1 Adjust condition and trigger method names (#150060) 2025-08-05 19:46:03 +01:00
Marc Mueller
80eb4fb2f6 Replace asyncio.iscoroutinefunction (#148738) 2025-07-14 20:24:32 +01:00
Erik Montnemery
6396f54e0d Move zone conditions to the zone integration (#148157) 2025-07-07 18:27:44 +02:00
Erik Montnemery
510fd09163 Allow core integrations to describe their conditions (#147529)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-07-04 16:03:42 +02:00
Erik Montnemery
26e3caea9a Add support for condition platforms to provide multiple conditions (#147376) 2025-06-25 18:10:30 +01:00
Erik Montnemery
cd61f37df7 Remove support for condition platforms defining only a CONDITION_SCHEMA (#144832) 2025-05-13 20:53:08 +02:00
Erik Montnemery
0128d85999 Move sun conditions to the sun integration (#144742) 2025-05-12 23:03:37 +01:00
epenet
b7a344fd65 Standardize homeassistant imports in core and base platforms (#136730)
Standardize homeassistant imports in core
2025-01-28 13:11:48 -05:00
Joost Lekkerkerker
b4f4b06f29 Enable RUF021 (#135832) 2025-01-17 10:20:45 +01:00
Simon Lamon
ee74a35417 Support time entities in time conditions (#124575)
Co-authored-by: Mark Bergsma <mark@wikked.net>
2024-11-26 15:37:31 +01:00
chammp
b3377fe5fb Add condition to trigger template entities (#119689)
* Add conditions to trigger template entities

* Add tests

* Fix ruff error

* Ruff

* Apply suggestions from code review

* Deduplicate

* Tweak name used in debug message

* Add and improve type annotations of modified code

* Adjust typing

* Adjust typing

* Add typing and remove unused parameter

* Adjust typing

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

* Adjust return type

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-09-11 09:36:49 +02:00
Erik Montnemery
6317053cc6 Remove unnecessary assignment of Template.hass from condition helper (#123775) 2024-08-13 11:52:27 +02:00
Marc Mueller
ca55986057 Import Generator from collections.abc (1) (#120914) 2024-07-01 11:51:51 +02:00
Marc Mueller
fe21e2b8ba Import Generator from typing_extensions (1) (#118986) 2024-06-06 17:02:13 +02:00
Marc Mueller
dd22ee3dac Improve annotation styling (#118032) 2024-05-24 15:05:53 +02:00
Marc Mueller
87bb7ced79 Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
Matthias Alphart
076f57ee07 Allow templates for enabling conditions (#117047)
* Allow templates for enabling automation conditions

* Use `cv.template` instead of `cv.template_complex`
2024-05-15 21:03:28 +02:00
Sid
f7b7f74d10 Enable Ruff TRY201 (#114269)
* Enable Ruff TRY201

* remove redundant rules
2024-03-28 10:18:07 +01:00
Sid
6ee273a548 Clean up unneeded ruff noqa directives (#113616) 2024-03-16 09:48:37 -10:00
Marc Mueller
19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -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
J. Nick Koston
3877a56d23 Avoid creating tasks for automation and script validation (#111181)
These functions created tasks to run small validators, and the cost of
creating all the tasks was more expensive than running the validators
themselves. Since the code is unlikely to suspend its more efficient to
await them in series.
2024-02-23 13:41:36 -05: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
Erik Montnemery
cc4a179ca8 Support templating for in state conditions (#88411) 2023-02-20 18:57:00 +01:00
Marc Mueller
6397138589 Update Optional typing (1) [Py310] (#86417)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-01-23 09:56:10 +01:00
Karlie Meads
156307f3f2 Fix logic of disabled condition for "OR" (#79718) 2023-01-16 21:08:09 +01:00
Franck Nijhof
06a35fb7db Code styling tweaks to core helpers (#85441) 2023-01-08 13:44:09 -10:00
Franck Nijhof
d4f69a3652 String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
Janick Bergeron
f21a004aa9 Fix before sunrise OR after sunset condition (#76143)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Ben Randall <veleek@gmail.com>
2022-10-14 13:11:10 +02:00
Malte Franken
638992f9c4 Make zone condition more robust by ignoring unavailable and unknown entities (#72751)
* ignore entities with state unavailable or unknown

* test for unavailable entity
2022-05-31 11:34:52 -07:00
Franck Nijhof
e04fef3c2d Allow disabling specific triggers/actions/conditions (#70082) 2022-04-15 09:33:09 -07:00
Franck Nijhof
7087020283 Allow any entity to match state condition (#69763) 2022-04-11 10:53:42 -07:00
Erik Montnemery
cd25769667 Rename async_resolve_entity_ids to async_validate_entity_ids (#67603) 2022-03-04 09:51:53 +01:00
Paulus Schoutsen
c2e62e4d9f Re-org device automations (#67064)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-02-22 13:15:16 -08:00
Marc Mueller
1a247f7d1b Improve device_automation typing (#66621) 2022-02-17 22:08:43 +01:00
Marc Mueller
12757a8cd2 Update typing - collections.abc (1) (#63933)
* Update typing - collections.abc (1)

* Additional typing updates
2022-01-12 07:56:35 +01:00
Marc Mueller
240c9979c7 Move disallow-any-generics to mypy.ini (#63917) 2022-01-11 13:33:25 -08:00
Marc Mueller
01baa20671 Fix implicit reexport [dt_util] (#63829) 2022-01-10 16:31:23 +01:00
Marc Mueller
c384596899 Use SensorDeviceClass in sensor and helpers packages (#63452) 2022-01-05 14:59:51 +01:00
Tobias Sauerwein
2c904c0974 Bump mypy to 0.930 (#62642)
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 (#62693) 2021-12-23 11:14:47 -08:00
Erik Montnemery
e48f567176 Wrap shorthand template conditions during schema validation (#62485) 2021-12-21 17:20:15 +01:00
Ville Skyttä
334c6c5c02 Make device automation type an enum (#62354) 2021-12-20 19:16:30 +01:00
Erik Montnemery
17dc609363 Correct validation of conditions in scripts and automations (#60890)
* Correct validation of conditions in scripts and automations

* Fix test
2021-12-03 09:08:28 -08:00
Erik Montnemery
0e3bc21d54 Teach state and numeric_state conditions about entity registry ids (#60841) 2021-12-02 14:55:12 -08:00
Erik Montnemery
caf5ee2fab Remove optional validation when creating conditions (#60481) 2021-11-28 14:54:07 +01:00