#Run in parallel question.

1 messages · Page 1 of 1 (latest)

wild fossil
#

how can i make it so this only executes after the second one is done

muted valley
#

you mean like wait for each parallel branch to complete before executing the final action?

wild fossil
#

Wait for only the second branch to complete.

muted valley
#

It seems like you just need to put the last action in the first branch outside of the parallel: block

wild fossil
#

When will it execute?

muted valley
#

after the parallel block is complete

wild fossil
#

I don't want that.

#

The left part of the parallel block takes an hour to complete.

#

The right part takes 20 minutes.

#

I want the action to execute after the right part has finished.

muted valley
#

then just put it after the last action in the right part?

#

seems like you don't care what's happening on teh left side for this

wild fossil
muted valley
#

it's just a sequence

wild fossil
#

?

muted valley
#

it's really easier if you just share the code

silk sorrelBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

wild fossil
#
description: ""
triggers:
  - trigger: time
    at: "20:00:00"
conditions: []
actions:
  - parallel:
      - alias: Lower brightness until 10%
        repeat:
          until:
            - condition: numeric_state
              entity_id: light.wiz_rgbw_tunable_11bb5e
              attribute: brightness
              below: 27
              above: 0
          sequence:
            - action: light.turn_on
              metadata: {}
              data:
                brightness_step_pct: -1
              target:
                device_id:
                  - 8c3326364aa17256951fe2b018459761
                  - d442ec4aa9c1a9d959032abcea183c78
            - delay:
                hours: 0
                minutes: 0
                seconds: 40
                milliseconds: 0
      - alias: Lower temperature until 2200K
        repeat:
          until:
            - condition: numeric_state
              entity_id: light.wiz_rgbw_tunable_11bb5e
              attribute: color_temp_kelvin
              below: 2201
          sequence:
            - action: light.turn_on
              metadata: {}
              data:
                color_temp_kelvin: "{{ state_attr('light.wiz_north', 'color_temp_kelvin') - 1 }}"
              target:
                device_id:
                  - 8c3326364aa17256951fe2b018459761
                  - d442ec4aa9c1a9d959032abcea183c78
            - delay:
                hours: 0
                minutes: 0
                seconds: 2
                milliseconds: 750
  - action: light.turn_on
    metadata: {}
    data:
      rgbw_color:
        - 114
        - 10
        - 0
        - 255
    target:
      device_id:
        - d442ec4aa9c1a9d959032abcea183c78
        - 8c3326364aa17256951fe2b018459761
mode: single
muted valley
#

but if you've chosen to use a loop on the right side that eventually completes after 20 mins and you want to do something at that point, just put it after the loop

wild fossil
#

If I put it after the loop it will be inside the parallel block and execute instantly.

muted valley
#

It is also possible to run a group of actions sequentially inside the parallel actions. The example below demonstrates that:

#

no, it will execute after the loop

#

make it part of a sequence as shown in that example

#

loop, then action

#

you can do more than one thing in series in a parallel branch

wild fossil
#

That does not work.

#

Now it's repeated, as I said.

muted valley
#

looks like you put it in the loop

#

don't do that

#

follow the example

wild fossil
#

Where else would I put it?

#

Outside the loop?

#

So... inside the parallel block.

#

and it would execute instantly..

#

which I already said is not what I want.

muted valley
#

see the sequence: block in the example

#

I get that you seem perturbed

#

the sequence: block groups things together that will execute sequentially

#

use that, first thing is the loop, second thing is the action you want to happen after the loop

wild fossil
#

🤦‍♀️

muted valley
#

here is the example:

      - parallel:
          - sequence:
              - wait_for_trigger:
                  - trigger: state
                    entity_id: binary_sensor.motion
                    to: "on"
              - action: notify.person1
                data:
                  message: "This message awaited the motion trigger"
          - action: notify.person2
            data:
              message: "I am sent immediately and do not await the above action!"
wild fossil
#

im an idiot

#

I did read the example, very closely.

#

I did not realize I could put a sequence block inside a sequence block inside a parallel block.

#

I got confused because the loop already uses sequence blocks..

#

Solved.

#

Thanks RobC.