101 Commits

Author SHA1 Message Date
Erik Montnemery
ec77add1a6 Reload scripts when labs flag automation.new_triggers_conditions is set (#157348) 2025-11-26 17:53:38 +01:00
epenet
d5568ff955 Standardize homeassistant imports in full-CI components (#136731)
Standardize homeassistant imports in components
2025-01-28 13:11:19 -05:00
Ville Skyttä
40eb8b91cc Adjust to recommended propcache.api import paths (#136150) 2025-01-21 10:58:22 +01:00
Erik Montnemery
e18ffc53f2 Revert "Create a script service schema based on fields" (#129591) 2024-11-02 20:39:17 +01:00
Paulus Schoutsen
10300cc478 Create a script service schema based on fields (#128622) 2024-10-26 01:05:00 +02:00
J. Nick Koston
0f29fd3e10 Switch to using fast cached_property implementation in propcache (#127339) 2024-10-03 13:11:02 -05:00
Erik Montnemery
0927dd9090 Raise repair issues when scripts can't be set up (#122087) 2024-07-18 08:34:41 +02:00
Erik Montnemery
07ceafed62 Enable strict typing on script integration (#122079) 2024-07-17 15:11:06 +02:00
Joost Lekkerkerker
6ef8e87f88 Fix ruff redefined-argument-from-local PLR1704 (#120729)
* Fix PLR1704

* Fix
2024-06-28 12:31:07 +02:00
epenet
960d1289ef Avoid references to websocket_api.const in core and other components (#119285) 2024-06-10 13:49:44 +02:00
J. Nick Koston
6697cf07a6 Fix parallel script execution in queued mode (#118153) 2024-05-26 13:05:31 +02:00
J. Nick Koston
5f00b9207d Small cleanups to script (#115565) 2024-04-14 10:47:13 -05:00
J. Nick Koston
1de1e413a9 Migrate script entities to use more shorthand attrs (#115245) 2024-04-09 07:04:32 -10:00
Marc Mueller
816ce116bf Remove unnecessary functools.cached_property backport (#114239) 2024-04-04 11:24:26 +02:00
J. Nick Koston
13d6ebaabf Avoid delaying automation/script startup for sample blueprints (#114277)
Avoid delaying automation/script startup to check if the blueprint folder exists

automations and script both populate sample blueprints if none exist

The check to see if the blueprint folder exists always had to create
an executor job which would delay startup a bit if the executor was
busy. Since we do not need the sample blueprints to be populated
until the start event, we can run this in a task.
2024-03-27 09:55:59 +01:00
Marc Mueller
81c34ac952 Fix spelling [docstrings + comments] (#114168) 2024-03-25 11:33:00 +01: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
J. Nick Koston
4f113f256f Migrate script integration to create eager tasks (#113189)
Along with #113183 the script execution may be able to
synchronously without having to be scheduled on the event loop
2024-03-14 00:23:25 -04:00
Marc Mueller
930a396712 Add empty line after module docstring [s] (#112704) 2024-03-08 14:33:51 +01:00
J. Nick Koston
f96f4d31f7 Convert referenced registry functions to use cached_property (#108895)
* Convert referenced registry functions to use cached_property

These already implemented caching, but now that we can use cached_property
because the lock problem is solved, we can make the code simplier and faster

* missed one

* make them the same
2024-01-26 23:02:42 -05:00
Erik Montnemery
df73850f56 Move definition of attributes excluded from history to entity classes (#100430)
* Move definition of attributes excluded from history to entity classes

* Revert change which should be in a follow-up PR

* Fix sun unrecorded attributes

* Fix input_select unrecorded attributes
2023-09-21 15:02:47 +02:00
Allen Porter
7b1c0c2df2 Extend template entities with a script section (#96175)
* 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
Bram Kragten
5d9533fb90 Make script services always respond when asked (#95991)
* Make script services always respond when asked

* Update test_init.py
2023-07-06 10:48:03 -04:00
Erik Montnemery
1fec407a24 Set scripts which fail validation unavailable (#95381) 2023-06-27 18:24:34 +02:00
Paulus Schoutsen
5f14cdf69d Allow stopping a script with a response value (#95284) 2023-06-27 08:24:22 +02:00
Erik Montnemery
d05d67414a Teach search about blueprints (#78535) 2023-05-30 15:04:35 +02:00
rlippmann
f5911bcad6 Add slots to dataclasses in default_config (#91410)
* add dataclass slots to default config items

* remove slots from sun mixing
2023-04-14 14:22:39 -04:00
Franck Nijhof
3d557b5583 Collection of code styling tweaks (#87381) 2023-02-04 12:52:26 -05:00
epenet
62482f3500 Improve typing in script integration (#87076) 2023-02-02 16:31:46 -05:00
Franck Nijhof
5e81d28116 Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
Erik Montnemery
53637d486d Improve error message when a script fails to validate (#84438) 2022-12-22 16:26:57 +01:00
Erik Montnemery
f7694c0550 Only reload modified scripts (#80470)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-10-24 20:47:06 +02:00
Erik Montnemery
627bd82766 Simplify parsing of script and automation config (#80465) 2022-10-17 11:42:17 +02:00
Erik Montnemery
4ebf9df901 Unconditionally call DomainBlueprints.populate (#80336) 2022-10-14 12:03:43 -04:00
Erik Montnemery
284893d942 Fix reload of automation and scripts when blueprint changed (#80322) 2022-10-14 16:43:09 +02:00
Erik Montnemery
7f08dd851e Make script entities register their own service (#79202) 2022-09-28 11:05:29 -04:00
Paulus Schoutsen
d3f5ccfed8 Allow fetching script config (#79131) 2022-09-28 13:52:58 +02:00
Erik Montnemery
6ef33b1d39 Fix overriding a script's entity_id (#78765) 2022-09-28 10:37:34 +02:00
epenet
b4afb1cb6b Make use of generic EntityComponent (#78492) 2022-09-15 11:53:00 +02:00
Erik Montnemery
30702bdcd2 Deduplicate some code in scripts and automations (#78443) 2022-09-15 07:41:11 +02:00
epenet
996bcbdac6 Make EntityComponent generic (#78473) 2022-09-14 14:16:23 -04:00
Erik Montnemery
2ba0f42acc Prevent deleting blueprints which are in use (#78444) 2022-09-14 16:47:08 +02:00
Erik Montnemery
1df99badcf Allow scripts to turn themselves on (#71289) 2022-05-04 15:54:37 +02:00
Franck Nijhof
d08b751a85 Add unique ID to scripts (#70345) 2022-04-21 20:04:02 +02:00
J. Nick Koston
c3108b3899 Exclude attributes for automation and script domains (#70168) 2022-04-18 12:10:18 +02:00
Joakim Plate
251691f5b7 Make sure blueprint cache is flushed on script reload (#67899) 2022-03-09 11:21:31 -08:00
epenet
5f0fcb1a70 Add setup type hints to script (#64030)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-13 14:24:58 +01:00
Marc Mueller
fa7e787415 Update typing (3) [k-t] (#63924) 2022-01-11 21:26:55 +01:00
epenet
92ace6c2e8 Ensure service calls are typed [s-u] (#62922)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-28 14:23:42 +01:00