Can I do nested while?

I’m trying to get this script work but with no luck, I keep getting an error: Message malformed: Integration ‘’ not found

alias: Test nested whiles
sequence:
  - repeat:
      while:
        - condition: state
          entity_id: binary_sensor.withings_in_bed_mohamed
          state: 'on'
      sequence:
        - repeat:
            while:
              - condition: state
                entity_id: binary_sensor.withings_in_bed_mohamed
                state: 'on'
            sequence:
              - service: media_player.play_media
                target:
                  entity_id: media_player.office_echo_dot
                data:
                  media_content_type: custom
                  media_content_id: Simon says "hi"
              - delay:
                  seconds: 2
        - wait_for_trigger:
          - platform: state
            entity_id: binary_sensor.withings_in_bed_mohamed
            to: 'on'
        timeout: "00:00:20"
        continue_on_timeout: false
mode: single
icon: mdi:alarm

What I’m trying to do?
I want the script to keep setting alarms to my Amazon echo until I get out of bed. But if I went to bed again within an hour it will do that all over again.

Ive done nested “choose” so I don’t know why you wouldn’t be able to do nesting here.

The error is a bit vague but I’m pretty sure it doesnt have to do with that script.

Check the indentations and such because it’s saying it can’t find an integration. Specifically the ‘’ integration.

Are you sure the quotes here aren’t causing issues?

Is it possible to use nested loops ? “While” inside “while” ? If possible, how can I get parent repeat.index inside child repeat block ?

I would like to bring this topic again to the front. Are nested loops possible? And if yes, how can I do it, so that I can still access the repeat.index info?
(I know I can do it with two scripts which are calling each other but that’s not so nice :slight_smile: )

Background: I’m trying to build a script to configure all my z-wave devices in the same way. For this I want to loop over all z-wave devices with {{ states.cover | map(attribute = \"entity_id\") | list }}. Then I want to create an additional list containing all the config-parameters with its config-values.
Now I want to loop over the device-list and then through the list of parameters.

I hope I can find some help here.