core/tests
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
..
auth
backports
components Make `this` variable available in template entities (#65201) 2022-04-20 15:30:17 +02:00
fixtures Prettify json (#68895) 2022-03-30 12:15:04 +02:00
hassfest Bump samsungtvws to 2.4.0 (#68225) 2022-03-16 20:44:14 -10:00
helpers Add shorthand notation for boolean conditions (#70120) 2022-04-18 22:09:09 +02:00
pylint Update pylint to 2.13.0 (#68656) 2022-03-25 15:14:48 -07:00
resources
scripts
test_util
testing_config Rename current_version to installed_version in Update platform (#69093) 2022-04-01 20:11:17 +02:00
util Switch to using ULIDs for context_ids (#70246) 2022-04-18 22:45:41 -07:00
__init__.py
bandit.yaml
common.py Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC (#69643) 2022-04-09 09:05:54 -10:00
conftest.py Prevent tests changing units from affecting other tests (#70300) 2022-04-19 11:38:52 -10:00
ignore_uncaught_exceptions.py
test_bootstrap.py Simplify time zone setting in tests (#68330) 2022-03-20 10:25:15 +01:00
test_config.py Simplify time zone setting in tests (#68330) 2022-03-20 10:25:15 +01:00
test_config_entries.py Fix reloading the sun integration (#69495) 2022-04-06 16:06:22 -07:00
test_core.py Remove EVENT_TIME_CHANGED and EVENT_TIMER_OUT_OF_SYNC (#69643) 2022-04-09 09:05:54 -10:00
test_data_entry_flow.py Add support for menu step (#68203) 2022-03-16 14:14:50 -07:00
test_exceptions.py
test_loader.py
test_main.py
test_requirements.py
test_runner.py
test_setup.py
test_test_fixtures.py