Petro31 and GitHub
d4e1a7075e
Clean up legacy template entity code ( #170016 )
2026-05-20 07:44:32 +02:00
3fee05db71
Add entity_platform helper function to create issues when platform setup is not supported by integration ( #171105 )
...
Co-authored-by: Erik Montnemery <[email protected] >
Co-authored-by: Copilot Autofix powered by AI <[email protected] >
2026-05-19 21:08:03 +02:00
Franck Nijhof and GitHub
833ff982d0
Fix line length violations in tests/components t-z ( #170994 )
2026-05-17 17:12:29 -04:00
Petro31 and GitHub
ab668ac576
Remove legacy sensor template entities ( #169728 )
2026-05-07 15:22:22 +02:00
Petro31 and GitHub
dfb8c7edb8
Fix uptime template sensor ( #169743 )
2026-05-04 18:09:46 +01:00
Petro31 and GitHub
5fadcb01e9
Fix int vs float template sensor issue ( #164339 )
2026-02-27 22:06:37 +01:00
4e71a38e31
Ensure numeric template sensors only use numbers in _attr_native_state ( #162878 )
...
Co-authored-by: Erik Montnemery <[email protected] >
2026-02-13 14:14:28 +01:00
Petro31 and GitHub
e7fd744941
Update template sensor platform to new template entity framework ( #162554 )
2026-02-08 21:01:31 +01:00
02f412feb1
Update template sensor tests to use new framework ( #159466 )
...
Co-authored-by: Joost Lekkerkerker <[email protected] >
2025-12-23 20:21:57 +01:00
Petro31 and GitHub
20cdd9386e
Modernize template sensor ( #157251 )
2025-11-25 21:15:17 +01:00
3dd941eff7
Fix section and entity variable resolution for template platforms ( #149660 )
...
Co-authored-by: Erik Montnemery <[email protected] >
2025-09-23 08:12:24 +02:00
Petro31 and GitHub
c058561162
Add initalize for abstract template entities ( #147504 )
2025-07-15 15:53:01 +02:00
Petro31 and GitHub
a35299d94c
Add preview tests for number and sensor ( #148426 )
2025-07-08 16:04:06 +01:00
adec157d43
Allow trigger based numeric sensors to be set to unknown ( #137047 )
...
* Allow trigger based numeric sensors to be set to unknown
* resolve comments
* Do case insensitive check
* use _parse_result
---------
Co-authored-by: abmantis <[email protected] >
2025-07-02 15:35:47 +02:00
8ff4d5dcbf
Adapt template sensors to use the same plural trigger/condition/action definitions as automations ( #127875 )
...
* Add plurals to template entities
* Ruff
* Ruffy ruff
* Fix linters
* Fix bug introduced after merging dev
* Fix merge mistake
* Revert adding automation helper
* Revert "Fix bug introduced after merging dev"
This reverts commit 098d478f150a06546fb9ec3668865fa5d763c6b2.
* Fix blueprint validation
* Apply suggestions from code review
---------
Co-authored-by: Erik <[email protected] >
2025-04-29 11:52:58 +02:00
ff2c901930
Update trigger based template entity resolution order ( #140660 )
...
* Update trigger based template entity resolution order
* add test
* fix most comments
* Move resolution to base class
* add comment
* remove uncessary if statement
* add more tests
* update availability tests
* update logic stage 1
* phase 2 changes
* fix trigger template entity tests
* fix trigger template entities
* command line tests
* sql tests
* scrape test
* update doc string
* add rest tests
* update sql sensor _update signature
* fix scrape test constructor
* move state check to trigger_entity
* fix comments
* Update homeassistant/components/template/trigger_entity.py
Co-authored-by: Erik Montnemery <[email protected] >
* Update homeassistant/helpers/trigger_template_entity.py
Co-authored-by: Erik Montnemery <[email protected] >
* Update homeassistant/helpers/trigger_template_entity.py
Co-authored-by: Erik Montnemery <[email protected] >
* update command_line and rest
* update scrape
* update sql
* add case to command_line sensor
---------
Co-authored-by: Erik Montnemery <[email protected] >
2025-04-25 13:17:25 +02:00
Erik Montnemery and GitHub
428cc1a951
Update signature of platforms' async_setup_entry in tests ( #138271 )
2025-02-11 13:17:39 +01:00
epenet and GitHub
d0a188b86d
Standardize homeassistant imports in component tests (m-z) ( #136807 )
2025-01-29 08:57:57 +01:00
Paulus Schoutsen and GitHub
a927312fb5
Ensure all template names are strings ( #129921 )
2024-11-05 22:36:26 -05:00
epenet and GitHub
5fb9537d6d
Use pytest.mark.usefixtures for start_ha in template tests ( #126805 )
2024-09-26 14:00:52 +02:00
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 <[email protected] >
* Adjust return type
Co-authored-by: Martin Hjelmare <[email protected] >
---------
Co-authored-by: Erik Montnemery <[email protected] >
Co-authored-by: Martin Hjelmare <[email protected] >
2024-09-11 09:36:49 +02:00
epenet and GitHub
3dc83ef19d
Add missing hass type hint in component tests (t) ( #124274 )
2024-08-20 12:55:39 +02:00
dougiteixeira and GitHub
10edf85311
Update test_device_cleaning in Template ( #120163 )
2024-06-22 15:59:46 +02:00
dougiteixeira and GitHub
6e32a96ff3
Add the ability to bind the template helper entity to a device ( #117753 )
2024-06-22 12:45:06 +02:00
epenet and GitHub
99b349fa2c
Fix consider-using-dict-items warnings in tests ( #119497 )
2024-06-12 16:44:29 +02:00
6bb4e7d62c
Bump ruff to 0.3.4 ( #112690 )
...
Co-authored-by: Sid <[email protected] >
Co-authored-by: Marc Mueller <[email protected] >
Co-authored-by: J. Nick Koston <[email protected] >
2024-03-26 00:02:16 +01:00
J. Nick Koston and GitHub
b574220247
Refactor rate limit helper to track time in seconds ( #113898 )
...
* Refactor rate limit helper to track time in seconds
Currently we created datetime and timedelta objects to enforce the
rate limit. When the rate limit was being hit hard, this got expensive.
We now use floats everywhere instead as they are much cheaper which
is important when we are running up against a rate limit, which is
by definition a hot path
The rate limit helper is currently only used for templates and
we do not have any code in the code base that directly passes
in a rate limit so the impact to custom components is expected
to be negligible if any
* misesd two
2024-03-20 19:49:37 -04:00
J. Nick Koston and GitHub
6b5518b2bf
Fix template sensor test relying on event bus debug logging ( #113842 )
2024-03-19 10:44:04 -10:00
d0352ed91d
Fix missing context when running script from template entity ( #113523 )
...
Co-authored-by: J. Nick Koston <[email protected] >
2024-03-16 12:37:24 -10:00
Marc Mueller and GitHub
87165c0d6e
Add empty line after module docstring [tests t-z] ( #112712 )
2024-03-08 14:44:56 +01:00
RoboMagus and GitHub
c54b65fdf0
Add 'last_reset' for 'total' state_class template sensor ( #100806 )
...
* Add last_reset to trigger based template sensors
* Add last_reset to state based template sensors
* CI check fixes
* Add pytests
* Add test cases for last_reset datetime parsing
* Add test for static last_reset value
* Fix ruff-format
2024-01-25 11:12:03 +01:00
J. Nick Koston and GitHub
c399cab427
Small speed up to checking core state ( #107845 )
2024-01-18 08:41:32 -10:00
J. Nick Koston and GitHub
4b7a313ece
Use identity checks for CoreState ( #107846 )
...
Some of the checks used ==, and some used is. Switch
everything to is as its faster
2024-01-12 10:21:26 +01:00
Erik Montnemery and GitHub
42046a3ce2
Fix TriggerEntity.async_added_to_hass ( #100119 )
2023-09-11 14:33:43 +02:00
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 <[email protected] >
2023-09-02 16:19:45 -07:00
Erik Montnemery and GitHub
8c04e4c7a3
Add explicit test of template config entry setup ( #99345 )
2023-08-30 19:56:34 +02:00
Erik Montnemery and GitHub
63c538b024
Add config flow for template sensor ( #98970 )
...
* Add config flow for template sensor
* Tweak error reporting
* Improve validation
* Fix test
* Rename translation strings
* Improve validation
* Fix sensor async_setup_entry
* Avoid duplicating sensor device class translations
* Avoid duplicating sensor device class translations
* Add config flow tests
* Include all units from DEVICE_CLASS_UNITS in unit_of_measurement select
* Address review comments
2023-08-30 16:22:52 +02:00
epenet and GitHub
9762b684c2
Adjust entity registry access in tests (3) ( #88964 )
2023-03-01 16:04:40 +01:00
epenet and GitHub
88cfbf6a34
Add type hints to integration tests (part 22) ( #88234 )
2023-02-16 14:08:03 +01:00
Franck Nijhof and GitHub
d3ed8de232
Update Ruff to v0.0.247 ( #88210 )
...
* Update Ruff to v0.0.247
* Fix new found violations
2023-02-15 16:46:03 -05:00
Franck Nijhof and GitHub
ed79265843
Enable Ruff PT006 ( #88165 )
...
* Enable Ruff PT006
* Adjust existing cases
* Fix tests
* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenet and GitHub
278050a73f
Add type hints to integration tests (t-z) ( #87707 )
2023-02-08 19:10:53 +01:00
epenet and GitHub
1a8933d59d
Adjust invalid test values in template ( #86008 )
2023-01-16 14:42:47 +01:00
Franck Nijhof and GitHub
2e92fefc0a
Fix uom/device class mismatches in tests ( #84372 )
2022-12-21 22:47:59 +01:00
akloeckner and GitHub
aa314a0901
Add this variable to trigger-based templates ( #72437 )
...
add this variables to trigger-based templates
follow-up for https://github.com/home-assistant/core/issues/70359
2022-06-27 08:59:29 +02:00
Erik Montnemery and GitHub
eba125b093
Ensure 'this' variable is always defined for template entities ( #70911 )
2022-05-03 07:43:44 -07:00
Erik Montnemery and GitHub
9bec649323
Restore state of trigger-based template sensor ( #69344 )
2022-04-21 09:32:18 -07:00
d20a620590
Make this variable available in template entities ( #65201 )
...
* feat: make this variable available in template entities
This makes the variable `this` available in template entities.
It will simplify the use of self-referencing template entities.
Because, without this, we have to repeat the entity id every time.
If we can solve this without explicitly spelling the entity id,
code can be re-used much better.
As a side-effect, this will allow to use `variables`-like patterns,
where attributes can be used as variables to calculate subsequent attributes or state.
Example:
```yaml
template:
sensor:
- name: test
state: "{{ this.attributes.test }}"
# not: "{{ state_attr('sensor.test', 'test' }}"
attributes:
test: "{{ now() }}"
```
* expose entity_id instead of this
* add test
* Refactor to expose this variable
* Tweak repr dunder
Co-authored-by: Erik <[email protected] >
2022-04-20 15:30:17 +02:00
Franck Nijhof and GitHub
d645e80ccd
Clean up async_update_entity helper usage ( #68641 )
2022-03-25 15:22:58 -07:00
cf4033b1bc
Simplify time zone setting in tests ( #68330 )
...
* Simplify timezone setting in tests
* Fix typo
* Adjust caldav tests
* Adjust input_datetime tests
* Adjust time_date tests
* Adjust tod tests
* Adjust helper tests
* Adjust recorder tests
* Adjust risco tests
* Adjust aemet tests
* Adjust flux tests
* Adjust forecast_solar tests
* Revert unnecessary change in forecast_solar test
* Adjust climacell tests
* Adjust google tests
* Adjust sensor tests
* Adjust sonarr tests
* Adjust template tests
* Adjust zodiac tests
Co-authored-by: Martin Hjelmare <[email protected] >
2022-03-20 10:25:15 +01:00