Input Text not Updating in a Loop

Hello thank you for your attention,

I ran into a problem where I am trying to create a pretty log message presentation. I was trying to use input text since that gives me more liberty then using a logbook from what I saw.

The problem I had was that apparently the state of the input text is not updating inside the loop. I am trying to use its state + the message I want to add but for some reason it only shows me a single message of the loop, which is not what I want

entity_id: input_text.light_test_log
                     value: >-
                        {{ states('input_text.light_test_log') + '\n' if
                        states('input_text.light_test_log') else '' }} Failure:
                        {{ current_entity_id }}
                    action: input_text.set_value

This inside the loop dosent work and Im not sure why not. (the indentation was because it was inside the loop sorry)

Hope someone can help thanks

Where is the loop?

Its wrapped around it. Ill share a bit more of the code hope it cna give some more context

repeat:
  count: "{{ total_batches }}"
  sequence:
    - variables:
        start_index: "{{ (repeat.index - 1) * (number_of_entities_per_batch | int) }}"
        end_index: >-
          {{ min(repeat.index * (number_of_entities_per_batch | int), entities |
          length) }}
        current_batch: "{{ entities[start_index:end_index] }}"
        current_batch_str: "{{ entities[start_index:end_index] | join(', ') }}"
    - action: logbook.log
      data:
        name: Debug
        message: >-
          Testing batch from {{ start_index }} to {{ end_index }}: {{
          current_batch }}
        entity_id: notify.light_test_output
    - repeat:
        count: "{{ current_batch | length }}"
        sequence:
          -  repeat:
            count: "{{ current_batch | length }}"
            sequence:
              - variables:
                  current_entity_id: "{{ current_batch[repeat.index - 1] }}"
             -  action: input_text.set_value
                    entity_id: input_text.light_test_log
                     value: >-
                        {{ states('input_text.light_test_log') + '\n' if
                        states('input_text.light_test_log') else '' }} Failure:
                        {{ current_entity_id }}
                    

This isnt quite what I have if you prefer I can send the whole thing but I felt like that would just be more confusing.
As you can see there is a bigger loop, and then smaller batch loops.
The ideia is that it turns on all lights in the batch, and then it registeres whether they turned on or not

Hope it helped

I’m thinking you will run in to the maximum characters quite fast with an input text.
If you have on Failure: then that is 11 characters. Then add a entity_id and then do the same for all lights…
I’m not sure that will work even if you get it to work.