Repeat Until not working

Hi there,

i want the HA to turn of an shelly plug s at time x when the power ist under 15W. If the power ist over 15W the Plug should be powered off after the power falls under 15W. I try repeat until, but it wont work.

Here is the yaml:
alias: TV Arbeitszimmer - Nachts komplett ausschalten
description: “”
trigger:

  • platform: time
    at: “09:43:00”
    condition:
  • condition: and
    conditions:
    • type: is_power
      condition: device
      device_id: f458931e56d4cf03375d0a56df463ab1
      entity_id: sensor.shellyplug_s_d6b28c_power
      domain: sensor
      below: 15
      action:
  • repeat:
    until:
    - type: is_power
    condition: device
    device_id: f458931e56d4cf03375d0a56df463ab1
    entity_id: sensor.shellyplug_s_d6b28c_power
    domain: sensor
    below: 15
    sequence:
    - type: turn_off
    device_id: f458931e56d4cf03375d0a56df463ab1
    entity_id: switch.shellyplug_s_d6b28c
    domain: switch
    mode: single

What is wrong?

This may work:

description: "Automation"
mode: single
trigger:
  - platform: time
    at: "09:43:00"
condition: []
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.kitchen_dishwasher_power
            below: 15
        sequence:
          - service: switch.turn_off
            data: {}
            target:
              device_id: 1ee3a34630306a74389af04a8b496f9b
      - conditions:
          - condition: numeric_state
            entity_id: sensor.kitchen_dishwasher_power
            above: 15
        sequence:
          - wait_for_trigger:
              - platform: numeric_state
                entity_id: sensor.kitchen_dishwasher_outlet_power
                below: 15
          - service: switch.turn_off
            data: {}
            target:
              device_id: 1ee3a34630306a74389af04a8b496f9b

You’ll need to put your devices and entities in.

I’ve replaced your loop with a wait action. Since there is nothing happening in the loop I think it is better just to wait for an event to occur.

You may also want to set a timeout for the wait trigger as it may happen that the power never goes below 15W

@templeton_nash gives a good example.

But, to aid the learning process try and look at your automations logic as it does not make sense.

Your current automation shows:
At 0943h run automation
Is power below 15w if it’s not then cancel automation / don’t run the actions.

So your automation will never pass the condition unless the power is below 15 to start with. You need to remove it.

Also the action reads like this:
Until the power is below 15 keep turning the plug off.
This obviously makes no sense either. If you turn the plug off it’s going to be below 15 as you just turned it off.