I have been working on this issue for the whole day without luck, so would like to ask for some help here. I have an automation that checks if any room temperature is above or below threshold. I have made a global variable that stores the rooms names that are outside the threshold. The variable seems to work fine and I can see the text in notification, however when I set the value of an input_text with the same template, nothing happens:
min_temp_threshold: 25
max_temp_threshold: 40
thermostats:
- climate.bathroom_thermostat
- climate.bedroom_closet_thermostat
- climate.bedroom_thermostat
- climate.bedroom_toilet_thermostat
- climate.entrance_thermostat
- climate.guest_room_thermostat
- climate.kitchen_thermostat
- climate.living_room_thermostat
- climate.mias_room_thermostat
- climate.michaels_room_thermostat
- climate.office_thermostat
- climate.utility_room_thermostat
temperature_warning_list: >-
{% set ns = namespace(warnings=[]) %}
{% for entity in thermostats %}
{% set current_temp = state_attr(entity, 'current_temperature') %}
{% set room_raw = entity.split('.')[1].replace('_thermostat', '') %}
{% set room_name = room_raw.replace('_', ' ') | title %}
{% if current_temp is not none %}
{% if current_temp > max_temp_threshold %}
{% set ns.warnings = ns.warnings + [ room_name ] %}
{% elif current_temp < min_temp_threshold %}
{% set ns.warnings = ns.warnings + [ room_name ] %}
{% endif %}
{% endif %}
{% endfor %}
{% set full = ns.warnings | join(',') %}
{% if full | length > 255 %}
{{ full[:252] ~ '...' }}
{% else %}
{{ full }}
{% endif %}
My actions:
actions:
- action: input_text.set_value
target:
entity_id: input_text.warning_message
data:
value: "{{temperature_warning_list}}"
- action: persistent_notification.create
data:
title: "Debug Warning"
message: "{{ temperature_warning_list }}"
Using the same template, I can get text to display in notification but I can’t set the text on input_text. Any suggestion what could be the issue here? Thanks