Consider this trigger-based template sensor:
template:
- trigger:
- platform: template
value_template: >-
...
sensor:
name: xyz
state: >-
...
I may use a “this” variable inside the “sensor” section.
But can I use this variable inside “value_template”?
Use-case:
some “sensor.xyz” depends on “sensor.xyz_xyz”:
- trigger:
- platform: template
value_template: >-
{% set ENTITY_ID = 'sensor.xyz_xyz' %}
{{ ... do smth with ENTITY_ID ... }}
But I would like to declare as:
- trigger:
- platform: template
value_template: >-
{% set ENTITY_ID = this.entity_id + `_xyz' %}
{{ ... do smth with ENTITY_ID ... }}
Have not tested yet by myself, but I doubt that “this” may work here…
Also, ONE trigger may be used by several sensors which is one more prove that “this” cannot be used here.