Input_text.set_value problem

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

Input texts do have a max length. I think it defaults to something like 100 (check entity settings), but it can only be set up to 255 max.

If you exceed it the operation will fail.

Entity states are not a good option for storing large lists of data.

1 Like

Ok thanks! Maybe I’m doing something suboptimal here. The only reason why I store the text in input_text is because i’d like to avoid sending repeating temperature warnings - so only when text input changes will I trigger a notification. Is there a better way to do it in order to avoid same message being sent over and over again?
Many thanks

You could create a template sensor whose State is your list of rooms.

When that template state changes… Trigger your automation on that

1 Like

Thanks I found out that it was because the default limit is 100, I changed it to 255 and solves the problem. I have now migrated to Alert and put the warning message under custom attribute (there is no limit) and it works better with control of notification intervals etc.
I’m still shockingly surprised Alert is such underestimated integration and lack of many features though. For example can’t ack or do action based on notification…

1 Like