#Checking if another automation is not running before allowing this automation to continue...

1 messages · Page 1 of 1 (latest)

pulsar flame
#

Hey, 1st time post so please go gentle....
I have an automation which checks to make sure an associated automation is not running. This was working but has recently stopped.

The image below shows a result of false, but I believe it should be true as 0 is the correct state of an automation that's not running.

Updated:


alias: "LivingRoom 3: Button Sync"
description: Sync wall switch 3 button state to lamps if turned on/off by another means
triggers:
  - trigger: state
    entity_id:
      - light.grp_living_room_lamps
    to: "on"
    from: "off"
  - trigger: state
    entity_id:
      - light.grp_living_room_lamps
    to: "off"
    from: "on"
conditions:
  - condition: state
    entity_id: automation.livingroom_3_accent_lamps
    attribute: current
    enabled: true
    state: "0"
actions:
  - if:
      - condition: device
        type: is_on
        device_id: 93c5f30c14ad0ceb7d3104fdb25e722c
        entity_id: 2859e97a7d0d08408832333c8158e49b
        domain: light
      - condition: state
        entity_id: light.grp_living_room_lamps
        state: "off"
    then:
      - action: light.turn_off
        target:
          entity_id: light.livingroom_3way_lumi_switch_l3acn3_light_3
        data: {}
    else:
      - action: light.turn_on
        target:
          entity_id: light.livingroom_3way_lumi_switch_l3acn3_light_3
        data: {}
mode: single


weak kiln
#

Hi @pulsar flame,
Thanks for posting a question here.
It's going to be hard to troubleshoot without seeing the YAML code that you have built.
Using the edit as YAML button in the UI editor can you send us the YAML from both automations?

next galeBOT
#

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.

pulsar flame
#

Associated Automation for

https://discord.com/channels/330944238910963714/1295889381126574163

Below:

alias: "LivingRoom 3: Accent Lamps"
description: ""
triggers:
  - type: changed_states
    device_id: 93c5f30c14ad0ceb7d3104fdb25e722c
    entity_id: 2859e97a7d0d08408832333c8158e49b
    domain: light
    trigger: device
conditions: []
actions:
  - if:
      - condition: device
        type: is_on
        device_id: 93c5f30c14ad0ceb7d3104fdb25e722c
        entity_id: 2859e97a7d0d08408832333c8158e49b
        domain: light
    then:
      - data: {}
        target:
          entity_id:
            - light.grp_living_room_lamps
        action: input_boolean.turn_on
        enabled: false
      - action: light.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: light.grp_living_room_lamps
    else:
      - data: {}
        target:
          entity_id:
            - light.grp_living_room_lamps
        action: input_boolean.turn_off
        enabled: false
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: light.grp_living_room_lamps
mode: single

Sorry, had to put in a second message because of the 2000 Chr limit 🤦

cedar sparrow
#

I use the state of the 'current' attribute in a similar way:

  - if:
      - condition: numeric_state
        entity_id: automation.keypad_armed
        above: 0
        attribute: current

This is working. I'm using numeric state, though.

pulsar flame
#

I believe the automation is reporting in a number state. I set the automation up via the UI.

Oddly the running state (current in yaml) disappeared, possibly after updating to 24.10.0

#

Scratch that, I tired removing the quote marks around the 0 and the yaml would not save

drowsy nacelle
#

The attribute current is indeed an integer. You need to remove the quotes, and if you use the Ui you’ll have to switch to YAML mode (either for just that condition, or for the whole automation) to remove the quotes.

If it won’t let you save, you’ve done something incorrectly.

#

This is confirmed working:

conditions:
  - condition: state
    entity_id: automation.my_automation
    attribute: current
    state: 0
pulsar flame
drowsy nacelle
#

I’m running 2024.10.2 and am able to do this:

#

Can you share the YAML of your entire automation? If it’s small you can paste it in a code block here, otherwise use a code share site

next galeBOT
#

Please use a code share site to share code or logs, for example:

Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.

pulsar flame
#

alias: "LivingRoom 3: Button Sync"
description: Sync wall switch 3 button state to lamps if turned on/off by another means
triggers:
  - trigger: state
    entity_id:
      - light.grp_living_room_lamps
    to: "on"
    from: "off"
  - trigger: state
    entity_id:
      - light.grp_living_room_lamps
    to: "off"
    from: "on"
conditions:
  - condition: state
    entity_id: automation.livingroom_3_accent_lamps
    attribute: current
    enabled: true
    state: "0"
actions:
  - if:
      - condition: device
        type: is_on
        device_id: 93c5f30c14ad0ceb7d3104fdb25e722c
        entity_id: 2859e97a7d0d08408832333c8158e49b
        domain: light
      - condition: state
        entity_id: light.grp_living_room_lamps
        state: "off"
    then:
      - action: light.turn_off
        target:
          entity_id: light.livingroom_3way_lumi_switch_l3acn3_light_3
        data: {}
    else:
      - action: light.turn_on
        target:
          entity_id: light.livingroom_3way_lumi_switch_l3acn3_light_3
        data: {}
mode: single


pulsar flame
#

Interesting, because I originally programmed via the UI (24.9.x), I hadn't thought of leaving that section as yaml code, last time I tried tweaking I got an error when switching back to the UI for that section of the automation, I assumed (incorrectly) that the line was malformed, not helped by the number turning red 🤦. However if I leave this section as yaml and it does let me save and it and the automation does work as intended.

Thanks for your help. I'll double check on my backup server and see if I need to log a ticket to fix.

drowsy nacelle
#

Yeah for that section you will be unable to revert back to the UI editor and you’ll be left with that warning. You’re not the first person to interpret that message as an error that must be fixed