Automation - Until condition doesn't trigger

I thought the sequence - until would save my day in a ‘Dim-Lights’ automation. Not so much.

See below code. Simple automation, zigbee2mqtt switch dim light until released. mqtt logs show the button_1_release, dev_tools show the switch beeing released. But once this automation starts… the until condition is never reached.

I’m lost…

Any help appreciated.

alias: Wallswitch Attic
description: 'Wallswitch Attic'

mode: single
initial_state: true

trigger:
  - platform: state    
    entity_id: sensor.wallswitch_attic_action
    to: button_1_hold

condition: []

action:
  - alias: Increase Light
    repeat:
      sequence:
        - service: light.turn_on
          data:
            entity_id: light.study_tafel
            brightness_step_pct: 5
        - delay: 00:00:01
      until:
        - condition: state
          entity_id: sensor.wallswitch_attic_action
          state: button_1_release

Try

state: 'off'

No such luck. Tried it : Same result. The automation keeps running and never reaches the until condition.

Maybe this will help, try to figure out how to implement in your solution.
I have one automation to increment slider.
And the second one to reset the input_number.

- id: '1601726261665'
  alias: rolety_number_increase_test_2
  description: ''
  trigger: []
  condition:
  - condition: not
    conditions:
    - condition: template
      value_template: '{{states.input_number.slider1.state==states.input_number.slider2.state}}'
  action:
  - repeat:
      until:
      - condition: template
        value_template: '{{states.input_number.slider1.state==states.input_number.slider2.state}}'
      sequence:
      - service: input_number.increment
        data: {}
        entity_id: input_number.slider1
      - delay: 00:00:01
  mode: single
  - id: '1601672201021'
  alias: rolety_channel_restart
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: input_number.slider1
    above: '5'
  condition: []
  action:
  - service: input_number.set_value
    data:
      value: 1
    entity_id: input_number.slider1
  mode: single

You don’t have a trigger. Are you calling this manually?

Automations without triggers are what scripts are for.

I do have a trigger in the original automation. And it triggers… It’s just the until clause that doesn’t trigger…

There is no trigger.

There is a trigger in my original automation.

``trigger:

  • platform: state
    entity_id: sensor.wallswitch_attic_action
    to: button_1_hold`

So why did you not post that?

Uuhhhmmm… It’s in the original code… Look at the start of this thread.

Oh ukro did that.

I’ve seen other posts with weird ‘until’ condition behaviour. In one case it worked with one step value but not another.

Correct… But if you do have some insight in why my ‘until’ condition doesn’t trigger : I’m open to suggestions.

I don’t have a clue why this doesn’t work. Simple automation, I see the condition fireing in the logs and still the until clause doesn’t trigger.

Clueless…

It appears to have a bug:

Freck… just my luck… a bug…

This is the only issue I could find and it appears to have been fixed on July 23 but the post I linked to above is after that (in August).

So a new issue wasn’t opened and thus no one is aware it needs to be fixed.

Once the automation has been triggered, does it start to correctly increase the brightness and then never stops increasing or does it increase once and then it stops?

I think even if you manage to get this to work, it’ll still not work as intended, because the brightness_step_pct part needs to read the current brightness before it adjusts the brightness and the next increase comes before the first increase has been finished, therefore HA is not able to read the correct current brightness. There’s an appdaemon app called Controller X that has a workaround for this issue.

2 Likes

The automation work fine when it starts. It increases the brightness and keeps going. It just never stops. It does throw of all my other automations, no automation works once this one is triggered.

I’ll have a quick look at the appdaemon app. I tried to stay away from appdaemon but if that’s what it takes… so be it.

Next to that : The mqtt topic ‘button_1_release’ is in the logfiles…

hehe got it :>

If you go to developers and look the entity sensor.wallswitch_attic_action
what did it now show in state column?