We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
self referencing makes it easier to reuse the template code
add this variable
No response
this is an example on how I would like to use the "this" variable.
homeassistant: customize: package.node_anchors: common: &common package: template_thermostats <<: &config_general modes: - "auto" - "heat" - "off" min_temp: 5 max_temp: 30 # get current temp. current_temperature_template: > {% set entity = this.entity_id | regex_replace('_template', '') %} {{ state_attr(entity,'current_temperature')|float(0) }} # get target temp target_temperature_template: > {% set entity = this.entity_id | regex_replace('_template', '') %} {{ state_attr(entity,'temperature')|float(0) }} # set target temp set_temperature: - service: climate.set_temperature data: temperature: "{{ temperature | float(0) }}" target: entity_id: > {% set entity = this.entity_id | regex_replace('_template', '') %} {{ entity }} # set target temp set_hvac_mode: - variables: automation_id: > {% set room = this.entity_id | regex_replace('climate.thermostat_|_template', '') %} automation.{{room}}_heizung_automatik entity_id: > {% set entity = this.entity_id | regex_replace('_template', '') %} {{ entity }} - alias: "choose mode" choose: - conditions: "{{ hvac_mode == 'auto' }}" sequence: - service: automation.turn_on target: entity_id: "{{ automation_id }}" - service: automation.trigger target: entity_id: "{{ automation_id }}" - conditions: "{{ hvac_mode == 'heat' }}" sequence: - service: automation.turn_off target: entity_id: "{{ automation_id }}" default: - service: automation.turn_off target: entity_id: "{{ automation_id }}" - service: climate.set_temperature target: entity_id: "{{ entity_id }}" data: temperature: 5 availability_template: > {% set entity = this.entity_id | regex_replace('_template', '') %} {{ states(entity) not in ['unavailable'] }} target_temperature_high_template: > {% set entity = this.entity_id | regex_replace('_template', '') %} {{ state_attr(entity,'max_temp') }} target_temperature_low_template: > {% set entity = this.entity_id | regex_replace('_template', '') %} {{ state_attr(entity,'min_temp') }} temp_step: 0.5 climate: - platform: climate_template name: Thermostat Flur Oben Template unique_id: ad143f13-699d-4f5c-84ce-6fc0c5b9c192 <<: *config_general - platform: climate_template name: Thermostat Wohnzimmer Template unique_id: fdd7ebd6-8ab6-4c85-bdc1-47efd5149ba7 <<: *config_general
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a problem? Please describe.
self referencing makes it easier to reuse the template code
Describe the solution you'd like
add this variable
Describe alternatives you've considered
No response
Additional context
this is an example on how I would like to use the "this" variable.
The text was updated successfully, but these errors were encountered: