Files
core/tests/components
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
..
2021-08-17 17:29:20 +02:00
2022-01-26 10:34:33 +01:00
2022-04-20 08:56:05 +02:00
2022-03-30 11:26:08 +02:00
2022-03-22 21:01:24 -07:00
2022-02-26 19:37:24 +01:00
2021-09-13 18:18:21 +02:00
2022-03-26 09:50:50 -10:00
2022-02-12 11:49:37 -06:00
2022-02-19 11:38:10 +01:00
2022-04-11 16:51:13 +02:00
2022-03-20 20:34:02 -07:00
2022-04-01 15:11:37 +02:00
2022-03-30 11:26:08 +02:00
2022-03-03 15:12:33 -08:00
2022-01-18 11:02:43 -08:00
2022-03-30 12:15:04 +02:00
2022-03-30 12:15:04 +02:00
2021-11-01 20:47:05 -07:00
2022-03-30 12:15:04 +02:00
2022-03-30 16:15:34 +02:00
2022-03-30 11:26:08 +02:00
2022-04-18 16:27:14 +02:00
2022-02-12 08:28:54 -06:00
2022-03-07 18:58:29 +01:00
2022-04-14 15:29:31 -07:00
2021-10-14 10:03:38 -07:00
2022-02-19 20:27:06 +01:00
2021-11-01 20:47:05 -07:00
2022-03-04 08:20:10 -10:00
2022-03-01 13:18:49 +02:00
2021-11-01 20:47:05 -07:00
2022-01-20 15:03:14 +01:00
2021-06-11 13:35:03 +02:00
2022-03-16 10:18:55 +01:00
2022-02-23 09:26:46 -10:00
2022-04-12 14:10:54 -07:00
2022-03-12 12:36:08 +01:00
2022-03-03 07:59:31 +01:00
2021-12-31 09:44:35 -10:00
2022-01-13 15:32:39 +01:00