Commit Graph

222 Commits (f166fc009a8111be8e3b172a845009462b5c0d47)

Author SHA1 Message Date
epenet 5cfb31d28a
Adjust device_automation type hints in core components (#72207) 2022-05-23 16:07:34 +02:00
Franck Nijhof c0da97b038
Clean up accessing service helpers via hass (#72013) 2022-05-17 10:56:57 -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 dba2f5ab1c
Support this variable in template alarm actions (#71744) 2022-05-13 12:17:40 +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
Marc Mueller 6eef3c16f2
Update pylint to 2.13.8 (#71280) 2022-05-04 12:14:24 +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 e63aef79fe
Use LightEntityFeature enum in template (#71056) 2022-04-29 22:43:33 +03:00
Erik Montnemery 2fb16fd06c
Deprecate white_value support in template light (#71044) 2022-04-29 22:40:23 +03:00
Erik Montnemery 76d105d0ba
Sort stuff in template light (#71045) 2022-04-29 09:46:02 +02:00
epenet 21badfc40f
Use shorthand attributes in template vacuum (#70847) 2022-04-27 09:00: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
Franck Nijhof 1e4aacaeb1
Replace Alarm Control Panel FORMAT_ constants with CodeFormat enum (#69861) 2022-04-18 19:37:32 +02:00
epenet c583df74e4
Use EntityFeature enums in template (#69583) 2022-04-07 20:08:57 +02:00
Erik Montnemery 7b5dd4a623
Restore attributes of template binary sensor (#69350) 2022-04-05 22:58:12 -07:00
Erik Montnemery a95b4f6763
Correct unit_of_measurement for trigger-based template sensor (#69291) 2022-04-04 22:10:59 -07:00
epenet bfd84ba89c
Prettify yaml (services.yaml) (#68878) 2022-03-30 09:48:06 +02:00
Marc Mueller 830cc278d3
Improve `CoordinatorEntity` typing (#68441) 2022-03-21 10:22:30 +01:00
Paulus Schoutsen 8bbbd1947d
Raise if referenced entity does not support service (#68394) 2022-03-20 16:01:58 -07: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
Franck Nijhof cb1299b434
Fix Fan template loosing percentage/preset (#67648)
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-03-04 20:17:11 +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
epenet 47d6f75c17
Enable basic type checking in template (#66222)
* Fix binary_sensor

* Adjust button

* Adjust fan

* Adjust select

* Adjust template_entity

* Adjust trigger_entity

* Adjust weather

* Adjust init

* Adjust number

* Adjust None check
2022-02-10 10:59:54 +01:00
Erik Montnemery e9a9b119c4
Teach TemplateEntity unique_id (#64837) 2022-01-24 23:16:31 +01:00
epenet 78e92d1662
Adjust pylint plugin to enforce platform type hints (#64836)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-24 18:51:06 +01: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
epenet 1c30992b0e
Add setup type hints to all template platforms (#63295)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 16:23:12 +01:00
epenet 71cb42f53a
Add fan setup type hints (#63287)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 15:10:53 +01:00
epenet 862daff622
Add binary_sensor setup type hints [s-z] (#63271)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 13:13:03 +01:00
epenet 24fc0df4b0
Add alarm_control_panel setup type hints (#63264)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-03 10:57:25 +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
epenet 18056f3a8a
Add init type hints [t-u] (#63194)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-01 22:06:11 -08:00
epenet 803eaa8e22
Ensure admin service calls are typed (#63093)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-30 21:12:40 +01:00
Sebastian Lövdahl 53f4a3d8bc
Use Platform constants all over the place 3/3 (#62954) 2021-12-28 21:24:27 +01:00
Amos Yuen 45ab9a3e33
Init template trigger binary sensor to None instead of False (#62769) 2021-12-27 20:52:26 +01:00
Erik Montnemery 0e28fbbe83
Minor refactor of template vacuum (#61860) 2021-12-16 20:53:19 +01:00
Erik Montnemery 6acf45566e
Minor refactor of template switch (#61859) 2021-12-16 17:11:47 +01:00
Erik Montnemery 597045149f
Minor refactor of template select (#62091) 2021-12-16 17:11:27 +01:00