#Variable persistence across iterations of while loop

1 messages · Page 1 of 1 (latest)

alpine verge
#

Variable persistence across iterations of while loop

#
sequence:
  - variables:
      message: "Initial: {{ now().strftime('%H:%M:%S %Y-%m-%d') }}" # initialize the variable
  - repeat:
      while: # condition xyz
      sequence:
        - variables: 
            message: "{{ message ~ '\ntest' ~ repeat.index ~ ': ' ~ now().strftime('%H:%M:%S') }}" # append the string
        - service: persistent_notification.create
          data:
            message: "{{ message }}"
        - service: do_thing
        - delay: 00:00:10

I'm looking for an output similar to this:

Initial: 13:32:00 2023-01-25
test1: 13:32:00
test2: 13:32:10
test3: 13:32:20
test4: 13:32:30

but instead I get just this:

Initial: 13:32:00 2023-01-25
test4: 13:32:30
raw peak
#

I don't think that's possible

#

You can use an input_datetime helper

#

Or an input_text helper

meager oasis
#

I would use an input helper for this, or a template sensor which is triggered by events if you really don't want an input helper