Commit Graph

179 Commits (f24f0c2954a4a489912d6466edee5e5d6223b7e7)

Author SHA1 Message Date
Petro31 f3007b22c4
Allow setting set_percentage and set_preset_mode of template fan without turning on (#75656)
* decouple set_percentage and set_preset_mode from entity state

* correct set_percent self._state logic

* Add tests

* remove _VALUD_STATES

* decouple percent and preset_mode
2022-10-03 20:22:05 +02:00
epenet 0ac581a0b1
Cleanup EntityFeature in tests (#78859) 2022-09-21 10:48:55 +02:00
epenet 7bc2712142
Adjust root-import in tests (#78761)
* Adjust root-import in tests

* Adjust diagnostics

* Adjust button

* Adjust select

* Adjust device_tracker

* Adjust camera

* Adjust humidifier

* Adjust media_source

* Adjust update

* Adjust siren

* Adjust number

* Adjust alarm_control_panel

* Adjust notify

* Adjust sensor

* Adjust switch

* Revert anthemav

* Don't adjust demo humidifier
2022-09-19 15:22:23 +02:00
Erik Montnemery c134bcc536
Remove use of deprecated SUPPORT_* constants from Template light (#77836) 2022-09-08 11:22:38 +02:00
Erik Montnemery 60c8d95a77
Remove white_value support from light (#76926) 2022-08-18 08:21:05 -04:00
Erik Montnemery 426a620084
Remove deprecated white_value support from template light (#76923) 2022-08-17 07:53:56 -04:00
Kostas Chatzikokolakis 3f53ed5d5c
Add trigger/arm_custom_bypass to Template Alarm Control Panel (#74629) 2022-07-07 20:31:03 +02:00
mbo18 24d2d62121
Add vacation mode to Template Alarm Control Panel (#74261) 2022-06-30 12:22:03 -07:00
akloeckner 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 4885331509
Fail template functions when no default specified (#71687) 2022-05-13 09:46:49 -07:00
Erik Montnemery 83080dbba8
Support this variable in template cover actions (#71793) 2022-05-13 09:34:00 -07:00
Erik Montnemery a17fa6d6d5
Support this variable in template fan actions (#71795) 2022-05-13 09:33:44 -07:00
Erik Montnemery 8b412acc98
Support this variable in template lock actions (#71796) 2022-05-13 09:33:25 -07:00
Erik Montnemery 66ec4564f4
Support this variable in template number actions (#71797) 2022-05-13 09:33:00 -07:00
Erik Montnemery adde9130a1
Support this variable in template select actions (#71798) 2022-05-13 09:32:45 -07:00
Erik Montnemery 6f7a465347
Support this variable in template vacuum actions (#71800) 2022-05-13 09:32:19 -07:00
Erik Montnemery 9eca91afc9
Support this variable in template light actions (#71805) 2022-05-13 09:31:37 -07:00
Erik Montnemery 042321be60
Support this variable in template button actions (#71792) 2022-05-13 17:28:36 +02:00
Erik Montnemery 184421dae6
Support this variable in template switch actions (#71799) 2022-05-13 16:44:27 +02:00
Erik Montnemery 6cff2f8571
Tweak template light tests (#71729) 2022-05-13 12:22:34 +02:00
Erik Montnemery dba2f5ab1c
Support this variable in template alarm actions (#71744) 2022-05-13 12:17:40 +02:00
Erik Montnemery 3332c853c4
Remove prints from template tests (#71746) 2022-05-12 18:34:26 +02:00
Erik Montnemery 11cc1feb85
Tweak template switch tests (#71738) 2022-05-12 17:08:21 +02:00
Erik Montnemery 35e4f11e0b
Tweak template lock tests (#71734) 2022-05-12 16:29:48 +02:00
Erik Montnemery b70e97e949
Remove unused calls fixture from template tests (#71735) 2022-05-12 16:04:01 +02:00
Erik Montnemery 1ef3800844
Tweak template cover tests (#71732) 2022-05-12 15:22:57 +02:00
Erik Montnemery 8f50a70ff5
Tweak template alarm tests (#71730) 2022-05-12 14:09:43 +02:00
Erik Montnemery fb6cdb5a38
Optimistically set hs_color in template light (#71629)
* Optimistically set hs_color in template light

* Update light.py

* Update test
2022-05-11 09:57:54 +02:00
Erik Montnemery 275a90a2e8
Check state attributes in template light tests (#71608) 2022-05-10 12:46:02 +02:00
Erik Montnemery eba125b093
Ensure 'this' variable is always defined for template entities (#70911) 2022-05-03 07:43:44 -07:00
Shay Levy 75debb7dec
Add entity id to template error logging (#71107)
* Add entity id to template error logging

* Increase coverage
2022-04-30 19:24:24 +03:00
epenet 7d2363ad22
Use light enums in tests (#70801) 2022-04-26 16:32:00 +02:00
Erik Montnemery 9bec649323
Restore state of trigger-based template sensor (#69344) 2022-04-21 09:32:18 -07:00
akloeckner 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 <erik@montnemery.com>
2022-04-20 15:30:17 +02:00
Erik Montnemery 7b5dd4a623
Restore attributes of template binary sensor (#69350) 2022-04-05 22:58:12 -07:00
epenet 831e2ace9c
Prettify yaml (tests) (#68891) 2022-03-30 11:26:08 +02:00
Franck Nijhof d645e80ccd
Clean up async_update_entity helper usage (#68641) 2022-03-25 15:22:58 -07:00
Paulus Schoutsen 8bbbd1947d
Raise if referenced entity does not support service (#68394) 2022-03-20 16:01:58 -07:00
Erik Montnemery 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 <marhje52@gmail.com>
2022-03-20 10:25:15 +01:00
Erik Montnemery 7fc0ffd5c5
Restore state of trigger based template binary sensor (#67538) 2022-03-14 12:28:55 -07:00
J. Nick Koston 723dcbafca
Complete fan speed transition from #59781 (#67743) 2022-03-09 10:38:12 +01:00
Erik Montnemery 2007379701
Restore state of template binary sensor with on or off delay (#67546) 2022-03-03 15:27:39 -08:00
Erik Montnemery 5622e45980
Render icon and picture templates at setup (#64838) 2022-01-24 16:40:50 +01:00
Erik Montnemery 321f54494e
Teach TemplateEntity entity name (#62175)
* Teach TemplateEntity entity name

* Remove default name from number and select config schemas

* Re-add default name to number and select config schemas

* Set name to None if name template fails to render

* Update template button
2022-01-24 15:44:05 +01:00
Erik Montnemery 8f99cb51b5
Improve test coverage of template button (#63265) 2022-01-03 10:39:24 +01:00
Raman Gupta 6f8cd54ca1
Add button platform to template integration (#61908)
* Add button platform to template integration

* review comments

* add unique ID check
2022-01-03 10:03:37 +01:00
Amos Yuen 45ab9a3e33
Init template trigger binary sensor to None instead of False (#62769) 2021-12-27 20:52:26 +01:00
Franck Nijhof 60b2cdd069
Allow binary sensor state to be None (#60193) 2021-12-22 12:24:29 +01:00
Erik Montnemery 4353b1e62c
Improve tests for template binary sensor (#62103) 2021-12-16 21:31:37 +01:00
Franck Nijhof 1ed490ce62
Fix date/datetime support for templates (#61088)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-12-09 11:43:48 +01:00