Commit Graph

237 Commits (ef6fd78ede448ac6d88e92f005b4e9520c6b00e8)

Author SHA1 Message Date
epenet 9211ba8371
Improve type hints in template (#74294) 2022-07-01 10:05:37 -07:00
mbo18 24d2d62121
Add vacation mode to Template Alarm Control Panel (#74261) 2022-06-30 12:22:03 -07:00
Erik Montnemery 146ff83a16
Migrate rest binary_sensor and switch to TemplateEntity (#73307) 2022-06-28 13:53:38 -07:00
G Johansson 4b5c0be896
Native to Weather Template (#74060)
* Native to Weather template

* Add validation
2022-06-28 13:42:58 +02:00
epenet dac8f242e0
Improve type hints in mqtt and template alarms (#74101) 2022-06-28 13:41:23 +02:00
epenet 8e1ec07f3d
Adjust type hints in component alarm methods (#74092)
* Adjust type hints in component alarm methods

* Undo related change

* Undo related change
2022-06-28 10:00:23 +02: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
epenet 10dc38e0ec
Adjust CoverEntity property type hints in components (#73943)
* Adjust CoverEntity property type hints in components

* Revert changes to rflink

* Revert changes to wilight
2022-06-25 11:59:56 +02:00
epenet a92ab7a669
Adjust CoverEntity function type hints in components (#73912)
Adjust CoverEntity functions in components
2022-06-24 06:40:26 +02:00
epenet 3c82c718cb
Improve typing in fans and locks (#73901) 2022-06-23 16:34:40 +02:00
epenet 6b6e5fad3c
Add missing type hints in fans (#73835) 2022-06-22 18:43:41 +02:00
Erik Montnemery 7a82794ad7
Migrate template NumberEntity to native_value (#73537) 2022-06-15 17:06:44 +02:00
epenet f8f1bfde21
Add lock typing in components (#73539)
* Add lock typing in components

* Revert freedompro amends
2022-06-15 15:23:36 +02:00
Erik Montnemery 5987266e56
Refactor template entity to allow reuse (#72753)
* Refactor template entity to allow reuse

* Fix schema and default name

* Add tests

* Update requirements

* Improve test

* Tweak TemplateSensor initializer

* Drop attributes and availability from TemplateEntity

* Use rest sensor for proof of concept

* Revert changes in SNMP sensor

* Don't set _attr_should_poll in mixin class

* Update requirements
2022-06-08 15:55:49 +02:00
Erik Montnemery b89cd37de8
Remove dead code from template fan (#72917) 2022-06-02 08:19:15 -07:00
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