Commit Graph

363 Commits

Author SHA1 Message Date
Petro31
97f3bb3da5 Add default to from_json (#146211) 2025-06-24 14:27:14 +02:00
Petro31
e494f66c02 Add label_description to template engine (#147138)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-06-23 19:21:29 +01:00
Marc Mueller
2c13c70e12 Update ruff to 0.12.0 (#147106) 2025-06-19 20:39:09 +02:00
David Poll
670e8dd434 Add as_function to allow macros to return values (#142033) 2025-05-26 20:22:45 +02:00
David Poll
13d7234f97 Add apply to make macros/callables useful in filters and tests (#144227) 2025-05-26 17:00:07 +02:00
Petro31
13a6c13b89 Allow base64_encode to support bytes and strings (#145227) 2025-05-26 13:56:11 +02:00
Petro31
25f3ab3640 Add from_hex filter (#145229) 2025-05-26 13:16:56 +02:00
Marc Mueller
c7290908cc Update mypy-dev 1.16.0a8 (#143166) 2025-04-17 18:13:00 +02:00
Paul Bottein
8ec436423f Add template function: device_name (#142683) 2025-04-14 14:30:00 +02:00
Andrii Mitnovych
dea00fac3f Get area and floor by alias (#126150)
* Add possibility to get area by alias

* Add ability to get floor by alias

* Moved alias lookup to separate function, adjusted templates.

* Changed registry to return all areas/floors with given alias

* Use normalize_name from normalized_name_base_registry
2025-03-27 16:02:47 +01:00
Franck Nijhof
eb1caeb770 Add template list functions: intersect, difference, symmetric_difference, union (#141420) 2025-03-26 07:51:25 +01:00
Franck Nijhof
d3c40939f6 Reorder template extensions (#140985) 2025-03-20 11:34:02 +01:00
Franck Nijhof
c6d3928ed1 Add template function: combine (#140948)
* Add template function: combine

* Add test to take away concern raised
2025-03-20 10:29:40 +01:00
Franck Nijhof
e8069e1c07 Add template functions: md5, sha1, sha256, sha512 (#140192) 2025-03-09 16:15:27 +02:00
Franck Nijhof
9aa8a786a5 Add template function: flatten (#140157) 2025-03-08 11:14:27 -10:00
Franck Nijhof
e54febdc1e Add template function: typeof (#140081) 2025-03-08 09:16:21 -10:00
Franck Nijhof
d4f205c366 Add template function: shuffle (#140077) 2025-03-07 20:36:17 -05:00
Petro31
a296c5e9ad Add floor_entities function and filter (#136509)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-02-28 11:44:01 +00:00
epenet
3bbd7daa7f Improve type hints in template helper (#136253) 2025-01-22 15:27:01 +00:00
epenet
b11b36b523 Add more util aliases to import conventions (#136153) 2025-01-21 15:58:23 +01:00
Ville Skyttä
40eb8b91cc Adjust to recommended propcache.api import paths (#136150) 2025-01-21 10:58:22 +01:00
Joost Lekkerkerker
ef8b8fbbaa Enable RUF023 (#135830) 2025-01-17 12:28:27 +01:00
Joost Lekkerkerker
b4f4b06f29 Enable RUF021 (#135832) 2025-01-17 10:20:45 +01:00
Petro31
566f514a75 Allow is_state_attr to check attributes for None (#132879) 2025-01-17 08:41:10 +01:00
Joost Lekkerkerker
8db63adc11 Bump ruff to 0.9.1 (#135197) 2025-01-14 11:46:12 +01:00
Marc Mueller
fe0f414e99 Update mypy-dev to 1.14.0a5 (#132063) 2024-12-02 14:40:13 +01:00
epenet
c7485b94d5 Use breaks_in_ha_version in report_usage (#131137)
* Use breaks_in_ha_version in report_usage

* Revert behavior change
2024-11-23 18:58:24 +01:00
epenet
7045b776b6 Use report_usage in helpers (#130365) 2024-11-12 09:25:13 +01:00
epenet
f8e6fb81d6 Improve template docstring (#128967) 2024-10-22 19:15:27 -10:00
G Johansson
959898e0fc Fix merge_response template not mutate original object (#127865)
* Fix merge_response template not mutate original object

* Add comment
2024-10-08 18:35:06 +02:00
J. Nick Koston
db494de809 Restore __slots__ to core objects (#127441) 2024-10-03 22:23:47 +02:00
Erik Montnemery
851600630c Log deprecation warning when template.Template is created without hass (#125142)
* Log deprecation warning when template.Template is created without hass

* Improve docstring
2024-09-03 14:28:33 +02:00
Erik Montnemery
df4bd721b5 Deprecate template.attach (#124843) 2024-09-02 15:33:10 +02:00
G Johansson
78cf7dc873 New template merge_response (#114204)
* New template merge_response

* Extending

* Extend comment

* Update

* Fixes

* Fix comments

* Mods

* snapshots

* Fixes from discussion
2024-09-02 08:13:10 +02:00
J. Nick Koston
0a9e20615e Limit maximum template render output to 256KiB (#124946)
* Limit maximum template render output to 256KiB

fixes #124931

256KiB is likely to still block the event loop for an unreasonable amont of
time but its likely someone is using the template engine for large
blocks of data so we want a limit which still allows that but has
a reasonable safety to prevent the system from crashing down

* Update homeassistant/helpers/template.py
2024-08-30 22:33:57 +02:00
Petro31
5d64155bb6 Add zip to template engine (#122460)
* add zip to template engine

* fix doc strings
2024-08-22 19:11:08 +02:00
J. Nick Koston
a8cbfe5159 Make TemplateStateBase.entity_id a cached_property (#122279) 2024-07-21 07:49:59 -05:00
Sid
3142f52a79 Add Ruff refurb rules (#121701) 2024-07-10 21:47:40 +02:00
Marc Mueller
ca55986057 Import Generator from collections.abc (1) (#120914) 2024-07-01 11:51:51 +02:00
Paulus Schoutsen
bc45dcbad3 Add template config_entry_attr function (#119899)
* Template config_entry_attr function

* Complete test coverage

* Improve readability
2024-06-22 21:51:09 -04:00
Marc Mueller
f0452e9ba0 Update mypy dev 1.11.0a8 (#120032) 2024-06-21 13:15:18 +02:00
paulusbrand
624017a0f9 Add template Base64 decode encoding parameter (#116603)
Co-authored-by: Robert Resch <robert@resch.dev>
2024-06-07 17:01:35 +02:00
Marc Mueller
fe21e2b8ba Import Generator from typing_extensions (1) (#118986) 2024-06-06 17:02:13 +02:00
J. Nick Koston
607aaa0efe Speed up template result parsing (#118168) 2024-05-26 13:09:12 +02:00
J. Nick Koston
42232ecc8a Remove unused code in template helper (#118075) 2024-05-24 17:44:24 -10:00
J. Nick Koston
6923fb1601 Avoid template context manager overhead when template is already compiled (#118079) 2024-05-24 17:44:02 -10:00
J. Nick Koston
5cb3bc19c0 Speed up async_render_with_possible_json_value (#118080) 2024-05-24 17:43:42 -10:00
J. Nick Koston
f026083712 Speed up is_template_string by avoiding regex engine (#118076) 2024-05-24 17:42:55 -10:00
Marc Mueller
905adb2431 Update codespell ignore list (#118018) 2024-05-24 10:24:34 +02:00
J. Nick Koston
c9d1b127d8 Improve error message when template is rendered from wrong thread (#117822)
* Improve error message when template is rendered from wrong thread

* Improve error message when template is rendered from wrong thread
2024-05-20 23:26:48 -04:00