311 Commits

Author SHA1 Message Date
Petro31
c25f26a290
Fix empty actions (#142292)
* Apply fix

* Add tests for alarm button cover lock

* update light

* add number tests

* test select

* add switch tests

* test vacuum

* update lock test
2025-04-04 20:18:31 +00:00
Petro31
2396fd1090
Fix weather templates using new style configuration (#136677) 2025-04-02 14:19:19 +00:00
Petro31
e162499267
Fix an issue with the switch preview in beta (#141617)
Fix an issue with the switch preview
2025-03-28 14:05:16 +00:00
Petro31
212d39ba19
Migrate template switch to new style (#140324)
* Migrate template switch to new style

* update tests

* Update tests

* Add config flow migration

* comment fixes

* revert entity config migration
2025-03-20 15:12:43 +01:00
Petro31
84667fd32d
Migrate template light to new style (#140326)
* Migrate template light to new style

* add modern templates to tests

* fix comments
2025-03-14 09:00:46 +01:00
Petro31
293d455cba
Add check for invalid options with specific platforms (#140082) 2025-03-08 00:09:04 +01:00
Petro31
aec6868af1
Add abstract class to trigger based template entities (#139650)
* add abstract class to trigger based template entities

* updates after merge of parent PR

* add comments

* add tests
2025-03-06 08:00:11 +01:00
Petro31
890d3f4af4
Add a base class for template entities to inherit from (#139645)
* add-abstract-template-entity-base-class

* review 1 changes
2025-03-04 07:23:05 +01:00
Jan Bouwhuis
fdf69fcd7d
Improve calculating supported features in template light (#139339) 2025-02-26 15:09:20 +00:00
Erik Montnemery
428cc1a951
Update signature of platforms' async_setup_entry in tests (#138271) 2025-02-11 13:17:39 +01:00
epenet
d0a188b86d
Standardize homeassistant imports in component tests (m-z) (#136807) 2025-01-29 08:57:57 +01:00
Petro31
d06b0fe340
Reload template blueprints when reloading templates (#136794) 2025-01-28 22:48:38 -05:00
epenet
b11b36b523
Add more util aliases to import conventions (#136153) 2025-01-21 15:58:23 +01:00
Stefan Agner
9ab69aa41c
Add mWh as unit of measurement for Matter energy sensors (#133005) 2024-12-13 09:33:58 +01:00
epenet
7bdf034b93
Migrate template light tests to use Kelvin (#133025) 2024-12-12 13:54:22 +01:00
G Johansson
2eaf206562
Implement new state property for vacuum which is using an enum (#126353)
* Implement new state property for vacuum which is using an enum

* Mod

* Mod init

* Mods

* Fix integrations

* Tests

* Fix state

* Add vacuum tests

* Fix last test

* Litterrobot tests

* Fixes

* Tests

* Fixes

* Fix VacuumEntity

* Mods

* Mods

* Mods

* Update demo

* LG

* Fix vacuum

* Fix Matter

* Fix deprecation version

* Mods

* Fixes

* Fix ruff

* Fix tests

* Fix roomba

* Fix breaking dates
2024-12-06 11:16:03 +01:00
G Johansson
3464ffc53e
Add open to Template lock (#129292)
* Add open to Template lock

* Update from review
2024-11-27 13:26:57 +01:00
Martin Hjelmare
ccbbcbb264
Make set value template number option required (#131625) 2024-11-26 19:27:59 +01:00
Sid
9e98e446a2
Bump ruff to 0.8.0 (#131273) 2024-11-22 16:53:26 +01:00
G Johansson
d0ad834d93
Move manual trigger entity tests (#130134) 2024-11-10 12:14:13 +01:00
Jakob Schlyter
cd11f01ace
Add support for MW/GW/TW and GWh/TWh (#130089) 2024-11-08 22:12:16 +01:00
Paulus Schoutsen
a927312fb5
Ensure all template names are strings (#129921) 2024-11-05 22:36:26 -05:00
G Johansson
cdfec7ebb4
Implement new state property for alarm_control_panel which is using an enum (#126283)
* Alarm state from enum

* Fixes

* Set final

* Fix rebase

* Test const

* Fix breaking version

* Fix other for alarm_control_panel

* Fix integrations

* More

* More

* More

* More

* Fix zha

* Replace _attr_state

* Fix alarm_control_panel

* Fix tests

* Fixes

* Mods

* Change some

* More

* More

* More

* Tests

* Last tests

* Return enum

* Fix zha

* Remove not needed check

* Fix wording

* Fix homekit

* Mod prometheus

* Fix mypy

* Fix homekit

* Fix ifttt
2024-10-21 22:54:27 +02:00
epenet
838519e89f
Use STATE_ON/STATE_OFF constants in template test (#128883) 2024-10-21 16:19:44 +02:00
epenet
be4641b8f3
Push real binary sensor states to state machine in tests (#128894) 2024-10-21 16:19:25 +02:00
G Johansson
666e8e133e
Cover state is enum (#127144)
* Change light state to use enum

* Adjust cover tests

* Update cover

* Fix covers

* Some tests

* More tests

* Fix tests

* Fix
2024-10-08 18:39:04 +02:00
Tudor Sandu
d9b077154e
Blueprints for template entities (#126971)
* Template domain blueprints

* Default blueprint for templates

* Some linting

* Template entity updates

* Load and use blueprints in config

* Added missing mapping methods for templates

* Linting

* Added tests

* Wrong schema type

* Hassfest errors

* More linting issues

* Refactor based on desired schema

In the [architecture discussion](https://github.com/home-assistant/architecture/discussions/1027), the template blueprint instance did not specify the platform (e.g. `binary_sensor`), but the initial implementation assumed that schema.

* Create default template blueprints on first run

* Moved TemplateConfig definition

This is to avoid circular references

* Corrected methods to find templates based on blueprints

* Corrected missing entity config information

* Added tests

* Don't use hass.data

Address comments https://github.com/home-assistant/core/pull/126971/#discussion_r1780097187

* Prevent creating blueprints during testing

* Combine 2 ifs

Address comment https://github.com/home-assistant/core/pull/126971/#discussion_r1780160870

* Improve test coverage

* Prevent template component from dirtying test env

* Remove useless hard-coded validation

* Improve code coverage to 100%

* Address review comments

* Moved helpers in helpers.py

As per comment https://github.com/home-assistant/core/pull/126971#discussion_r1786539889

* Fix blueprint source URL

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-10-04 16:47:29 +02:00
Paul Bottein
c306ebed49
Fix device id support for alarm control panel template (#127340) 2024-10-02 19:04:36 +02:00
epenet
6c539cd2d8
Improve type hints in template config_flow tests (#126803)
Improve type hints in template tests
2024-09-26 19:25:33 +02:00
epenet
5fb9537d6d
Use pytest.mark.usefixtures for start_ha in template tests (#126805) 2024-09-26 14:00:52 +02:00
G Johansson
93aade6e8e
Change lock state to an enum (#126379)
* Add new LockState enum for lock states

* Add rest

* Fix insteon tests

* Fix mqtt tests

* Fix tesla_fleet

* Revert back ST_STATE_LOCKED

* Add back constant
2024-09-24 12:30:50 +02:00
G Johansson
2080b9a87c
Add config flow to template alarm_control_panel (#125861)
* Add config flow to template alarm_control_panel

* Remove commented code

* Test import
2024-09-13 22:12:16 +02:00
G Johansson
d855f70e3b
Add RestoreEntity to template alarm_control_panel (#125844) 2024-09-13 16:44:48 +02: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
chammp
56dfb2c734
Add unit_of_measurement to template numbers (#122862) 2024-09-11 08:47:17 +02:00
Sergey Dudanov
dcd7830a35
Add calories to energy sensor device class (#122796)
* added calories to energy class

* changes

* temporarily solving the problem with conversion accuracy

* add tests

* added calories to energy class

* changes

* add tests

* Update homeassistant/util/unit_conversion.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Update homeassistant/util/unit_conversion.py

Co-authored-by: Robert Resch <robert@resch.dev>

* apply suggestions

* Update homeassistant/util/unit_conversion.py

---------

Co-authored-by: Robert Resch <robert@resch.dev>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-09-10 12:22:15 +02:00
epenet
af6434a533
Add alias to DOMAIN import in tests [n-z] (#125581) 2024-09-09 15:14:05 +02:00
Jason Hunter
513361ef0f
Fix failing template config flow tests (#125534)
fix: failing template config flow tests
2024-09-08 21:38:31 +02:00
Erik Montnemery
cf049a07c2
Don't allow templating min, max, step in config entry template number (#125342) 2024-09-06 07:59:22 +02:00
Joost Lekkerkerker
8c2e63807c
Make set_value required in number template (#124917)
* Make set_value required in number template

* Make set_value required in number template

* Fix tests
2024-08-30 22:02:10 +02:00
epenet
3dc83ef19d
Add missing hass type hint in component tests (t) (#124274) 2024-08-20 12:55:39 +02:00
dougiteixeira
f581066747
Add config flow for platform number in Template (#121849)
* Add config flow to select platform in Template

* Remove device id duplicate in schema

* Add config flow for number platform in Template

* Remove mode
2024-08-15 20:02:51 +02:00
epenet
67f761c0e9
Improve type hints in template tests (#123915) 2024-08-14 14:58:16 +02:00
Erik Montnemery
dc462aa529
Remove unnecessary assignment of Template.hass from template (#123773) 2024-08-13 11:54:36 +02:00
Joost Lekkerkerker
e8d7eb05ae
Delete unused snapshots (#123656)
* Delete unused snapshots

* Delete unused snapshots
2024-08-12 13:28:09 +02:00
Erik Montnemery
b973455037
Fix template image test affecting other tests (#122849) 2024-07-30 16:28:55 +02:00
Erik Montnemery
d9e996def5
Fix template binary sensor test (#122855) 2024-07-30 16:18:47 +02:00
Marc Mueller
a6068dcdf2
Update import locations in tests (#122216) 2024-07-20 11:16:04 +02:00
dougiteixeira
162b734be7
Add config flow for select platform in Template (#121809) 2024-07-12 17:50:02 +02:00
dougiteixeira
52454f5218
Add config flow for platform switch in Template (#121639) 2024-07-11 10:11:31 +02:00