Commit graph

81 commits

Author SHA1 Message Date
J. Nick Koston
f96f4d31f7
Convert referenced registry functions to use cached_property ()
* 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 ()
* 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 ()
* 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 ()
* 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 () 2023-06-27 18:24:34 +02:00
Paulus Schoutsen
5f14cdf69d
Allow stopping a script with a response value () 2023-06-27 08:24:22 +02:00
Erik Montnemery
d05d67414a
Teach search about blueprints () 2023-05-30 15:04:35 +02:00
rlippmann
f5911bcad6
Add slots to dataclasses in default_config ()
* 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 () 2023-02-04 12:52:26 -05:00
epenet
62482f3500
Improve typing in script integration () 2023-02-02 16:31:46 -05:00
Franck Nijhof
5e81d28116
Update black to 23.1.0 () 2023-02-02 18:35:24 +01:00
Erik Montnemery
53637d486d
Improve error message when a script fails to validate () 2022-12-22 16:26:57 +01:00
Erik Montnemery
f7694c0550
Only reload modified scripts ()
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 () 2022-10-17 11:42:17 +02:00
Erik Montnemery
4ebf9df901
Unconditionally call DomainBlueprints.populate () 2022-10-14 12:03:43 -04:00
Erik Montnemery
284893d942
Fix reload of automation and scripts when blueprint changed () 2022-10-14 16:43:09 +02:00
Erik Montnemery
7f08dd851e
Make script entities register their own service () 2022-09-28 11:05:29 -04:00
Paulus Schoutsen
d3f5ccfed8
Allow fetching script config () 2022-09-28 13:52:58 +02:00
Erik Montnemery
6ef33b1d39
Fix overriding a script's entity_id () 2022-09-28 10:37:34 +02:00
epenet
b4afb1cb6b
Make use of generic EntityComponent () 2022-09-15 11:53:00 +02:00
Erik Montnemery
30702bdcd2
Deduplicate some code in scripts and automations () 2022-09-15 07:41:11 +02:00
epenet
996bcbdac6
Make EntityComponent generic () 2022-09-14 14:16:23 -04:00
Erik Montnemery
2ba0f42acc
Prevent deleting blueprints which are in use () 2022-09-14 16:47:08 +02:00
Erik Montnemery
1df99badcf
Allow scripts to turn themselves on () 2022-05-04 15:54:37 +02:00
Franck Nijhof
d08b751a85
Add unique ID to scripts () 2022-04-21 20:04:02 +02:00
J. Nick Koston
c3108b3899
Exclude attributes for automation and script domains () 2022-04-18 12:10:18 +02:00
Joakim Plate
251691f5b7
Make sure blueprint cache is flushed on script reload () 2022-03-09 11:21:31 -08:00
epenet
5f0fcb1a70
Add setup type hints to script ()
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] () 2022-01-11 21:26:55 +01:00
epenet
92ace6c2e8
Ensure service calls are typed [s-u] ()
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-28 14:23:42 +01:00
Marc Mueller
7063c05127
Use assignment expressions 33 () 2021-10-30 16:32:41 +02:00
Marc Mueller
b1d49b3b66
Use assignment expressions 29 () 2021-10-30 16:31:43 +02:00
Marc Mueller
62c20860ac
Use assignment expressions 22 () 2021-10-21 08:33:10 +02:00
Franck Nijhof
2cdaf632a4
Restore last_triggered state in scripts () 2021-08-23 11:05:29 -07:00
Richard T. Schaefer
9e219d9b6e
Add this variable for use by automation and script templates () 2021-07-28 09:09:13 +02:00
Franck Nijhof
89e7983ee0
Add Blueprint foundation to Scripts ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-04-27 15:15:38 -07:00
Erik Montnemery
ce64690817
Make number of stored traces configurable () 2021-04-27 10:27:12 -07:00
Philip Allgaier
6fe04f40a2
Ensure HA script and Python script services have a name ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-03-31 15:09:45 +02:00
Bram Kragten
d1a1e70726
Search for areas used in automations and scripts ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-03-30 15:01:56 -07:00
Erik Montnemery
7534b54e4e
Merge condition and action traces () 2021-03-29 14:06:49 -07:00
Franck Nijhof
81ae0ee451
Add support for Selectors in Script service fields () 2021-03-29 18:05:45 +02:00
Erik Montnemery
8896ae0d56
Add support for tracing script execution ()
* Add support for tracing script execution

* Tweak
2021-03-24 17:56:22 +01:00
Erik Montnemery
346a724ac3
Mark base components' state_attribute @final, rename others to extra_state_attributes ()
* Mark base state_attributes @final, rename others to extra_state_attributes

* Fix calendar, update tests
2021-03-21 10:38:24 +01:00
Marc Mueller
a3cd1854f6
Update typing 12 () 2021-03-18 14:31:38 +01:00
tkdrob
3baeed3684
Clean up constants () 2021-03-05 19:08:04 +01:00
Erik Montnemery
17401cbc29
Initial automation tracing ()
* Initial prototype of automation tracing

* Small fixes

* Lint

* Move trace helpers to its own file

* Improve trace for state and numeric_state conditions

* Tweaks + apply suggestions from code review

* Index traces by automation_id, trace while script is running

* Refactor condition tracing

* Improve WS API to get traces for single automation

* Add tests

* Fix imports

* Fix imports

* Address review comments

* Cap logging of loops

* Remove unused ContextVar action_config
2021-03-04 14:16:24 +01:00
Anders Melchiorsen
9f4874bb81
Explicitly create_task for asyncio.wait () 2021-02-20 19:57:46 +01:00
Paulus Schoutsen
5117a16841
Extract variable rendering () 2020-09-11 12:24:16 +02:00
Paulus Schoutsen
aa9dff572e
Add default variables to script helper () 2020-09-10 20:41:42 +02:00
Phil Bruckner
4486251382
Add max_exceeded log level option to automations & scripts () 2020-09-02 11:05:14 +02:00